mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/ir: Check that LOCALTHREADINDEX registers have dimension VEC4.
Also fix the HLSL compiler and DXIL parser to emit them accordingly.
This commit is contained in:
committed by
Henri Verbeet
parent
61c46f95da
commit
ee0447b973
Notes:
Henri Verbeet
2025-07-21 12:36:12 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1629
@@ -5477,11 +5477,9 @@ static void sm6_parser_emit_dx_compute_builtin(struct sm6_parser *sm6, enum dx_i
|
||||
if (!(src_param = instruction_src_params_alloc(ins, 1, sm6)))
|
||||
return;
|
||||
vsir_register_init(&src_param->reg, reg_type, VKD3D_DATA_UINT, 0);
|
||||
src_param->reg.dimension = VSIR_DIMENSION_VEC4;
|
||||
if (component_count > 1)
|
||||
{
|
||||
src_param->reg.dimension = VSIR_DIMENSION_VEC4;
|
||||
component_idx = sm6_value_get_constant_uint(operands[0], sm6);
|
||||
}
|
||||
src_param_init_scalar(src_param, component_idx);
|
||||
|
||||
instruction_dst_param_init_ssa_scalar(ins, sm6);
|
||||
|
@@ -9534,6 +9534,18 @@ static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
static void vsir_validate_register(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
static const struct register_validation_data
|
||||
{
|
||||
bool valid;
|
||||
unsigned int idx_count;
|
||||
enum vsir_dimension dimension;
|
||||
}
|
||||
register_validation_data[] =
|
||||
{
|
||||
[VKD3DSPR_LOCALTHREADINDEX] = {true, 0, VSIR_DIMENSION_VEC4},
|
||||
};
|
||||
|
||||
const struct register_validation_data *validation_data;
|
||||
unsigned int i;
|
||||
|
||||
if (reg->type >= VKD3DSPR_COUNT)
|
||||
@@ -9683,10 +9695,6 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
vsir_validate_register_without_indices(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_LOCALTHREADINDEX:
|
||||
vsir_validate_register_without_indices(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_COVERAGE:
|
||||
vsir_validate_register_without_indices(ctx, reg);
|
||||
break;
|
||||
@@ -9726,6 +9734,24 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (reg->type >= ARRAY_SIZE(register_validation_data))
|
||||
return;
|
||||
|
||||
validation_data = ®ister_validation_data[reg->type];
|
||||
|
||||
if (!validation_data->valid)
|
||||
return;
|
||||
|
||||
if (reg->idx_count != validation_data->idx_count)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
"Invalid index count %u for a register of type %#x, expected %u.",
|
||||
reg->idx_count, reg->type, validation_data->idx_count);
|
||||
|
||||
if (reg->dimension != validation_data->dimension)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
"Invalid dimension %#x for a register of type %#x, expected %#x.",
|
||||
reg->dimension, reg->type, validation_data->dimension);
|
||||
}
|
||||
|
||||
static void vsir_validate_io_dst_param(struct validation_context *ctx,
|
||||
|
@@ -2242,7 +2242,6 @@ bool shader_sm4_is_scalar_register(const struct vkd3d_shader_register *reg)
|
||||
case VKD3DSPR_DEPTHOUTGE:
|
||||
case VKD3DSPR_DEPTHOUTLE:
|
||||
case VKD3DSPR_GSINSTID:
|
||||
case VKD3DSPR_LOCALTHREADINDEX:
|
||||
case VKD3DSPR_OUTPOINTID:
|
||||
case VKD3DSPR_PRIMID:
|
||||
case VKD3DSPR_SAMPLEMASK:
|
||||
|
Reference in New Issue
Block a user