mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Give more meaningful names to I/O normalisation levels.
The previous names "not normalised" and "fully normalised" have meanings which are likely to change with time. OTOH including a description of the normalisation level in the enumerant seems excessive. Relating normalisation levels to shader model versions might be a reasonable compromise.
This commit is contained in:
parent
09095403ac
commit
64126a00c3
Notes:
Henri Verbeet
2024-12-12 17:48:47 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1311
@ -1317,7 +1317,7 @@ static enum vkd3d_result shader_sm1_init(struct vkd3d_shader_sm1_parser *sm1, st
|
||||
|
||||
/* Estimate instruction count to avoid reallocation in most shaders. */
|
||||
if (!vsir_program_init(program, compile_info, &version,
|
||||
code_size != ~(size_t)0 ? token_count / 4u + 4 : 16, VSIR_CF_STRUCTURED, VSIR_NOT_NORMALISED))
|
||||
code_size != ~(size_t)0 ? token_count / 4u + 4 : 16, VSIR_CF_STRUCTURED, VSIR_NORMALISED_SM4))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
vkd3d_shader_parser_init(&sm1->p, program, message_context, compile_info->source_name);
|
||||
|
@ -10356,7 +10356,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, struct vsir_pro
|
||||
/* Estimate instruction count to avoid reallocation in most shaders. */
|
||||
count = max(token_count, 400) - 400;
|
||||
if (!vsir_program_init(program, compile_info, &version,
|
||||
(count + (count >> 2)) / 2u + 10, VSIR_CF_BLOCKS, VSIR_FULLY_NORMALISED_IO))
|
||||
(count + (count >> 2)) / 2u + 10, VSIR_CF_BLOCKS, VSIR_NORMALISED_SM6))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
vkd3d_shader_parser_init(&sm6->p, program, message_context, compile_info->source_name);
|
||||
sm6->ptr = &sm6->start[1];
|
||||
|
@ -2469,7 +2469,7 @@ int glsl_compile(struct vsir_program *program, uint64_t config_flags,
|
||||
if ((ret = vsir_program_transform(program, config_flags, compile_info, message_context)) < 0)
|
||||
return ret;
|
||||
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_FULLY_NORMALISED_IO);
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_NORMALISED_SM6);
|
||||
|
||||
vkd3d_glsl_generator_init(&generator, program, compile_info,
|
||||
descriptor_info, combined_sampler_info, message_context);
|
||||
|
@ -8051,7 +8051,7 @@ static void sm1_generate_vsir(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl
|
||||
version.major = ctx->profile->major_version;
|
||||
version.minor = ctx->profile->minor_version;
|
||||
version.type = ctx->profile->type;
|
||||
if (!vsir_program_init(program, NULL, &version, 0, VSIR_CF_STRUCTURED, VSIR_NOT_NORMALISED))
|
||||
if (!vsir_program_init(program, NULL, &version, 0, VSIR_CF_STRUCTURED, VSIR_NORMALISED_SM4))
|
||||
{
|
||||
ctx->result = VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
@ -9922,7 +9922,7 @@ static void sm4_generate_vsir(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl
|
||||
version.minor = ctx->profile->minor_version;
|
||||
version.type = ctx->profile->type;
|
||||
|
||||
if (!vsir_program_init(program, NULL, &version, 0, VSIR_CF_STRUCTURED, VSIR_NOT_NORMALISED))
|
||||
if (!vsir_program_init(program, NULL, &version, 0, VSIR_CF_STRUCTURED, VSIR_NORMALISED_SM4))
|
||||
{
|
||||
ctx->result = VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
|
@ -1582,7 +1582,7 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
|
||||
enum vkd3d_result ret;
|
||||
unsigned int i, j;
|
||||
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_NOT_NORMALISED);
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_NORMALISED_SM4);
|
||||
|
||||
if (program->shader_version.type != VKD3D_SHADER_TYPE_HULL)
|
||||
{
|
||||
@ -2340,7 +2340,7 @@ static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program
|
||||
|
||||
program->instructions = normaliser.instructions;
|
||||
program->use_vocp = normaliser.use_vocp;
|
||||
program->normalisation_level = VSIR_FULLY_NORMALISED_IO;
|
||||
program->normalisation_level = VSIR_NORMALISED_SM6;
|
||||
return VKD3D_OK;
|
||||
}
|
||||
|
||||
@ -7234,7 +7234,7 @@ static const struct shader_signature *vsir_signature_from_register_type(struct v
|
||||
{
|
||||
case VKD3D_SHADER_TYPE_HULL:
|
||||
if (ctx->phase == VKD3DSIH_HS_CONTROL_POINT_PHASE
|
||||
|| ctx->program->normalisation_level >= VSIR_FULLY_NORMALISED_IO)
|
||||
|| ctx->program->normalisation_level >= VSIR_NORMALISED_SM6)
|
||||
{
|
||||
*has_control_point = ctx->program->normalisation_level >= VSIR_NORMALISED_HULL_CONTROL_POINT_IO;
|
||||
*control_point_count = ctx->program->output_control_point_count;
|
||||
@ -7276,7 +7276,7 @@ static void vsir_validate_io_register(struct validation_context *ctx, const stru
|
||||
signature = vsir_signature_from_register_type(ctx, reg->type, &has_control_point, &control_point_count);
|
||||
VKD3D_ASSERT(signature);
|
||||
|
||||
if (ctx->program->normalisation_level < VSIR_FULLY_NORMALISED_IO)
|
||||
if (ctx->program->normalisation_level < VSIR_NORMALISED_SM6)
|
||||
{
|
||||
/* Indices are [register] or [control point, register]. Both are
|
||||
* allowed to have a relative address. */
|
||||
@ -8374,7 +8374,7 @@ static void vsir_validate_signature(struct validation_context *ctx, const struct
|
||||
}
|
||||
|
||||
/* After I/O normalisation tessellation factors are merged in a single array. */
|
||||
if (ctx->program->normalisation_level >= VSIR_FULLY_NORMALISED_IO)
|
||||
if (ctx->program->normalisation_level >= VSIR_NORMALISED_SM6)
|
||||
{
|
||||
expected_outer_count = min(1, expected_outer_count);
|
||||
expected_inner_count = min(1, expected_inner_count);
|
||||
@ -8568,7 +8568,7 @@ static void vsir_validate_dcl_index_range(struct validation_context *ctx,
|
||||
const struct shader_signature *signature;
|
||||
bool has_control_point;
|
||||
|
||||
if (ctx->program->normalisation_level >= VSIR_FULLY_NORMALISED_IO)
|
||||
if (ctx->program->normalisation_level >= VSIR_NORMALISED_SM6)
|
||||
{
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER,
|
||||
"DCL_INDEX_RANGE is not allowed with fully normalised input/output.");
|
||||
|
@ -1314,7 +1314,7 @@ int msl_compile(struct vsir_program *program, uint64_t config_flags,
|
||||
if ((ret = vsir_program_transform(program, config_flags, compile_info, message_context)) < 0)
|
||||
return ret;
|
||||
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_FULLY_NORMALISED_IO);
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_NORMALISED_SM6);
|
||||
|
||||
if ((ret = msl_generator_init(&generator, program, compile_info, descriptor_info, message_context)) < 0)
|
||||
return ret;
|
||||
|
@ -10826,7 +10826,7 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
|
||||
compile_info, compiler->message_context)) < 0)
|
||||
return result;
|
||||
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_FULLY_NORMALISED_IO);
|
||||
VKD3D_ASSERT(program->normalisation_level == VSIR_NORMALISED_SM6);
|
||||
|
||||
max_element_count = max(program->output_signature.element_count, program->patch_constant_signature.element_count);
|
||||
if (!(compiler->output_info = vkd3d_calloc(max_element_count, sizeof(*compiler->output_info))))
|
||||
|
@ -2793,7 +2793,7 @@ static bool shader_sm4_init(struct vkd3d_shader_sm4_parser *sm4, struct vsir_pro
|
||||
|
||||
/* Estimate instruction count to avoid reallocation in most shaders. */
|
||||
if (!vsir_program_init(program, compile_info,
|
||||
&version, token_count / 7u + 20, VSIR_CF_STRUCTURED, VSIR_NOT_NORMALISED))
|
||||
&version, token_count / 7u + 20, VSIR_CF_STRUCTURED, VSIR_NORMALISED_SM4))
|
||||
return false;
|
||||
vkd3d_shader_parser_init(&sm4->p, program, message_context, compile_info->source_name);
|
||||
sm4->ptr = sm4->start;
|
||||
|
@ -1411,9 +1411,9 @@ enum vsir_control_flow_type
|
||||
|
||||
enum vsir_normalisation_level
|
||||
{
|
||||
VSIR_NOT_NORMALISED,
|
||||
VSIR_NORMALISED_SM4,
|
||||
VSIR_NORMALISED_HULL_CONTROL_POINT_IO,
|
||||
VSIR_FULLY_NORMALISED_IO,
|
||||
VSIR_NORMALISED_SM6,
|
||||
};
|
||||
|
||||
struct vsir_program
|
||||
|
Loading…
x
Reference in New Issue
Block a user