diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 512546d699b..ff584567975 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -107,28 +107,33 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * if (base_type == WINED3D_GL_RES_TYPE_COUNT) base_type = gl_type; - if ((usage & WINED3DUSAGE_RENDERTARGET) && !(format->flags[gl_type] & WINED3DFMT_FLAG_RENDERTARGET)) + if (type != WINED3D_RTYPE_BUFFER) { - WARN("Format %s cannot be used for render targets.\n", debug_d3dformat(format->id)); - continue; - } - if ((usage & WINED3DUSAGE_DEPTHSTENCIL) - && !(format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) - { - WARN("Format %s cannot be used for depth/stencil buffers.\n", debug_d3dformat(format->id)); - continue; - } - if (wined3d_settings.offscreen_rendering_mode == ORM_FBO - && usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL) - && !(format->flags[gl_type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)) - { - WARN("Render target or depth stencil is not FBO attachable.\n"); - continue; - } - if ((usage & WINED3DUSAGE_TEXTURE) && !(format->flags[gl_type] & WINED3DFMT_FLAG_TEXTURE)) - { - WARN("Format %s cannot be used for texturing.\n", debug_d3dformat(format->id)); - continue; + if ((bind_flags & WINED3D_BIND_RENDER_TARGET) + && !(format->flags[gl_type] & WINED3DFMT_FLAG_RENDERTARGET)) + { + WARN("Format %s cannot be used for render targets.\n", debug_d3dformat(format->id)); + continue; + } + if ((bind_flags & WINED3D_BIND_DEPTH_STENCIL) + && !(format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) + { + WARN("Format %s cannot be used for depth/stencil buffers.\n", debug_d3dformat(format->id)); + continue; + } + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO + && bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL) + && !(format->flags[gl_type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)) + { + WARN("Render target or depth stencil is not FBO attachable.\n"); + continue; + } + if ((bind_flags & WINED3D_BIND_SHADER_RESOURCE) + && !(format->flags[gl_type] & WINED3DFMT_FLAG_TEXTURE)) + { + WARN("Format %s cannot be used for texturing.\n", debug_d3dformat(format->id)); + continue; + } } if (((width & (width - 1)) || (height & (height - 1))) && !d3d_info->texture_npot