From 12e397de9a7ce4bc32269d5578accb6a948d08c3 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 15 Aug 2021 13:03:28 -0500 Subject: [PATCH] vkd3d-shader/hlsl: Write SM4 UAV declarations. --- libs/vkd3d-shader/hlsl_sm4.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c index 8ca37f3f..7884b4e7 100644 --- a/libs/vkd3d-shader/hlsl_sm4.c +++ b/libs/vkd3d-shader/hlsl_sm4.c @@ -1140,12 +1140,13 @@ static void write_sm4_dcl_sampler(struct vkd3d_bytecode_buffer *buffer, const st static void write_sm4_dcl_texture(struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_var *var) { + bool uav = (var->data_type->base_type == HLSL_TYPE_UAV); const struct sm4_instruction instr = { - .opcode = VKD3D_SM4_OP_DCL_RESOURCE + .opcode = (uav ? VKD3D_SM5_OP_DCL_UAV_TYPED : VKD3D_SM4_OP_DCL_RESOURCE) | (sm4_resource_dimension(var->data_type) << VKD3D_SM4_RESOURCE_TYPE_SHIFT), - .dsts[0].reg.type = VKD3D_SM4_RT_RESOURCE, + .dsts[0].reg.type = uav ? VKD3D_SM5_RT_UAV : VKD3D_SM4_RT_RESOURCE, .dsts[0].reg.idx = {var->reg.id}, .dsts[0].reg.idx_count = 1, .dst_count = 1, @@ -2302,7 +2303,7 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, if (var->data_type->base_type == HLSL_TYPE_SAMPLER) write_sm4_dcl_sampler(&buffer, var); - else if (var->data_type->base_type == HLSL_TYPE_TEXTURE) + else if (var->data_type->base_type == HLSL_TYPE_TEXTURE || var->data_type->base_type == HLSL_TYPE_UAV) write_sm4_dcl_texture(&buffer, var); }