d3d10core/tests: Add test for NULL sampler.
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:
parent
4c26025321
commit
442fb186e1
|
@ -7268,6 +7268,87 @@ static void test_input_assembler(void)
|
||||||
release_test_context(&test_context);
|
release_test_context(&test_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_null_sampler(void)
|
||||||
|
{
|
||||||
|
struct d3d10core_test_context test_context;
|
||||||
|
D3D10_TEXTURE2D_DESC texture_desc;
|
||||||
|
ID3D10ShaderResourceView *srv;
|
||||||
|
ID3D10RenderTargetView *rtv;
|
||||||
|
ID3D10SamplerState *sampler;
|
||||||
|
ID3D10Texture2D *texture;
|
||||||
|
ID3D10PixelShader *ps;
|
||||||
|
ID3D10Device *device;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
static const DWORD ps_code[] =
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
Texture2D t;
|
||||||
|
SamplerState s;
|
||||||
|
|
||||||
|
float4 main(float4 position : SV_POSITION) : SV_Target
|
||||||
|
{
|
||||||
|
return t.Sample(s, float2(position.x / 640.0f, position.y / 480.0f));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
0x43425844, 0x1ce9b612, 0xc8176faa, 0xd37844af, 0xdb515605, 0x00000001, 0x00000134, 0x00000003,
|
||||||
|
0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
|
||||||
|
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x5449534f, 0x004e4f49,
|
||||||
|
0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
|
||||||
|
0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000098, 0x00000040,
|
||||||
|
0x00000026, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
|
||||||
|
0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
|
||||||
|
0x00000001, 0x0a000038, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x00004002, 0x3acccccd,
|
||||||
|
0x3b088889, 0x00000000, 0x00000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100046, 0x00000000,
|
||||||
|
0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0100003e,
|
||||||
|
};
|
||||||
|
static const float blue[] = {0.0f, 0.0f, 1.0f, 1.0f};
|
||||||
|
|
||||||
|
if (!init_test_context(&test_context))
|
||||||
|
return;
|
||||||
|
|
||||||
|
device = test_context.device;
|
||||||
|
|
||||||
|
hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
texture_desc.Width = 64;
|
||||||
|
texture_desc.Height = 64;
|
||||||
|
texture_desc.MipLevels = 1;
|
||||||
|
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_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||||
|
texture_desc.CPUAccessFlags = 0;
|
||||||
|
texture_desc.MiscFlags = 0;
|
||||||
|
|
||||||
|
hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)texture, NULL, &rtv);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to create render target view, 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);
|
||||||
|
|
||||||
|
ID3D10Device_ClearRenderTargetView(device, rtv, blue);
|
||||||
|
|
||||||
|
ID3D10Device_PSSetShader(device, ps);
|
||||||
|
ID3D10Device_PSSetShaderResources(device, 0, 1, &srv);
|
||||||
|
sampler = NULL;
|
||||||
|
ID3D10Device_PSSetSamplers(device, 0, 1, &sampler);
|
||||||
|
draw_quad(&test_context);
|
||||||
|
check_texture_color(test_context.backbuffer, 0xffff0000, 0);
|
||||||
|
|
||||||
|
ID3D10ShaderResourceView_Release(srv);
|
||||||
|
ID3D10RenderTargetView_Release(rtv);
|
||||||
|
ID3D10Texture2D_Release(texture);
|
||||||
|
ID3D10PixelShader_Release(ps);
|
||||||
|
release_test_context(&test_context);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(device)
|
START_TEST(device)
|
||||||
{
|
{
|
||||||
test_feature_level();
|
test_feature_level();
|
||||||
|
@ -7309,4 +7390,5 @@ START_TEST(device)
|
||||||
test_sm4_if_instruction();
|
test_sm4_if_instruction();
|
||||||
test_sm4_breakc_instruction();
|
test_sm4_breakc_instruction();
|
||||||
test_input_assembler();
|
test_input_assembler();
|
||||||
|
test_null_sampler();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue