d3d11: Use proper bind flags for swapchain textures.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-25 10:33:29 +01:00 committed by Alexandre Julliard
parent f46b3adc09
commit 29b9724a14
5 changed files with 23 additions and 10 deletions

View File

@ -8758,13 +8758,13 @@ static void test_swapchain_flip(void)
ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr);
ID3D10Texture2D_GetDesc(backbuffer_0, &texture_desc); ID3D10Texture2D_GetDesc(backbuffer_0, &texture_desc);
todo_wine ok((texture_desc.BindFlags & (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE)) ok((texture_desc.BindFlags & (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE))
== (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE), == (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE),
"Got unexpected bind flags %x.\n", texture_desc.BindFlags); "Got unexpected bind flags %x.\n", texture_desc.BindFlags);
ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage); ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage);
ID3D10Texture2D_GetDesc(backbuffer_1, &texture_desc); ID3D10Texture2D_GetDesc(backbuffer_1, &texture_desc);
todo_wine ok((texture_desc.BindFlags & (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE)) ok((texture_desc.BindFlags & (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE))
== (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE), == (D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE),
"Got unexpected bind flags %x.\n", texture_desc.BindFlags); "Got unexpected bind flags %x.\n", texture_desc.BindFlags);
ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage); ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage);

View File

@ -67,6 +67,7 @@ void d3d11_primitive_topology_from_wined3d_primitive_type(enum wined3d_primitive
void wined3d_primitive_type_from_d3d11_primitive_topology(D3D11_PRIMITIVE_TOPOLOGY topology, void wined3d_primitive_type_from_d3d11_primitive_topology(D3D11_PRIMITIVE_TOPOLOGY topology,
enum wined3d_primitive_type *type, unsigned int *patch_vertex_count) DECLSPEC_HIDDEN; enum wined3d_primitive_type *type, unsigned int *patch_vertex_count) DECLSPEC_HIDDEN;
unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d3d11_flags) DECLSPEC_HIDDEN; unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d3d11_flags) DECLSPEC_HIDDEN;
UINT d3d11_bind_flags_from_wined3d_usage(DWORD wined3d_usage) DECLSPEC_HIDDEN;
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN; DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN;

View File

@ -5771,11 +5771,8 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
D3D11_TEXTURE2D_DESC desc; D3D11_TEXTURE2D_DESC desc;
HRESULT hr; HRESULT hr;
FIXME("device_parent %p, container_parent %p, wined3d_desc %p, texture flags %#x, " TRACE("device_parent %p, container_parent %p, wined3d_desc %p, texture_flags %#x, wined3d_texture %p.\n",
"wined3d_texture %p partial stub!\n", device_parent, container_parent, device_parent, container_parent, wined3d_desc, texture_flags, wined3d_texture);
wined3d_desc, texture_flags, wined3d_texture);
FIXME("Implement DXGI<->wined3d usage conversion.\n");
desc.Width = wined3d_desc->width; desc.Width = wined3d_desc->width;
desc.Height = wined3d_desc->height; desc.Height = wined3d_desc->height;
@ -5785,7 +5782,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
desc.SampleDesc.Count = wined3d_desc->multisample_type ? wined3d_desc->multisample_type : 1; desc.SampleDesc.Count = wined3d_desc->multisample_type ? wined3d_desc->multisample_type : 1;
desc.SampleDesc.Quality = wined3d_desc->multisample_quality; desc.SampleDesc.Quality = wined3d_desc->multisample_quality;
desc.Usage = D3D11_USAGE_DEFAULT; desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_RENDER_TARGET; desc.BindFlags = d3d11_bind_flags_from_wined3d_usage(wined3d_desc->usage);
desc.CPUAccessFlags = 0; desc.CPUAccessFlags = 0;
desc.MiscFlags = 0; desc.MiscFlags = 0;

View File

@ -11265,13 +11265,13 @@ static void test_swapchain_flip(void)
ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr);
ID3D11Texture2D_GetDesc(backbuffer_0, &texture_desc); ID3D11Texture2D_GetDesc(backbuffer_0, &texture_desc);
todo_wine ok((texture_desc.BindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE)) ok((texture_desc.BindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE))
== (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE), == (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE),
"Got unexpected bind flags %x.\n", texture_desc.BindFlags); "Got unexpected bind flags %x.\n", texture_desc.BindFlags);
ok(texture_desc.Usage == D3D11_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage); ok(texture_desc.Usage == D3D11_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage);
ID3D11Texture2D_GetDesc(backbuffer_1, &texture_desc); ID3D11Texture2D_GetDesc(backbuffer_1, &texture_desc);
todo_wine ok((texture_desc.BindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE)) ok((texture_desc.BindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE))
== (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE), == (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE),
"Got unexpected bind flags %x.\n", texture_desc.BindFlags); "Got unexpected bind flags %x.\n", texture_desc.BindFlags);
ok(texture_desc.Usage == D3D11_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage); ok(texture_desc.Usage == D3D11_USAGE_DEFAULT, "Got unexpected usage %u.\n", texture_desc.Usage);

View File

@ -438,6 +438,21 @@ unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d
return WINED3DGETDATA_FLUSH; return WINED3DGETDATA_FLUSH;
} }
UINT d3d11_bind_flags_from_wined3d_usage(DWORD wined3d_usage)
{
UINT bind_flags = 0;
if (wined3d_usage & WINED3DUSAGE_TEXTURE)
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
if (wined3d_usage & WINED3DUSAGE_RENDERTARGET)
bind_flags |= D3D11_BIND_RENDER_TARGET;
wined3d_usage &= ~(WINED3DUSAGE_TEXTURE | WINED3DUSAGE_RENDERTARGET);
if (wined3d_usage)
FIXME("Unhandled wined3d usage %#x.\n", wined3d_usage);
return bind_flags;
}
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage)
{ {
static const DWORD handled = D3D11_BIND_SHADER_RESOURCE static const DWORD handled = D3D11_BIND_SHADER_RESOURCE