d3d10core/tests: Add test for unbinding shader resource view.

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>
oldstable
Józef Kucia 2017-03-10 09:10:59 +01:00 committed by Alexandre Julliard
parent 8e2697e2a0
commit 241e99dc24
1 changed files with 88 additions and 0 deletions

View File

@ -10558,6 +10558,93 @@ static void test_shader_input_registers_limits(void)
release_test_context(&test_context);
}
static void test_unbind_shader_resource_view(void)
{
struct d3d10core_test_context test_context;
D3D10_SUBRESOURCE_DATA resource_data;
ID3D10ShaderResourceView *srv, *srv2;
D3D10_TEXTURE2D_DESC texture_desc;
ID3D10Texture2D *texture;
ID3D10PixelShader *ps;
ID3D10Device *device;
HRESULT hr;
static const DWORD ps_code[] =
{
#if 0
Texture2D t0;
Texture2D t1;
SamplerState s;
float4 main() : SV_Target
{
return min(t0.Sample(s, float2(0, 0)) + t1.Sample(s, float2(0, 0)), 1.0f);
}
#endif
0x43425844, 0x698dc0cb, 0x0bf322b8, 0xee127418, 0xfe9214ce, 0x00000001, 0x00000168, 0x00000003,
0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000000f0, 0x00000040, 0x0000003c,
0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
0x00107000, 0x00000001, 0x00005555, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002,
0x0c000045, 0x001000f2, 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0c000045, 0x001000f2, 0x00000001, 0x00004002,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000000,
0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0a000033,
0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000,
0x3f800000, 0x0100003e,
};
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
static const DWORD texture_data[] = {0xff00ff00};
if (!init_test_context(&test_context))
return;
device = test_context.device;
texture_desc.Width = 1;
texture_desc.Height = 1;
texture_desc.MipLevels = 0;
texture_desc.ArraySize = 1;
texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
texture_desc.SampleDesc.Count = 1;
texture_desc.SampleDesc.Quality = 0;
texture_desc.Usage = D3D10_USAGE_DEFAULT;
texture_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE;
texture_desc.CPUAccessFlags = 0;
texture_desc.MiscFlags = 0;
resource_data.pSysMem = texture_data;
resource_data.SysMemPitch = sizeof(texture_data);
resource_data.SysMemSlicePitch = 0;
hr = ID3D10Device_CreateTexture2D(device, &texture_desc, &resource_data, &texture);
ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x.\n", hr);
hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)texture, NULL, &srv);
ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr);
hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps);
ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
ID3D10Device_PSSetShader(device, ps);
ID3D10Device_PSSetShaderResources(device, 0, 1, &srv);
ID3D10Device_PSSetShaderResources(device, 1, 1, &srv);
ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white);
draw_quad(&test_context);
check_texture_color(test_context.backbuffer, 0xff00ff00, 1);
srv2 = NULL;
ID3D10Device_PSSetShaderResources(device, 0, 1, &srv2);
ID3D10Device_PSSetShaderResources(device, 1, 1, &srv2);
ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white);
draw_quad(&test_context);
todo_wine check_texture_color(test_context.backbuffer, 0x00000000, 1);
ID3D10PixelShader_Release(ps);
ID3D10ShaderResourceView_Release(srv);
ID3D10Texture2D_Release(texture);
release_test_context(&test_context);
}
static void test_stencil_separate(void)
{
struct d3d10core_test_context test_context;
@ -11527,6 +11614,7 @@ START_TEST(device)
test_required_format_support();
test_ddy();
test_shader_input_registers_limits();
test_unbind_shader_resource_view();
test_stencil_separate();
test_sm4_ret_instruction();
test_primitive_restart();