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
f7354ff9
Commit
f7354ff9
authored
1 year ago
by
Giovanni Mascellani
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
tests: Compile HLSL shaders at runtime in test_create_compute_pipeline_state().
parent
06399d12
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!337
tests: Compile HLSL shaders at runtime.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/d3d12.c
+28
-12
28 additions, 12 deletions
tests/d3d12.c
tests/d3d12_test_utils.h
+5
-0
5 additions, 0 deletions
tests/d3d12_test_utils.h
with
33 additions
and
12 deletions
tests/d3d12.c
+
28
−
12
View file @
f7354ff9
...
...
@@ -28,6 +28,20 @@ struct test_options test_options = {0};
static PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER pfn_D3D12CreateVersionedRootSignatureDeserializer;
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE pfn_D3D12SerializeVersionedRootSignature;
static ID3D10Blob *compile_shader(const char *source, size_t len, const char *profile)
{
ID3D10Blob *bytecode = NULL, *errors = NULL;
HRESULT hr;
hr = D3DCompile(source, len, NULL, NULL, NULL, "main", profile, 0, 0, &bytecode, &errors);
ok(hr == S_OK, "Cannot compile shader, hr %#x.\n", hr);
ok(!!bytecode, "Compilation didn't produce any bytecode.\n");
if (errors)
ID3D10Blob_Release(errors);
return bytecode;
}
struct dvec2
{
double x, y;
...
...
@@ -2885,24 +2899,23 @@ static void test_create_compute_pipeline_state(void)
ID3D12RootSignature *root_signature;
ID3D12PipelineState *pipeline_state;
ID3D12Device *device, *tmp_device;
ID3D10Blob *bytecode;
ULONG refcount;
HRESULT hr;
static const DWORD dxbc_code[] =
{
#if 0
[numthreads(1, 1, 1)]
void main() { }
#endif
0x43425844, 0x1acc3ad0, 0x71c7b057, 0xc72c4306, 0xf432cb57, 0x00000001, 0x00000074, 0x00000003,
0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x00000020, 0x00050050, 0x00000008, 0x0100086a,
0x0400009b, 0x00000001, 0x00000001, 0x00000001, 0x0100003e,
};
static const char shader_code[] =
"[numthreads(1, 1, 1)]\n"
"void main() { }\n";
bytecode = compile_shader(shader_code, sizeof(shader_code) - 1, "cs_4_0");
if (!(device = create_device()))
{
skip("Failed to create device.\n");
refcount = ID3D10Blob_Release(bytecode);
ok(!refcount, "ID3D10Blob has %u references left.\n", (unsigned int)refcount);
return;
}
...
...
@@ -2919,7 +2932,7 @@ static void test_create_compute_pipeline_state(void)
memset(&pipeline_state_desc, 0, sizeof(pipeline_state_desc));
pipeline_state_desc.pRootSignature = root_signature;
pipeline_state_desc.CS = shader_bytecode
(dxbc_code, sizeof(dxbc_
code)
)
;
pipeline_state_desc.CS = shader_bytecode
_from_blob(byte
code);
pipeline_state_desc.NodeMask = 0;
pipeline_state_desc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
...
...
@@ -2951,6 +2964,9 @@ static void test_create_compute_pipeline_state(void)
refcount = ID3D12Device_Release(device);
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
refcount = ID3D10Blob_Release(bytecode);
ok(!refcount, "ID3D10Blob has %u references left.\n", (unsigned int)refcount);
}
static void test_create_graphics_pipeline_state(void)
This diff is collapsed.
Click to expand it.
tests/d3d12_test_utils.h
+
5
−
0
View file @
f7354ff9
...
...
@@ -88,6 +88,11 @@ static D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size)
return
shader_bytecode
;
}
static
inline
D3D12_SHADER_BYTECODE
shader_bytecode_from_blob
(
ID3D10Blob
*
blob
)
{
return
shader_bytecode
(
ID3D10Blob_GetBufferPointer
(
blob
),
ID3D10Blob_GetBufferSize
(
blob
));
}
static
void
exec_command_list
(
ID3D12CommandQueue
*
queue
,
ID3D12GraphicsCommandList
*
list
)
{
ID3D12CommandList
*
lists
[]
=
{(
ID3D12CommandList
*
)
list
};
...
...
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