From: Henri Verbeet hverbeet@codeweavers.com
RWBuffer objects would trigger a vkd3d_unreachable() in sm4_base_type(). It would be easy enough to add the required case there, but (manual, unfortunately) tests show that we aren't supposed to write constant buffer entries for objects in the first place, as you'd expect.
This particular path ends up being exercised by vkd3d's internal UAV clear shaders, but unfortunately it looks like our RDEF data may have more issues; the ability to write tests for it would seem helpful. --- libs/vkd3d-shader/tpf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index afdf84737..076ee498f 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3460,7 +3460,8 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) { - if (var->is_uniform && var->buffer == cbuffer) + if (var->is_uniform && var->buffer == cbuffer + && var->data_type->class != HLSL_CLASS_OBJECT) ++var_count; }
@@ -3494,7 +3495,8 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) { - if (var->is_uniform && var->buffer == cbuffer) + if (var->is_uniform && var->buffer == cbuffer + && var->data_type->class != HLSL_CLASS_OBJECT) { uint32_t flags = 0;
@@ -3521,7 +3523,8 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) j = 0; LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) { - if (var->is_uniform && var->buffer == cbuffer) + if (var->is_uniform && var->buffer == cbuffer + && var->data_type->class != HLSL_CLASS_OBJECT) { const unsigned int var_size = (profile->major_version >= 5 ? 10 : 6); size_t var_offset = vars_start + j * var_size * sizeof(uint32_t);
From: Henri Verbeet hverbeet@codeweavers.com
--- libs/vkd3d/state.c | 48 +++- libs/vkd3d/vkd3d_shaders.h | 568 +++++++++++++------------------------ 2 files changed, 248 insertions(+), 368 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 0b92cffcd..2545c0f04 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 b2a90cdbf..3fefe0da8 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<float4> dst; - - struct - { - float4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [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 uint32_t cs_uav_clear_buffer_uint_code[] = -{ -#if 0 - RWBuffer<uint4> dst; - - struct - { - uint4 clear_value; - int2 dst_offset; - int2 dst_extent; - } u_info; - - [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 uint32_t cs_uav_clear_1d_array_float_code[] = -{ -#if 0 - RWTexture1DArray<float4> 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[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 uint32_t cs_uav_clear_1d_array_uint_code[] = -{ -#if 0 - RWTexture1DArray<uint4> 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[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<float4> 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<uint4> 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<float4> 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<uint4> 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<float4> 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<uint4> 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<float4> 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<uint4> 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_buffer_float_code[] = + "RWBuffer<float4> 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"; + +static const char cs_uav_clear_buffer_uint_code[] = + "RWBuffer<uint4> 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"; + +static const char cs_uav_clear_1d_array_float_code[] = + "RWTexture1DArray<float4> 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 char cs_uav_clear_1d_array_uint_code[] = + "RWTexture1DArray<uint4> 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"; + +static const char cs_uav_clear_1d_float_code[] = + "RWTexture1D<float4> 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"; + +static const char cs_uav_clear_1d_uint_code[] = + "RWTexture1D<uint4> 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 char cs_uav_clear_2d_array_float_code[] = + "RWTexture2DArray<float4> 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"; + +static const char cs_uav_clear_2d_array_uint_code[] = + "RWTexture2DArray<uint4> 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"; + +static const char cs_uav_clear_2d_float_code[] = + "RWTexture2D<float4> 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 char cs_uav_clear_2d_uint_code[] = + "RWTexture2D<uint4> 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"; + +static const char cs_uav_clear_3d_float_code[] = + "RWTexture3D<float4> 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"; + +static const char cs_uav_clear_3d_uint_code[] = + "RWTexture3D<uint4> 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 */
This merge request was approved by Zebediah Figura.