wined3d: Validate format capabilities against the bind flags instead of the usage flags in resource_init().
Note that buffer resources don't have an inherent format, so validating bind flags against WINED3DFMT_UNKNOWN doesn't make a lot of sense. This wasn't an issue previously because d3d11 doesn't set the usage flags corresponding to the bind flags for buffer resources, and earlier versions of D3D didn't allow buffers to be used as e.g. shader resources. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7d83ebeed2
commit
00275acca8
|
@ -107,29 +107,34 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
||||||
if (base_type == WINED3D_GL_RES_TYPE_COUNT)
|
if (base_type == WINED3D_GL_RES_TYPE_COUNT)
|
||||||
base_type = gl_type;
|
base_type = gl_type;
|
||||||
|
|
||||||
if ((usage & WINED3DUSAGE_RENDERTARGET) && !(format->flags[gl_type] & WINED3DFMT_FLAG_RENDERTARGET))
|
if (type != WINED3D_RTYPE_BUFFER)
|
||||||
|
{
|
||||||
|
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));
|
WARN("Format %s cannot be used for render targets.\n", debug_d3dformat(format->id));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((usage & WINED3DUSAGE_DEPTHSTENCIL)
|
if ((bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||||
&& !(format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_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));
|
WARN("Format %s cannot be used for depth/stencil buffers.\n", debug_d3dformat(format->id));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
|
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
|
||||||
&& usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL)
|
&& bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL)
|
||||||
&& !(format->flags[gl_type] & WINED3DFMT_FLAG_FBO_ATTACHABLE))
|
&& !(format->flags[gl_type] & WINED3DFMT_FLAG_FBO_ATTACHABLE))
|
||||||
{
|
{
|
||||||
WARN("Render target or depth stencil is not FBO attachable.\n");
|
WARN("Render target or depth stencil is not FBO attachable.\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((usage & WINED3DUSAGE_TEXTURE) && !(format->flags[gl_type] & WINED3DFMT_FLAG_TEXTURE))
|
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));
|
WARN("Format %s cannot be used for texturing.\n", debug_d3dformat(format->id));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (((width & (width - 1)) || (height & (height - 1)))
|
if (((width & (width - 1)) || (height & (height - 1)))
|
||||||
&& !d3d_info->texture_npot
|
&& !d3d_info->texture_npot
|
||||||
&& !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
|
&& !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
|
||||||
|
|
Loading…
Reference in New Issue