Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
2966f019
Commit
2966f019
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
tests: Add test for D3D12_APPEND_ALIGNED_ELEMENT.
parent
2425e293
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/d3d12.c
+199
-0
199 additions, 0 deletions
tests/d3d12.c
with
199 additions
and
0 deletions
tests/d3d12.c
+
199
−
0
View file @
2966f019
...
...
@@ -3643,6 +3643,204 @@ static void test_draw_indexed_instanced(void)
destroy_test_context(&context);
}
static void test_append_aligned_element(void)
{
ID3D12GraphicsCommandList *command_list;
D3D12_INPUT_LAYOUT_DESC input_layout;
D3D12_VERTEX_BUFFER_VIEW vbv[3];
struct test_context_desc desc;
struct test_context context;
struct resource_readback rb;
ID3D12CommandQueue *queue;
ID3D12Resource *vb[3];
unsigned int color;
/* Semantic names are case-insensitive. */
static const D3D12_INPUT_ELEMENT_DESC layout_desc[] =
{
{"CoLoR", 2, DXGI_FORMAT_R32G32_FLOAT, 1, D3D12_APPEND_ALIGNED_ELEMENT,
D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1},
{"ColoR", 3, DXGI_FORMAT_R32G32_FLOAT, 2, D3D12_APPEND_ALIGNED_ELEMENT,
D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1},
{"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT,
D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
{"ColoR", 0, DXGI_FORMAT_R32G32_FLOAT, 2, D3D12_APPEND_ALIGNED_ELEMENT,
D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1},
{"cOLOr", 1, DXGI_FORMAT_R32G32_FLOAT, 1, D3D12_APPEND_ALIGNED_ELEMENT,
D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1},
};
static const DWORD vs_code[] =
{
#if 0
struct vs_in
{
float4 position : POSITION;
float2 color_xy : COLOR0;
float2 color_zw : COLOR1;
unsigned int instance_id : SV_INSTANCEID;
};
struct vs_out
{
float4 position : SV_POSITION;
float2 color_xy : COLOR0;
float2 color_zw : COLOR1;
};
struct vs_out main(struct vs_in i)
{
struct vs_out o;
o.position = i.position;
o.position.x += i.instance_id * 0.5;
o.color_xy = i.color_xy;
o.color_zw = i.color_zw;
return o;
}
#endif
0x43425844, 0x52e3bf46, 0x6300403d, 0x624cffe4, 0xa4fc0013, 0x00000001, 0x00000214, 0x00000003,
0x0000002c, 0x000000bc, 0x00000128, 0x4e475349, 0x00000088, 0x00000004, 0x00000008, 0x00000068,
0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000071, 0x00000000, 0x00000000,
0x00000003, 0x00000001, 0x00000303, 0x00000071, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
0x00000303, 0x00000077, 0x00000000, 0x00000008, 0x00000001, 0x00000003, 0x00000101, 0x49534f50,
0x4e4f4954, 0x4c4f4300, 0x5300524f, 0x4e495f56, 0x4e415453, 0x44494543, 0xababab00, 0x4e47534f,
0x00000064, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000,
0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000c03, 0x0000005c,
0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x0000030c, 0x505f5653, 0x5449534f, 0x004e4f49,
0x4f4c4f43, 0xabab0052, 0x52444853, 0x000000e4, 0x00010040, 0x00000039, 0x0300005f, 0x001010f2,
0x00000000, 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x00101032, 0x00000002, 0x04000060,
0x00101012, 0x00000003, 0x00000008, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065,
0x00102032, 0x00000001, 0x03000065, 0x001020c2, 0x00000001, 0x02000068, 0x00000001, 0x05000056,
0x00100012, 0x00000000, 0x0010100a, 0x00000003, 0x09000032, 0x00102012, 0x00000000, 0x0010000a,
0x00000000, 0x00004001, 0x3f000000, 0x0010100a, 0x00000000, 0x05000036, 0x001020e2, 0x00000000,
0x00101e56, 0x00000000, 0x05000036, 0x00102032, 0x00000001, 0x00101046, 0x00000001, 0x05000036,
0x001020c2, 0x00000001, 0x00101406, 0x00000002, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE vs = {vs_code, sizeof(vs_code)};
static const DWORD ps_code[] =
{
#if 0
struct vs_out
{
float4 position : SV_POSITION;
float2 color_xy : COLOR0;
float2 color_zw : COLOR1;
};
float4 main(struct vs_out i) : SV_TARGET
{
return float4(i.color_xy.xy, i.color_zw.xy);
}
#endif
0x43425844, 0x64e48a09, 0xaa484d46, 0xe40a6e78, 0x9885edf3, 0x00000001, 0x00000118, 0x00000003,
0x0000002c, 0x00000098, 0x000000cc, 0x4e475349, 0x00000064, 0x00000003, 0x00000008, 0x00000050,
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
0x00000003, 0x00000001, 0x00000303, 0x0000005c, 0x00000001, 0x00000000, 0x00000003, 0x00000001,
0x00000c0c, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, 0x4e47534f, 0x0000002c,
0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f,
0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000044, 0x00000040, 0x00000011, 0x03001062,
0x00101032, 0x00000001, 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000,
0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000001, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)};
static const struct
{
struct vec4 position;
}
stream0[] =
{
{{-1.0f, -1.0f, 0.0f, 1.0f}},
{{-1.0f, 1.0f, 0.0f, 1.0f}},
{{-0.5f, -1.0f, 0.0f, 1.0f}},
{{-0.5f, 1.0f, 0.0f, 1.0f}},
};
static const struct
{
struct vec2 color2;
struct vec2 color1;
}
stream1[] =
{
{{0.5f, 0.5f}, {0.0f, 1.0f}},
{{0.5f, 0.5f}, {0.0f, 1.0f}},
{{0.5f, 0.5f}, {1.0f, 1.0f}},
{{0.5f, 0.5f}, {1.0f, 1.0f}},
};
static const struct
{
struct vec2 color3;
struct vec2 color0;
}
stream2[] =
{
{{0.5f, 0.5f}, {1.0f, 0.0f}},
{{0.5f, 0.5f}, {0.0f, 1.0f}},
{{0.5f, 0.5f}, {0.0f, 0.0f}},
{{0.5f, 0.5f}, {1.0f, 0.0f}},
};
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
memset(&desc, 0, sizeof(desc));
desc.rt_width = 640;
desc.no_root_signature = true;
if (!init_test_context(&context, &desc))
return;
command_list = context.list;
queue = context.queue;
context.root_signature = create_empty_root_signature(context.device,
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT);
input_layout.pInputElementDescs = layout_desc;
input_layout.NumElements = ARRAY_SIZE(layout_desc);
context.pipeline_state = create_pipeline_state(context.device,
context.root_signature, context.render_target_desc.Format, &vs, &ps, &input_layout);
vb[0] = create_upload_buffer(context.device, sizeof(stream0), stream0);
vbv[0].BufferLocation = ID3D12Resource_GetGPUVirtualAddress(vb[0]);
vbv[0].StrideInBytes = sizeof(*stream0);
vbv[0].SizeInBytes = sizeof(stream0);
vb[1] = create_upload_buffer(context.device, sizeof(stream1), stream1);
vbv[1].BufferLocation = ID3D12Resource_GetGPUVirtualAddress(vb[1]);
vbv[1].StrideInBytes = sizeof(*stream1);
vbv[1].SizeInBytes = sizeof(stream1);
vb[2] = create_upload_buffer(context.device, sizeof(stream2), stream2);
vbv[2].BufferLocation = ID3D12Resource_GetGPUVirtualAddress(vb[2]);
vbv[2].StrideInBytes = sizeof(*stream2);
vbv[2].SizeInBytes = sizeof(stream2);
ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL);
ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state);
ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
ID3D12GraphicsCommandList_IASetVertexBuffers(command_list, 0, ARRAY_SIZE(vbv), vbv);
ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect);
ID3D12GraphicsCommandList_DrawInstanced(command_list, 4, 4, 0, 0);
transition_resource_state(command_list, context.render_target,
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
get_texture_readback_with_command_list(context.render_target, 0, &rb, queue, command_list);
color = get_readback_uint(&rb, 80, 16);
ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb, 240, 16);
ok(compare_color(color, 0xff00ff00, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb, 400, 16);
ok(compare_color(color, 0xffff0000, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb, 560, 16);
ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
release_resource_readback(&rb);
ID3D12Resource_Release(vb[2]);
ID3D12Resource_Release(vb[1]);
ID3D12Resource_Release(vb[0]);
destroy_test_context(&context);
}
static void test_gpu_virtual_address(void)
{
D3D12_GPU_VIRTUAL_ADDRESS vb_offset, ib_offset;
...
...
@@ -13317,6 +13515,7 @@ START_TEST(d3d12)
run_test(test_clear_render_target_view);
run_test(test_draw_instanced);
run_test(test_draw_indexed_instanced);
run_test(test_append_aligned_element);
run_test(test_gpu_virtual_address);
run_test(test_fragment_coords);
run_test(test_fractional_viewports);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment