diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 81161a397..a9f8872a4 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -12928,8 +12928,6 @@ static void sm4_generate_vsir_add_dcl_texture(struct hlsl_ctx *ctx, vsir_resource->reg.reg.idx[2].offset = array_last; vsir_resource->reg.reg.idx_count = 3; - ins->resource_type = sm4_generate_vsir_get_resource_type(resource->component_type); - if (component_type->sampler_dim == HLSL_SAMPLER_DIM_RAW_BUFFER) { ins->raw = true; @@ -12942,6 +12940,8 @@ static void sm4_generate_vsir_add_dcl_texture(struct hlsl_ctx *ctx, } else { + ins->declaration.semantic.resource_type = sm4_generate_vsir_get_resource_type(resource->component_type); + for (unsigned int j = 0; j < 4; ++j) ins->declaration.semantic.resource_data_type[j] = sm4_generate_vsir_get_format_type(component_type); diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index c6d239847..82ac270bd 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3874,8 +3874,11 @@ static void tpf_dcl_texture(const struct tpf_compiler *tpf, const struct vkd3d_s if (ins->opcode == VSIR_OP_DCL || ins->opcode == VSIR_OP_DCL_UAV_TYPED) { + enum vkd3d_sm4_resource_type resource_type = sm4_resource_dimension(ins->declaration.semantic.resource_type); + instr.idx[0] = pack_resource_data_type(ins->declaration.semantic.resource_data_type); instr.idx_count = 1; + instr.extra_bits |= resource_type << VKD3D_SM4_RESOURCE_TYPE_SHIFT; instr.extra_bits |= ins->declaration.semantic.sample_count << VKD3D_SM4_RESOURCE_SAMPLE_COUNT_SHIFT; resource = &ins->declaration.semantic.resource; } @@ -3910,8 +3913,6 @@ static void tpf_dcl_texture(const struct tpf_compiler *tpf, const struct vkd3d_s if (uav) instr.extra_bits |= ins->flags << VKD3D_SM5_UAV_FLAGS_SHIFT; - instr.extra_bits |= (sm4_resource_dimension(ins->resource_type) << VKD3D_SM4_RESOURCE_TYPE_SHIFT); - write_sm4_instruction(tpf, &instr); }