From a03e78bf6285d4344f5d7774729b4b64175422a7 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 6 Oct 2023 01:53:49 +0200 Subject: [PATCH] vkd3d: Compile the UAV clear shaders at runtime. --- libs/vkd3d/state.c | 48 +++- libs/vkd3d/vkd3d_shaders.h | 546 +++++++++++++------------------------ 2 files changed, 237 insertions(+), 357 deletions(-) diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 0b92cffc..2545c0f0 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -3605,6 +3605,36 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta return vk_pipeline; } +static int compile_hlsl_cs(const struct vkd3d_shader_code *hlsl, struct vkd3d_shader_code *dxbc) +{ + struct vkd3d_shader_hlsl_source_info hlsl_info; + struct vkd3d_shader_compile_info info; + + static const struct vkd3d_shader_compile_option options[] = + { + {VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_9}, + }; + + info.type = VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO; + info.next = &hlsl_info; + info.source = *hlsl; + info.source_type = VKD3D_SHADER_SOURCE_HLSL; + info.target_type = VKD3D_SHADER_TARGET_DXBC_TPF; + info.options = options; + info.option_count = ARRAY_SIZE(options); + info.log_level = VKD3D_SHADER_LOG_NONE; + info.source_name = NULL; + + hlsl_info.type = VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO; + hlsl_info.next = NULL; + hlsl_info.entry_point = "main"; + hlsl_info.secondary_code.code = NULL; + hlsl_info.secondary_code.size = 0; + hlsl_info.profile = "cs_5_0"; + + return vkd3d_shader_compile(&info, dxbc, NULL); +} + static void vkd3d_uav_clear_pipelines_cleanup(struct vkd3d_uav_clear_pipelines *pipelines, struct d3d12_device *device) { @@ -3658,7 +3688,7 @@ HRESULT vkd3d_uav_clear_state_init(struct vkd3d_uav_clear_state *state, struct d { VkPipeline *pipeline; VkPipelineLayout *pipeline_layout; - D3D12_SHADER_BYTECODE code; + struct vkd3d_shader_code code; } pipelines[] = { @@ -3748,13 +3778,25 @@ HRESULT vkd3d_uav_clear_state_init(struct vkd3d_uav_clear_state *state, struct d for (i = 0; i < ARRAY_SIZE(pipelines); ++i) { + struct vkd3d_shader_code dxbc; + int ret; + + if ((ret = compile_hlsl_cs(&pipelines[i].code, &dxbc))) + { + ERR("Failed to compile HLSL compute shader %u, ret %d.\n", i, ret); + hr = hresult_from_vk_result(ret); + goto fail; + } + if (pipelines[i].pipeline_layout == &state->vk_pipeline_layout_buffer) binding.flags = VKD3D_SHADER_BINDING_FLAG_BUFFER; else binding.flags = VKD3D_SHADER_BINDING_FLAG_IMAGE; - if (FAILED(hr = vkd3d_create_compute_pipeline(device, &pipelines[i].code, &shader_interface, - *pipelines[i].pipeline_layout, pipelines[i].pipeline))) + hr = vkd3d_create_compute_pipeline(device, &(D3D12_SHADER_BYTECODE){dxbc.code, dxbc.size}, + &shader_interface, *pipelines[i].pipeline_layout, pipelines[i].pipeline); + vkd3d_shader_free_shader_code(&dxbc); + if (FAILED(hr)) { ERR("Failed to create compute pipeline %u, hr %#x.\n", i, hr); goto fail; diff --git a/libs/vkd3d/vkd3d_shaders.h b/libs/vkd3d/vkd3d_shaders.h index b2a90cdb..3fefe0da 100644 --- a/libs/vkd3d/vkd3d_shaders.h +++ b/libs/vkd3d/vkd3d_shaders.h @@ -19,370 +19,208 @@ #ifndef __VKD3D_SHADERS_H #define __VKD3D_SHADERS_H -static const uint32_t cs_uav_clear_buffer_float_code[] = -{ -#if 0 - RWBuffer dst; +static const char cs_uav_clear_buffer_float_code[] = + "RWBuffer dst;\n" + "\n" + "struct\n" + "{\n" + " float4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(128, 1, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (thread_id.x < u_info.dst_extent.x)\n" + " dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;\n" + "}\n"; - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; +static const char cs_uav_clear_buffer_uint_code[] = + "RWBuffer dst;\n" + "\n" + "struct\n" + "{\n" + " uint4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(128, 1, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (thread_id.x < u_info.dst_extent.x)\n" + " dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;\n" + "}\n"; - [numthreads(128, 1, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (thread_id.x < u_info.dst_extent.x) - dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value; - } -#endif - 0x43425844, 0xe114ba61, 0xff6a0d0b, 0x7b25c8f4, 0xfcf7cf22, 0x00000001, 0x0000010c, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400089c, 0x0011e000, 0x00000000, 0x00005555, - 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000080, 0x00000001, 0x00000001, - 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f, - 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000, - 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x01000015, 0x0100003e, -}; +static const char cs_uav_clear_1d_array_float_code[] = + "RWTexture1DArray dst;\n" + "\n" + "struct\n" + "{\n" + " float4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(64, 1, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (thread_id.x < u_info.dst_extent.x)\n" + " dst[int2(u_info.dst_offset.x + thread_id.x, thread_id.y)] = u_info.clear_value;\n" + "}\n"; -static const uint32_t cs_uav_clear_buffer_uint_code[] = -{ -#if 0 - RWBuffer dst; +static const char cs_uav_clear_1d_array_uint_code[] = + "RWTexture1DArray dst;\n" + "\n" + "struct\n" + "{\n" + " uint4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(64, 1, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (thread_id.x < u_info.dst_extent.x)\n" + " dst[int2(u_info.dst_offset.x + thread_id.x, thread_id.y)] = u_info.clear_value;\n" + "}\n"; - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; +static const char cs_uav_clear_1d_float_code[] = + "RWTexture1D dst;\n" + "\n" + "struct\n" + "{\n" + " float4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(64, 1, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (thread_id.x < u_info.dst_extent.x)\n" + " dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;\n" + "}\n"; - [numthreads(128, 1, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (thread_id.x < u_info.dst_extent.x) - dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value; - } -#endif - 0x43425844, 0x3afd0cfd, 0x5145c166, 0x5b9f76b8, 0xa73775cd, 0x00000001, 0x0000010c, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400089c, 0x0011e000, 0x00000000, 0x00004444, - 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000080, 0x00000001, 0x00000001, - 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f, - 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000, - 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x01000015, 0x0100003e, -}; +static const char cs_uav_clear_1d_uint_code[] = + "RWTexture1D dst;\n" + "\n" + "struct\n" + "{\n" + " uint4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(64, 1, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (thread_id.x < u_info.dst_extent.x)\n" + " dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;\n" + "}\n"; -static const uint32_t cs_uav_clear_1d_array_float_code[] = -{ -#if 0 - RWTexture1DArray dst; +static const char cs_uav_clear_2d_array_float_code[] = + "RWTexture2DArray dst;\n" + "\n" + "struct\n" + "{\n" + " float4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(8, 8, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (all(thread_id.xy < u_info.dst_extent.xy))\n" + " dst[int3(u_info.dst_offset.xy + thread_id.xy, thread_id.z)] = u_info.clear_value;\n" + "}\n"; - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; +static const char cs_uav_clear_2d_array_uint_code[] = + "RWTexture2DArray dst;\n" + "\n" + "struct\n" + "{\n" + " uint4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(8, 8, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (all(thread_id.xy < u_info.dst_extent.xy))\n" + " dst[int3(u_info.dst_offset.xy + thread_id.xy, thread_id.z)] = u_info.clear_value;\n" + "}\n"; - [numthreads(64, 1, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (thread_id.x < u_info.dst_extent.x) - dst[int2(u_info.dst_offset.x + thread_id.x, thread_id.y)] = u_info.clear_value; - } -#endif - 0x43425844, 0x3d73bc2d, 0x2b635f3d, 0x6bf98e92, 0xbe0aa5d9, 0x00000001, 0x0000011c, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000c8, 0x00050050, 0x00000032, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400389c, 0x0011e000, 0x00000000, 0x00005555, - 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001, - 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f, - 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000, - 0x00000001, 0x04000036, 0x001000e2, 0x00000000, 0x00020556, 0x080000a4, 0x0011e0f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e, -}; +static const char cs_uav_clear_2d_float_code[] = + "RWTexture2D dst;\n" + "\n" + "struct\n" + "{\n" + " float4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(8, 8, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (all(thread_id.xy < u_info.dst_extent.xy))\n" + " dst[u_info.dst_offset.xy + thread_id.xy] = u_info.clear_value;\n" + "}\n"; -static const uint32_t cs_uav_clear_1d_array_uint_code[] = -{ -#if 0 - RWTexture1DArray dst; +static const char cs_uav_clear_2d_uint_code[] = + "RWTexture2D dst;\n" + "\n" + "struct\n" + "{\n" + " uint4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(8, 8, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (all(thread_id.xy < u_info.dst_extent.xy))\n" + " dst[u_info.dst_offset.xy + thread_id.xy] = u_info.clear_value;\n" + "}\n"; - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; +static const char cs_uav_clear_3d_float_code[] = + "RWTexture3D dst;\n" + "\n" + "struct\n" + "{\n" + " float4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(8, 8, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (all(thread_id.xy < u_info.dst_extent.xy))\n" + " dst[int3(u_info.dst_offset.xy, 0) + thread_id.xyz] = u_info.clear_value;\n" + "}\n"; - [numthreads(64, 1, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (thread_id.x < u_info.dst_extent.x) - dst[int2(u_info.dst_offset.x + thread_id.x, thread_id.y)] = u_info.clear_value; - } -#endif - 0x43425844, 0x2f0ca457, 0x72068b34, 0xd9dadc2b, 0xd3178c3e, 0x00000001, 0x0000011c, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000c8, 0x00050050, 0x00000032, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400389c, 0x0011e000, 0x00000000, 0x00004444, - 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001, - 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f, - 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000, - 0x00000001, 0x04000036, 0x001000e2, 0x00000000, 0x00020556, 0x080000a4, 0x0011e0f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_1d_float_code[] = -{ -#if 0 - RWTexture1D dst; - - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(64, 1, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (thread_id.x < u_info.dst_extent.x) - dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value; - } -#endif - 0x43425844, 0x05266503, 0x4b97006f, 0x01a5cc63, 0xe617d0a1, 0x00000001, 0x0000010c, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400109c, 0x0011e000, 0x00000000, 0x00005555, - 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001, - 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f, - 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000, - 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_1d_uint_code[] = -{ -#if 0 - RWTexture1D dst; - - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(64, 1, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (thread_id.x < u_info.dst_extent.x) - dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value; - } -#endif - 0x43425844, 0x19d5c8f2, 0x3ca4ac24, 0x9e258499, 0xf0463fd6, 0x00000001, 0x0000010c, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400109c, 0x0011e000, 0x00000000, 0x00004444, - 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001, - 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f, - 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000, - 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_2d_array_float_code[] = -{ -#if 0 - RWTexture2DArray dst; - - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(8, 8, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (all(thread_id.xy < u_info.dst_extent.xy)) - dst[int3(u_info.dst_offset.xy + thread_id.xy, thread_id.z)] = u_info.clear_value; - } -#endif - 0x43425844, 0x924d2d2c, 0xb9166376, 0x99f83871, 0x8ef65025, 0x00000001, 0x00000138, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400409c, 0x0011e000, 0x00000000, 0x00005555, - 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001, - 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001, - 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, - 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001, - 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_2d_array_uint_code[] = -{ -#if 0 - RWTexture2DArray dst; - - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(8, 8, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (all(thread_id.xy < u_info.dst_extent.xy)) - dst[int3(u_info.dst_offset.xy + thread_id.xy, thread_id.z)] = u_info.clear_value; - } -#endif - 0x43425844, 0xa92219d4, 0xa2c5e47d, 0x0d308500, 0xf32197b4, 0x00000001, 0x00000138, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400409c, 0x0011e000, 0x00000000, 0x00004444, - 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001, - 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001, - 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, - 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001, - 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_2d_float_code[] = -{ -#if 0 - RWTexture2D dst; - - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(8, 8, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (all(thread_id.xy < u_info.dst_extent.xy)) - dst[u_info.dst_offset.xy + thread_id.xy] = u_info.clear_value; - } -#endif - 0x43425844, 0x6e735b3f, 0x7348c4fa, 0xb3634e42, 0x50e2d99b, 0x00000001, 0x00000128, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000d4, 0x00050050, 0x00000035, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400189c, 0x0011e000, 0x00000000, 0x00005555, - 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001, - 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001, - 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, - 0x00000000, 0x0700001e, 0x001000f2, 0x00000000, 0x00020546, 0x00208546, 0x00000000, 0x00000001, - 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, - 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_2d_uint_code[] = -{ -#if 0 - RWTexture2D dst; - - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(8, 8, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (all(thread_id.xy < u_info.dst_extent.xy)) - dst[u_info.dst_offset.xy + thread_id.xy] = u_info.clear_value; - } -#endif - 0x43425844, 0xf01db5dd, 0xc7dc5e55, 0xb017c1a8, 0x55abd52d, 0x00000001, 0x00000128, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000d4, 0x00050050, 0x00000035, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400189c, 0x0011e000, 0x00000000, 0x00004444, - 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001, - 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001, - 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, - 0x00000000, 0x0700001e, 0x001000f2, 0x00000000, 0x00020546, 0x00208546, 0x00000000, 0x00000001, - 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, - 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_3d_float_code[] = -{ -#if 0 - RWTexture3D dst; - - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(8, 8, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (all(thread_id.xy < u_info.dst_extent.xy)) - dst[int3(u_info.dst_offset.xy, 0) + thread_id.xyz] = u_info.clear_value; - } -#endif - 0x43425844, 0x5d8f36a0, 0x30fa86a5, 0xfec7f2ef, 0xdfd76cbb, 0x00000001, 0x00000138, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400289c, 0x0011e000, 0x00000000, 0x00005555, - 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001, - 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001, - 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, - 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001, - 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e, -}; - -static const uint32_t cs_uav_clear_3d_uint_code[] = -{ -#if 0 - RWTexture3D dst; - - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [numthreads(8, 8, 1)] - void main(int3 thread_id : SV_DispatchThreadID) - { - if (all(thread_id.xy < u_info.dst_extent.xy)) - dst[int3(u_info.dst_offset.xy, 0) + thread_id.xyz] = u_info.clear_value; - } -#endif - 0x43425844, 0x5b9c95b1, 0xc9bde4e3, 0x9aaff806, 0x24a1d264, 0x00000001, 0x00000138, 0x00000003, - 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a, - 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400289c, 0x0011e000, 0x00000000, 0x00004444, - 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001, - 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001, - 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, - 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001, - 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e, -}; +static const char cs_uav_clear_3d_uint_code[] = + "RWTexture3D dst;\n" + "\n" + "struct\n" + "{\n" + " uint4 clear_value;\n" + " int2 dst_offset;\n" + " int2 dst_extent;\n" + "} u_info;\n" + "\n" + "[numthreads(8, 8, 1)]\n" + "void main(int3 thread_id : SV_DispatchThreadID)\n" + "{\n" + " if (all(thread_id.xy < u_info.dst_extent.xy))\n" + " dst[int3(u_info.dst_offset.xy, 0) + thread_id.xyz] = u_info.clear_value;\n" + "}\n"; #endif /* __VKD3D_SHADERS_H */