mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Add test for line tessellation.
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
ecdcb5c1b1
commit
0529fa4b01
333
tests/d3d12.c
333
tests/d3d12.c
@ -26729,6 +26729,338 @@ static void test_hull_shader_fork_phase(void)
|
|||||||
destroy_test_context(&context);
|
destroy_test_context(&context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_line_tessellation(void)
|
||||||
|
{
|
||||||
|
ID3D12Resource *vb, *so_buffer, *readback_buffer;
|
||||||
|
D3D12_QUERY_DATA_SO_STATISTICS *so_statistics;
|
||||||
|
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
|
||||||
|
ID3D12GraphicsCommandList *command_list;
|
||||||
|
D3D12_QUERY_HEAP_DESC query_heap_desc;
|
||||||
|
D3D12_STREAM_OUTPUT_BUFFER_VIEW sobv;
|
||||||
|
D3D12_INPUT_LAYOUT_DESC input_layout;
|
||||||
|
struct test_context_desc desc;
|
||||||
|
D3D12_VERTEX_BUFFER_VIEW vbv;
|
||||||
|
struct resource_readback rb;
|
||||||
|
ID3D12QueryHeap *query_heap;
|
||||||
|
struct test_context context;
|
||||||
|
const struct vec4 *expected;
|
||||||
|
ID3D12CommandQueue *queue;
|
||||||
|
struct vec4 *data;
|
||||||
|
bool broken_warp;
|
||||||
|
unsigned int i;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
struct data
|
||||||
|
{
|
||||||
|
float4 position : SV_Position;
|
||||||
|
float3 color : COLOR;
|
||||||
|
float line_density : LINE_DENSITY;
|
||||||
|
float line_detail : LINE_DETAIL;
|
||||||
|
};
|
||||||
|
|
||||||
|
data vs_main(data input)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct patch_constant_data
|
||||||
|
{
|
||||||
|
float tess_factor[2] : SV_TessFactor;
|
||||||
|
float3 color : COLOR;
|
||||||
|
uint prim_id : PRIMITIVE_ID;
|
||||||
|
};
|
||||||
|
|
||||||
|
void patch_constant(OutputPatch<data, 1> control_points,
|
||||||
|
uint prim_id : SV_PrimitiveID,
|
||||||
|
out patch_constant_data output)
|
||||||
|
{
|
||||||
|
output.tess_factor[0] = control_points[0].line_density;
|
||||||
|
output.tess_factor[1] = control_points[0].line_detail;
|
||||||
|
output.color = control_points[0].color;
|
||||||
|
output.prim_id = prim_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
[domain("isoline")]
|
||||||
|
[outputcontrolpoints(1)]
|
||||||
|
[partitioning("integer")]
|
||||||
|
[outputtopology("line")]
|
||||||
|
[patchconstantfunc("patch_constant")]
|
||||||
|
data hs_main(InputPatch<data, 1> input)
|
||||||
|
{
|
||||||
|
return input[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
[domain("isoline")]
|
||||||
|
void ds_main(patch_constant_data input,
|
||||||
|
float tess_factor[2] : SV_TessFactor,
|
||||||
|
float2 tess_coord : SV_DomainLocation,
|
||||||
|
float3 color : COLOR,
|
||||||
|
uint prim_id : PRIMITIVE_ID,
|
||||||
|
const OutputPatch<data, 1> patch,
|
||||||
|
out float4 position : SV_Position,
|
||||||
|
out float4 out_color : COLOR,
|
||||||
|
out float4 out_prim_id : PRIMITIVE_ID)
|
||||||
|
{
|
||||||
|
position = patch[0].position;
|
||||||
|
out_color = float4(color, 1.0);
|
||||||
|
out_prim_id = prim_id;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
static const DWORD vs_code[] =
|
||||||
|
{
|
||||||
|
0x43425844, 0x43d2f821, 0xc4bcdf60, 0xadbf5ed0, 0xe55b715d, 0x00000001, 0x00000230, 0x00000003,
|
||||||
|
0x0000002c, 0x000000c8, 0x00000164, 0x4e475349, 0x00000094, 0x00000004, 0x00000008, 0x00000068,
|
||||||
|
0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000074, 0x00000000, 0x00000000,
|
||||||
|
0x00000003, 0x00000001, 0x00000707, 0x0000007a, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
|
||||||
|
0x00000101, 0x00000087, 0x00000000, 0x00000000, 0x00000003, 0x00000003, 0x00000101, 0x505f5653,
|
||||||
|
0x7469736f, 0x006e6f69, 0x4f4c4f43, 0x494c0052, 0x445f454e, 0x49534e45, 0x4c005954, 0x5f454e49,
|
||||||
|
0x41544544, 0xab004c49, 0x4e47534f, 0x00000094, 0x00000004, 0x00000008, 0x00000068, 0x00000000,
|
||||||
|
0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000074, 0x00000000, 0x00000000, 0x00000003,
|
||||||
|
0x00000001, 0x00000807, 0x0000007a, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000708,
|
||||||
|
0x00000087, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000e01, 0x505f5653, 0x7469736f,
|
||||||
|
0x006e6f69, 0x4f4c4f43, 0x494c0052, 0x445f454e, 0x49534e45, 0x4c005954, 0x5f454e49, 0x41544544,
|
||||||
|
0xab004c49, 0x58454853, 0x000000c4, 0x00010050, 0x00000031, 0x0100086a, 0x0300005f, 0x001010f2,
|
||||||
|
0x00000000, 0x0300005f, 0x00101072, 0x00000001, 0x0300005f, 0x00101012, 0x00000002, 0x0300005f,
|
||||||
|
0x00101012, 0x00000003, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102072,
|
||||||
|
0x00000001, 0x03000065, 0x00102082, 0x00000001, 0x03000065, 0x00102012, 0x00000002, 0x05000036,
|
||||||
|
0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x05000036, 0x00102072, 0x00000001, 0x00101246,
|
||||||
|
0x00000001, 0x05000036, 0x00102082, 0x00000001, 0x0010100a, 0x00000002, 0x05000036, 0x00102012,
|
||||||
|
0x00000002, 0x0010100a, 0x00000003, 0x0100003e,
|
||||||
|
};
|
||||||
|
static const D3D12_SHADER_BYTECODE vs = {vs_code, sizeof(vs_code)};
|
||||||
|
static const DWORD hs_code[] =
|
||||||
|
{
|
||||||
|
0x43425844, 0x130f1b8c, 0x02c24095, 0x18ab42ad, 0xbb861b50, 0x00000001, 0x00000448, 0x00000004,
|
||||||
|
0x00000030, 0x000000cc, 0x00000168, 0x000001fc, 0x4e475349, 0x00000094, 0x00000004, 0x00000008,
|
||||||
|
0x00000068, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x00000f0f, 0x00000074, 0x00000000,
|
||||||
|
0x00000000, 0x00000003, 0x00000001, 0x00000707, 0x0000007a, 0x00000000, 0x00000000, 0x00000003,
|
||||||
|
0x00000001, 0x00000808, 0x00000087, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000101,
|
||||||
|
0x505f5653, 0x7469736f, 0x006e6f69, 0x4f4c4f43, 0x494c0052, 0x445f454e, 0x49534e45, 0x4c005954,
|
||||||
|
0x5f454e49, 0x41544544, 0xab004c49, 0x4e47534f, 0x00000094, 0x00000004, 0x00000008, 0x00000068,
|
||||||
|
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000074, 0x00000000, 0x00000000,
|
||||||
|
0x00000003, 0x00000001, 0x00000807, 0x0000007a, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
|
||||||
|
0x00000708, 0x00000087, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000e01, 0x505f5653,
|
||||||
|
0x7469736f, 0x006e6f69, 0x4f4c4f43, 0x494c0052, 0x445f454e, 0x49534e45, 0x4c005954, 0x5f454e49,
|
||||||
|
0x41544544, 0xab004c49, 0x47534350, 0x0000008c, 0x00000004, 0x00000008, 0x00000068, 0x00000000,
|
||||||
|
0x00000010, 0x00000003, 0x00000000, 0x00000e01, 0x00000076, 0x00000000, 0x00000000, 0x00000003,
|
||||||
|
0x00000000, 0x0000010e, 0x00000068, 0x00000001, 0x0000000f, 0x00000003, 0x00000001, 0x00000e01,
|
||||||
|
0x0000007c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000d02, 0x545f5653, 0x46737365,
|
||||||
|
0x6f746361, 0x4f430072, 0x00524f4c, 0x4d495250, 0x56495449, 0x44495f45, 0xababab00, 0x58454853,
|
||||||
|
0x00000244, 0x00030050, 0x00000091, 0x01000071, 0x01000893, 0x01000894, 0x01000895, 0x01000896,
|
||||||
|
0x01001097, 0x0100086a, 0x01000072, 0x0400005f, 0x002010f2, 0x00000001, 0x00000000, 0x0400005f,
|
||||||
|
0x00201072, 0x00000001, 0x00000001, 0x0400005f, 0x00201082, 0x00000001, 0x00000001, 0x0400005f,
|
||||||
|
0x00201012, 0x00000001, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x03000065, 0x00102072,
|
||||||
|
0x00000001, 0x03000065, 0x00102082, 0x00000001, 0x03000065, 0x00102012, 0x00000002, 0x06000036,
|
||||||
|
0x001020f2, 0x00000000, 0x00201e46, 0x00000000, 0x00000000, 0x06000036, 0x001020f2, 0x00000001,
|
||||||
|
0x00201e46, 0x00000000, 0x00000001, 0x06000036, 0x00102012, 0x00000002, 0x0020100a, 0x00000000,
|
||||||
|
0x00000002, 0x0100003e, 0x01000073, 0x0400005f, 0x0021a082, 0x00000001, 0x00000001, 0x04000067,
|
||||||
|
0x00102012, 0x00000000, 0x00000016, 0x06000036, 0x00102012, 0x00000000, 0x0021a03a, 0x00000000,
|
||||||
|
0x00000001, 0x0100003e, 0x01000073, 0x0400005f, 0x0021a012, 0x00000001, 0x00000002, 0x04000067,
|
||||||
|
0x00102012, 0x00000001, 0x00000015, 0x06000036, 0x00102012, 0x00000001, 0x0021a00a, 0x00000000,
|
||||||
|
0x00000002, 0x0100003e, 0x01000073, 0x0400005f, 0x0021a012, 0x00000001, 0x00000001, 0x03000065,
|
||||||
|
0x00102022, 0x00000000, 0x06000036, 0x00102022, 0x00000000, 0x0021a00a, 0x00000000, 0x00000001,
|
||||||
|
0x0100003e, 0x01000073, 0x0400005f, 0x0021a022, 0x00000001, 0x00000001, 0x03000065, 0x00102042,
|
||||||
|
0x00000000, 0x06000036, 0x00102042, 0x00000000, 0x0021a01a, 0x00000000, 0x00000001, 0x0100003e,
|
||||||
|
0x01000073, 0x0400005f, 0x0021a042, 0x00000001, 0x00000001, 0x03000065, 0x00102082, 0x00000000,
|
||||||
|
0x06000036, 0x00102082, 0x00000000, 0x0021a02a, 0x00000000, 0x00000001, 0x0100003e, 0x01000073,
|
||||||
|
0x0200005f, 0x0000b000, 0x03000065, 0x00102022, 0x00000001, 0x04000036, 0x00102022, 0x00000001,
|
||||||
|
0x0000b001, 0x0100003e,
|
||||||
|
};
|
||||||
|
static const D3D12_SHADER_BYTECODE hs = {hs_code, sizeof(hs_code)};
|
||||||
|
static const DWORD ds_code[] =
|
||||||
|
{
|
||||||
|
0x43425844, 0xc78d05dd, 0x4b270467, 0xb480a2fb, 0x02f0edc7, 0x00000001, 0x0000029c, 0x00000004,
|
||||||
|
0x00000030, 0x000000cc, 0x00000160, 0x000001d8, 0x4e475349, 0x00000094, 0x00000004, 0x00000008,
|
||||||
|
0x00000068, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x00000f0f, 0x00000074, 0x00000000,
|
||||||
|
0x00000000, 0x00000003, 0x00000001, 0x00000007, 0x0000007a, 0x00000000, 0x00000000, 0x00000003,
|
||||||
|
0x00000001, 0x00000008, 0x00000087, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000001,
|
||||||
|
0x505f5653, 0x7469736f, 0x006e6f69, 0x4f4c4f43, 0x494c0052, 0x445f454e, 0x49534e45, 0x4c005954,
|
||||||
|
0x5f454e49, 0x41544544, 0xab004c49, 0x47534350, 0x0000008c, 0x00000004, 0x00000008, 0x00000068,
|
||||||
|
0x00000000, 0x00000010, 0x00000003, 0x00000000, 0x00000001, 0x00000076, 0x00000000, 0x00000000,
|
||||||
|
0x00000003, 0x00000000, 0x00000e0e, 0x00000068, 0x00000001, 0x0000000f, 0x00000003, 0x00000001,
|
||||||
|
0x00000001, 0x0000007c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000202, 0x545f5653,
|
||||||
|
0x46737365, 0x6f746361, 0x4f430072, 0x00524f4c, 0x4d495250, 0x56495449, 0x44495f45, 0xababab00,
|
||||||
|
0x4e47534f, 0x00000070, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
|
||||||
|
0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f,
|
||||||
|
0x00000062, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x7469736f,
|
||||||
|
0x006e6f69, 0x4f4c4f43, 0x52500052, 0x54494d49, 0x5f455649, 0xab004449, 0x58454853, 0x000000bc,
|
||||||
|
0x00040050, 0x0000002f, 0x01000893, 0x01000895, 0x0100086a, 0x0300005f, 0x0011b0e2, 0x00000000,
|
||||||
|
0x0300005f, 0x0011b022, 0x00000001, 0x0400005f, 0x002190f2, 0x00000001, 0x00000000, 0x04000067,
|
||||||
|
0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x03000065, 0x001020f2,
|
||||||
|
0x00000002, 0x06000036, 0x001020f2, 0x00000000, 0x00219e46, 0x00000000, 0x00000000, 0x05000036,
|
||||||
|
0x00102072, 0x00000001, 0x0011b796, 0x00000000, 0x05000036, 0x00102082, 0x00000001, 0x00004001,
|
||||||
|
0x3f800000, 0x05000056, 0x001020f2, 0x00000002, 0x0011b556, 0x00000001, 0x0100003e,
|
||||||
|
};
|
||||||
|
static const D3D12_SHADER_BYTECODE ds = {ds_code, sizeof(ds_code)};
|
||||||
|
static const D3D12_INPUT_ELEMENT_DESC layout_desc[] =
|
||||||
|
{
|
||||||
|
{"SV_POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
|
||||||
|
{"COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 16, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
|
||||||
|
{"LINE_DENSITY", 0, DXGI_FORMAT_R32_FLOAT, 0, 32, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
|
||||||
|
{"LINE_DETAIL", 0, DXGI_FORMAT_R32_FLOAT, 0, 36, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
|
||||||
|
};
|
||||||
|
static const D3D12_SO_DECLARATION_ENTRY so_declaration[] =
|
||||||
|
{
|
||||||
|
{0, "SV_POSITION", 0, 0, 4, 0},
|
||||||
|
{0, "COLOR", 0, 0, 4, 0},
|
||||||
|
{0, "PRIMITIVE_ID", 0, 0, 4, 0},
|
||||||
|
};
|
||||||
|
unsigned int strides[] = {48};
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
struct vec4 position;
|
||||||
|
struct vec4 color;
|
||||||
|
float line_density;
|
||||||
|
float line_detail;
|
||||||
|
}
|
||||||
|
vertices[] =
|
||||||
|
{
|
||||||
|
{{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f}, 1.0f, 1.0f},
|
||||||
|
{{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.5f, 0.0f}, 2.0f, 1.0f},
|
||||||
|
{{2.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f}, 1.0f, 2.0f},
|
||||||
|
{{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f}, 2.0f, 2.0f},
|
||||||
|
};
|
||||||
|
static const struct vec4 expected_data[] =
|
||||||
|
{
|
||||||
|
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
|
||||||
|
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
|
||||||
|
|
||||||
|
{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.5f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
|
||||||
|
{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.5f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
|
||||||
|
{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.5f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
|
||||||
|
{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.5f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
|
||||||
|
|
||||||
|
{2.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {2.0f, 2.0f, 2.0f, 2.0f},
|
||||||
|
{2.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {2.0f, 2.0f, 2.0f, 2.0f},
|
||||||
|
{2.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {2.0f, 2.0f, 2.0f, 2.0f},
|
||||||
|
{2.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {2.0f, 2.0f, 2.0f, 2.0f},
|
||||||
|
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
{3.0f, 0.0f, 0.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f}, {3.0f, 3.0f, 3.0f, 3.0f},
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&desc, 0, sizeof(desc));
|
||||||
|
desc.root_signature_flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT
|
||||||
|
| D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT;
|
||||||
|
desc.no_pipeline = true;
|
||||||
|
if (!init_test_context(&context, &desc))
|
||||||
|
return;
|
||||||
|
command_list = context.list;
|
||||||
|
queue = context.queue;
|
||||||
|
|
||||||
|
query_heap_desc.Type = D3D12_QUERY_HEAP_TYPE_SO_STATISTICS;
|
||||||
|
query_heap_desc.Count = 2;
|
||||||
|
query_heap_desc.NodeMask = 0;
|
||||||
|
hr = ID3D12Device_CreateQueryHeap(context.device, &query_heap_desc, &IID_ID3D12QueryHeap, (void **)&query_heap);
|
||||||
|
if (hr == E_NOTIMPL)
|
||||||
|
{
|
||||||
|
skip("Stream output is not supported.\n");
|
||||||
|
destroy_test_context(&context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ok(hr == S_OK, "Failed to create query heap, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
input_layout.pInputElementDescs = layout_desc;
|
||||||
|
input_layout.NumElements = ARRAY_SIZE(layout_desc);
|
||||||
|
init_pipeline_state_desc(&pso_desc, context.root_signature,
|
||||||
|
DXGI_FORMAT_UNKNOWN, NULL, NULL, &input_layout);
|
||||||
|
pso_desc.VS = vs;
|
||||||
|
pso_desc.HS = hs;
|
||||||
|
pso_desc.DS = ds;
|
||||||
|
memset(&pso_desc.PS, 0, sizeof(pso_desc.PS));
|
||||||
|
pso_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH;
|
||||||
|
pso_desc.StreamOutput.NumEntries = ARRAY_SIZE(so_declaration);
|
||||||
|
pso_desc.StreamOutput.pSODeclaration = so_declaration;
|
||||||
|
pso_desc.StreamOutput.pBufferStrides = strides;
|
||||||
|
pso_desc.StreamOutput.NumStrides = ARRAY_SIZE(strides);
|
||||||
|
pso_desc.StreamOutput.RasterizedStream = D3D12_SO_NO_RASTERIZED_STREAM;
|
||||||
|
hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc,
|
||||||
|
&IID_ID3D12PipelineState, (void **)&context.pipeline_state);
|
||||||
|
ok(hr == S_OK, "Failed to create state, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
vb = create_upload_buffer(context.device, sizeof(vertices), vertices);
|
||||||
|
vbv.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(vb);
|
||||||
|
vbv.StrideInBytes = sizeof(*vertices);
|
||||||
|
vbv.SizeInBytes = sizeof(vertices);
|
||||||
|
|
||||||
|
so_buffer = create_default_buffer(context.device, 4096,
|
||||||
|
D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_STREAM_OUT);
|
||||||
|
sobv.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(so_buffer);
|
||||||
|
sobv.SizeInBytes = 1024;
|
||||||
|
sobv.BufferFilledSizeLocation = sobv.BufferLocation + sobv.SizeInBytes;
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_BeginQuery(command_list, query_heap, D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0, 0);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_SOSetTargets(command_list, 0, 1, &sobv);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
|
||||||
|
ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state);
|
||||||
|
ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST);
|
||||||
|
ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
|
||||||
|
ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect);
|
||||||
|
ID3D12GraphicsCommandList_IASetVertexBuffers(command_list, 0, 1, &vbv);
|
||||||
|
ID3D12GraphicsCommandList_DrawInstanced(command_list, 4, 1, 0, 0);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_EndQuery(command_list, query_heap, D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0, 0);
|
||||||
|
|
||||||
|
readback_buffer = create_readback_buffer(context.device, sizeof(*so_statistics));
|
||||||
|
ID3D12GraphicsCommandList_ResolveQueryData(command_list,
|
||||||
|
query_heap, D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0, 0, 1, readback_buffer, 0);
|
||||||
|
|
||||||
|
get_buffer_readback_with_command_list(readback_buffer, DXGI_FORMAT_UNKNOWN, &rb, queue, command_list);
|
||||||
|
so_statistics = get_readback_data(&rb, 0, 0, 0, sizeof(*so_statistics));
|
||||||
|
broken_warp = broken_on_warp(so_statistics[0].NumPrimitivesWritten != 9);
|
||||||
|
ok(so_statistics[0].NumPrimitivesWritten == 9 || broken_warp, "Got unexpected primitives written %u.\n",
|
||||||
|
(unsigned int)so_statistics[0].NumPrimitivesWritten);
|
||||||
|
ok(so_statistics[0].PrimitivesStorageNeeded == 9 || broken_warp, "Got unexpected primitives storage needed %u.\n",
|
||||||
|
(unsigned int)so_statistics[0].PrimitivesStorageNeeded);
|
||||||
|
release_resource_readback(&rb);
|
||||||
|
|
||||||
|
if (broken_warp)
|
||||||
|
{
|
||||||
|
skip("Broken on WARP.\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_command_list(command_list, context.allocator);
|
||||||
|
transition_resource_state(command_list, so_buffer,
|
||||||
|
D3D12_RESOURCE_STATE_STREAM_OUT, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||||
|
get_buffer_readback_with_command_list(so_buffer, DXGI_FORMAT_UNKNOWN, &rb, queue, command_list);
|
||||||
|
for (i = 0; i < ARRAY_SIZE(expected_data) / 3 ; ++i)
|
||||||
|
{
|
||||||
|
data = get_readback_data(&rb, i, 0, 0, 3 * sizeof(*data));
|
||||||
|
expected = &expected_data[3 * i + 0];
|
||||||
|
ok(compare_vec4(data, expected, 1),
|
||||||
|
"Got position {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e} at %u.\n",
|
||||||
|
data->x, data->y, data->z, data->w, expected->x, expected->y, expected->z, expected->w, i);
|
||||||
|
++data;
|
||||||
|
expected = &expected_data[3 * i + 1];
|
||||||
|
ok(compare_vec4(data, expected, 1),
|
||||||
|
"Got color {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e} at %u.\n",
|
||||||
|
data->x, data->y, data->z, data->w, expected->x, expected->y, expected->z, expected->w, i);
|
||||||
|
++data;
|
||||||
|
expected = &expected_data[3 * i + 2];
|
||||||
|
ok(compare_vec4(data, expected, 1),
|
||||||
|
"Got primitive ID {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e} at %u.\n",
|
||||||
|
data->x, data->y, data->z, data->w, expected->x, expected->y, expected->z, expected->w, i);
|
||||||
|
}
|
||||||
|
release_resource_readback(&rb);
|
||||||
|
|
||||||
|
done:
|
||||||
|
ID3D12QueryHeap_Release(query_heap);
|
||||||
|
ID3D12Resource_Release(readback_buffer);
|
||||||
|
ID3D12Resource_Release(so_buffer);
|
||||||
|
ID3D12Resource_Release(vb);
|
||||||
|
destroy_test_context(&context);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_render_a8(void)
|
static void test_render_a8(void)
|
||||||
{
|
{
|
||||||
static const float black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
static const float black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
@ -30274,6 +30606,7 @@ START_TEST(d3d12)
|
|||||||
run_test(test_tessellation_dcl_index_range);
|
run_test(test_tessellation_dcl_index_range);
|
||||||
run_test(test_hull_shader_control_point_phase);
|
run_test(test_hull_shader_control_point_phase);
|
||||||
run_test(test_hull_shader_fork_phase);
|
run_test(test_hull_shader_fork_phase);
|
||||||
|
run_test(test_line_tessellation);
|
||||||
run_test(test_render_a8);
|
run_test(test_render_a8);
|
||||||
run_test(test_cpu_descriptors_lifetime);
|
run_test(test_cpu_descriptors_lifetime);
|
||||||
run_test(test_clip_distance);
|
run_test(test_clip_distance);
|
||||||
|
Loading…
Reference in New Issue
Block a user