tests: Compile HLSL shaders at runtime in test_draw_depth_only().

This commit is contained in:
Giovanni Mascellani 2023-09-14 11:35:12 +02:00 committed by Alexandre Julliard
parent 4557ad36b0
commit d742770499
Notes: Alexandre Julliard 2023-09-22 22:47:27 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/344

View File

@ -6702,27 +6702,18 @@ static void test_draw_depth_only(void)
struct test_context_desc desc; struct test_context_desc desc;
struct test_context context; struct test_context context;
ID3D12CommandQueue *queue; ID3D12CommandQueue *queue;
D3D12_SHADER_BYTECODE ps;
ID3D10Blob *ps_bytecode;
unsigned int i, j; unsigned int i, j;
HRESULT hr; HRESULT hr;
static const DWORD ps_code[] = static const char ps_code[] =
{ "float depth;\n"
#if 0 "\n"
float depth; "float main() : SV_Depth\n"
"{\n"
float main() : SV_Depth " return depth;\n"
{ "}\n";
return depth;
}
#endif
0x43425844, 0x91af6cd0, 0x7e884502, 0xcede4f54, 0x6f2c9326, 0x00000001, 0x000000b0, 0x00000003,
0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
0x00000e01, 0x445f5653, 0x68747065, 0xababab00, 0x52444853, 0x00000038, 0x00000040, 0x0000000e,
0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x02000065, 0x0000c001, 0x05000036, 0x0000c001,
0x0020800a, 0x00000000, 0x00000000, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)};
static const struct static const struct
{ {
float clear_depth; float clear_depth;
@ -6742,10 +6733,16 @@ static void test_draw_depth_only(void)
{1.0f, 0.5f, 0.5f}, {1.0f, 0.5f, 0.5f},
}; };
ps_bytecode = compile_shader(ps_code, sizeof(ps_code) - 1, "ps_4_0");
ps = shader_bytecode_from_blob(ps_bytecode);
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.no_render_target = true; desc.no_render_target = true;
if (!init_test_context(&context, &desc)) if (!init_test_context(&context, &desc))
{
ID3D10Blob_Release(ps_bytecode);
return; return;
}
command_list = context.list; command_list = context.list;
queue = context.queue; queue = context.queue;
@ -6833,6 +6830,8 @@ static void test_draw_depth_only(void)
destroy_depth_stencil(&ds); destroy_depth_stencil(&ds);
destroy_test_context(&context); destroy_test_context(&context);
ID3D10Blob_Release(ps_bytecode);
} }
static void test_draw_uav_only(void) static void test_draw_uav_only(void)