From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12.c | 75 +++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 45 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 0748ab6d..2ccf0ac7 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -6395,9 +6395,11 @@ static void test_fractional_viewports(void) { static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; ID3D12GraphicsCommandList *command_list; + ID3D10Blob *vs_bytecode, *ps_bytecode; D3D12_INPUT_LAYOUT_DESC input_layout; struct d3d12_resource_readback rb; struct test_context_desc desc; + D3D12_SHADER_BYTECODE vs, ps; D3D12_VERTEX_BUFFER_VIEW vbv; struct test_context context; ID3D12CommandQueue *queue; @@ -6405,51 +6407,21 @@ static void test_fractional_viewports(void) unsigned int i, x, y; ID3D12Resource *vb;
- static const DWORD vs_code[] = - { -#if 0 - void main(in float4 in_position : POSITION, - in float2 in_texcoord : TEXCOORD, - out float4 position : SV_Position, - out float2 texcoord : TEXCOORD) - { - position = in_position; - texcoord = in_texcoord; - } -#endif - 0x43425844, 0x4df282ca, 0x85c8bbfc, 0xd44ad19f, 0x1158be97, 0x00000001, 0x00000148, 0x00000003, - 0x0000002c, 0x00000080, 0x000000d8, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000303, 0x49534f50, 0x4e4f4954, 0x58455400, 0x524f4f43, 0xabab0044, - 0x4e47534f, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000c03, - 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x52444853, 0x00000068, - 0x00010040, 0x0000001a, 0x0300005f, 0x001010f2, 0x00000000, 0x0300005f, 0x00101032, 0x00000001, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, 0x00000001, 0x05000036, - 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x0100003e, - }; - static const D3D12_SHADER_BYTECODE vs = {vs_code, sizeof(vs_code)}; - static const DWORD ps_code[] = - { -#if 0 - float4 main(float4 position : SV_Position, - float2 texcoord : TEXCOORD) : SV_Target - { - return float4(position.xy, texcoord); - } -#endif - 0x43425844, 0xa15616bc, 0x6862ab1c, 0x28b915c0, 0xdb0df67c, 0x00000001, 0x0000011c, 0x00000003, - 0x0000002c, 0x00000084, 0x000000b8, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000303, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000005c, - 0x00000040, 0x00000017, 0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x05000036, 0x00102032, 0x00000000, 0x00101046, - 0x00000000, 0x05000036, 0x001020c2, 0x00000000, 0x00101406, 0x00000001, 0x0100003e, - }; - static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)}; + static const char vs_code[] = + "void main(in float4 in_position : POSITION,\n" + " in float2 in_texcoord : TEXCOORD,\n" + " out float4 position : SV_Position,\n" + " out float2 texcoord : TEXCOORD)\n" + "{\n" + " position = in_position;\n" + " texcoord = in_texcoord;\n" + "}\n"; + static const char ps_code[] = + "float4 main(float4 position : SV_Position,\n" + " float2 texcoord : TEXCOORD) : SV_Target\n" + "{\n" + " return float4(position.xy, texcoord);\n" + "}\n"; static const D3D12_INPUT_ELEMENT_DESC layout_desc[] = { {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0}, @@ -6473,11 +6445,21 @@ static void test_fractional_viewports(void) 1.0f / 64.0f, 1.0f / 128.0f, 1.0f / 256.0f, 63.0f / 128.0f, };
+ vs_bytecode = compile_shader(vs_code, sizeof(vs_code) - 1, "vs_4_0"); + vs = shader_bytecode_from_blob(vs_bytecode); + + 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)); desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT; desc.no_root_signature = true; if (!init_test_context(&context, &desc)) + { + ID3D10Blob_Release(vs_bytecode); + ID3D10Blob_Release(ps_bytecode); return; + } command_list = context.list; queue = context.queue;
@@ -6542,6 +6524,9 @@ static void test_fractional_viewports(void)
ID3D12Resource_Release(vb); destroy_test_context(&context); + + ID3D10Blob_Release(vs_bytecode); + ID3D10Blob_Release(ps_bytecode); }
static void test_scissor(void)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 2ccf0ac7..6fbd6e97 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -6536,34 +6536,30 @@ static void test_scissor(void) struct test_context_desc desc; struct test_context context; ID3D12CommandQueue *queue; + D3D12_SHADER_BYTECODE ps; + ID3D10Blob *ps_bytecode; unsigned int color; RECT scissor_rect;
- static const DWORD ps_code[] = - { -#if 0 - float4 main(float4 position : SV_POSITION) : SV_Target - { - return float4(0.0, 1.0, 0.0, 1.0); - } -#endif - 0x43425844, 0x30240e72, 0x012f250c, 0x8673c6ea, 0x392e4cec, 0x00000001, 0x000000d4, 0x00000003, - 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03000065, 0x001020f2, 0x00000000, 0x08000036, 0x001020f2, 0x00000000, 0x00004002, - 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x0100003e, - }; - static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)}; + static const char ps_code[] = + "float4 main(float4 position : SV_POSITION) : SV_Target\n" + "{\n" + " return float4(0.0, 1.0, 0.0, 1.0);\n" + "}\n"; static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f};
+ 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)); desc.rt_width = 640; desc.rt_height = 480; desc.ps = &ps; if (!init_test_context(&context, &desc)) + { + ID3D10Blob_Release(ps_bytecode); return; + } command_list = context.list; queue = context.queue;
@@ -6596,6 +6592,8 @@ static void test_scissor(void) release_resource_readback(&rb);
destroy_test_context(&context); + + ID3D10Blob_Release(ps_bytecode); }
static void test_draw_depth_no_ps(void)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 6fbd6e97..5f280664 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -6606,6 +6606,8 @@ static void test_draw_depth_no_ps(void) D3D12_VERTEX_BUFFER_VIEW vbv; struct test_context context; ID3D12CommandQueue *queue; + D3D12_SHADER_BYTECODE vs; + ID3D10Blob *vs_bytecode; ID3D12Resource *vb; HRESULT hr;
@@ -6624,28 +6626,22 @@ static void test_draw_depth_no_ps(void) {{ 1.0f, -1.0f, 0.5f, 1.0f}}, {{ 1.0f, 1.0f, 0.5f, 1.0f}}, }; - static const DWORD vs_code[] = - { -#if 0 - void main(float4 in_position : POSITION, out float4 out_position : SV_POSITION) - { - out_position = in_position; - } -#endif - 0x43425844, 0xa7a2f22d, 0x83ff2560, 0xe61638bd, 0x87e3ce90, 0x00000001, 0x000000d8, 0x00000003, - 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0xababab00, - 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x0000003c, 0x00010040, - 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, - 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, - }; - static const D3D12_SHADER_BYTECODE vs = {vs_code, sizeof(vs_code)}; + static const char vs_code[] = + "void main(float4 in_position : POSITION, out float4 out_position : SV_POSITION)\n" + "{\n" + " out_position = in_position;\n" + "}\n"; + + vs_bytecode = compile_shader(vs_code, sizeof(vs_code) - 1, "vs_4_0"); + vs = shader_bytecode_from_blob(vs_bytecode);
memset(&desc, 0, sizeof(desc)); desc.no_render_target = true; if (!init_test_context(&context, &desc)) + { + ID3D10Blob_Release(vs_bytecode); return; + } command_list = context.list; queue = context.queue;
@@ -6693,6 +6689,8 @@ static void test_draw_depth_no_ps(void) destroy_depth_stencil(&ds); ID3D12Resource_Release(vb); destroy_test_context(&context); + + ID3D10Blob_Release(vs_bytecode); }
static void test_draw_depth_only(void)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 5f280664..ac0468b9 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -6702,27 +6702,18 @@ static void test_draw_depth_only(void) struct test_context_desc desc; struct test_context context; ID3D12CommandQueue *queue; + D3D12_SHADER_BYTECODE ps; + ID3D10Blob *ps_bytecode; unsigned int i, j; HRESULT hr;
- static const DWORD ps_code[] = - { -#if 0 - float depth; - - float main() : SV_Depth - { - 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 char ps_code[] = + "float depth;\n" + "\n" + "float main() : SV_Depth\n" + "{\n" + " return depth;\n" + "}\n"; static const struct { float clear_depth; @@ -6742,10 +6733,16 @@ static void test_draw_depth_only(void) {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)); desc.no_render_target = true; if (!init_test_context(&context, &desc)) + { + ID3D10Blob_Release(ps_bytecode); return; + } command_list = context.list; queue = context.queue;
@@ -6833,6 +6830,8 @@ static void test_draw_depth_only(void)
destroy_depth_stencil(&ds); destroy_test_context(&context); + + ID3D10Blob_Release(ps_bytecode); }
static void test_draw_uav_only(void)
This merge request was approved by Henri Verbeet.