mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Emit dcl_tgsm_raw instructions for raw groupshared variables.
This commit is contained in:
Notes:
Henri Verbeet
2025-08-05 16:40:26 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1605
@@ -12577,6 +12577,34 @@ static void sm4_generate_vsir_add_dcl_texture(struct hlsl_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
static void sm4_generate_vsir_add_dcl_tgsm(struct hlsl_ctx *ctx,
|
||||
struct vsir_program *program, const struct hlsl_ir_var *var)
|
||||
{
|
||||
struct vkd3d_shader_dst_param *dst_param;
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
|
||||
if (!hlsl_is_numeric_type(var->data_type))
|
||||
{
|
||||
hlsl_fixme(ctx, &var->loc, "Structured TGSM declaration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(ins = generate_vsir_add_program_instruction(ctx, program, &var->loc, VSIR_OP_DCL_TGSM_RAW, 0, 0)))
|
||||
{
|
||||
ctx->result = VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
dst_param = &ins->declaration.tgsm_raw.reg;
|
||||
|
||||
vsir_dst_param_init(dst_param, VKD3DSPR_GROUPSHAREDMEM, VSIR_DATA_F32, 1);
|
||||
dst_param->reg.dimension = VSIR_DIMENSION_NONE;
|
||||
dst_param->reg.idx[0].offset = var->regs[HLSL_REGSET_NUMERIC].id;
|
||||
|
||||
ins->declaration.tgsm_raw.byte_count = var->data_type->reg_size[HLSL_REGSET_NUMERIC] * 4;
|
||||
ins->declaration.tgsm_raw.zero_init = false;
|
||||
}
|
||||
|
||||
static void sm4_generate_vsir_add_dcl_stream(struct hlsl_ctx *ctx,
|
||||
struct vsir_program *program, const struct hlsl_ir_var *var)
|
||||
{
|
||||
@@ -12659,7 +12687,7 @@ static void sm4_generate_vsir(struct hlsl_ctx *ctx,
|
||||
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
||||
{
|
||||
if (var->is_tgsm && var->regs[HLSL_REGSET_NUMERIC].allocated)
|
||||
hlsl_fixme(ctx, &var->loc, "Groupshared variable.");
|
||||
sm4_generate_vsir_add_dcl_tgsm(ctx, program, var);
|
||||
}
|
||||
|
||||
if (version->type == VKD3D_SHADER_TYPE_GEOMETRY && version->major >= 5)
|
||||
|
@@ -3910,6 +3910,23 @@ static void tpf_dcl_texture(const struct tpf_compiler *tpf, const struct vkd3d_s
|
||||
write_sm4_instruction(tpf, &instr);
|
||||
}
|
||||
|
||||
static void tpf_dcl_tgsm_raw(const struct tpf_compiler *tpf, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
const struct vkd3d_shader_tgsm_raw *tgsm = &ins->declaration.tgsm_raw;
|
||||
struct sm4_instruction instr =
|
||||
{
|
||||
.opcode = VKD3D_SM5_OP_DCL_TGSM_RAW,
|
||||
|
||||
.dsts[0] = tgsm->reg,
|
||||
.dst_count = 1,
|
||||
|
||||
.idx[0] = tgsm->byte_count,
|
||||
.idx_count = 1,
|
||||
};
|
||||
|
||||
write_sm4_instruction(tpf, &instr);
|
||||
}
|
||||
|
||||
static void write_sm4_dcl_global_flags(const struct tpf_compiler *tpf, uint32_t flags)
|
||||
{
|
||||
struct sm4_instruction instr =
|
||||
@@ -4199,6 +4216,10 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
|
||||
tpf_dcl_sampler(tpf, ins);
|
||||
break;
|
||||
|
||||
case VSIR_OP_DCL_TGSM_RAW:
|
||||
tpf_dcl_tgsm_raw(tpf, ins);
|
||||
break;
|
||||
|
||||
case VSIR_OP_DCL:
|
||||
case VSIR_OP_DCL_RESOURCE_RAW:
|
||||
case VSIR_OP_DCL_UAV_RAW:
|
||||
|
Reference in New Issue
Block a user