From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index fdf132e9e..426826e3d 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -61,7 +61,6 @@ struct fx_write_context; struct fx_write_context_ops { uint32_t (*write_string)(const char *string, struct fx_write_context *fx); - uint32_t (*write_type)(const struct hlsl_type *type, struct fx_write_context *fx); void (*write_technique)(struct hlsl_ir_var *var, struct fx_write_context *fx); void (*write_pass)(struct hlsl_ir_var *var, struct fx_write_context *fx); bool are_child_effects_supported; @@ -112,12 +111,16 @@ static void write_pass(struct hlsl_ir_var *var, struct fx_write_context *fx) fx->ops->write_pass(var, fx); }
+static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_context *fx); + static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context *fx) { struct type_entry *type_entry; unsigned int elements_count; const char *name;
+ assert(fx->ctx->profile->major_version >= 4); + if (type->class == HLSL_CLASS_ARRAY) { name = hlsl_get_multiarray_element_type(type)->name; @@ -143,7 +146,7 @@ static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context if (!(type_entry = hlsl_alloc(fx->ctx, sizeof(*type_entry)))) return 0;
- type_entry->offset = fx->ops->write_type(type, fx); + type_entry->offset = write_fx_4_type(type, fx); type_entry->name = name; type_entry->elements_count = elements_count;
@@ -692,7 +695,6 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) static const struct fx_write_context_ops fx_4_ops = { .write_string = write_fx_4_string, - .write_type = write_fx_4_type, .write_technique = write_fx_4_technique, .write_pass = write_fx_4_pass, .are_child_effects_supported = true,
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 166 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 163 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 426826e3d..546903707 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -86,6 +86,7 @@ struct fx_write_context uint32_t object_variable_count; uint32_t shared_object_count; uint32_t shader_variable_count; + uint32_t parameter_count; int status;
bool child_effect; @@ -607,6 +608,93 @@ static uint32_t write_fx_2_string(const char *string, struct fx_write_context *f return offset; }
+static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *name, const struct hlsl_semantic *semantic, + struct fx_write_context *fx) +{ + struct vkd3d_bytecode_buffer *buffer = &fx->unstructured; + uint32_t semantic_offset, offset, elements_count = 0, name_offset; + uint32_t class; + static const uint32_t param_class[] = + { + [HLSL_CLASS_SCALAR] = D3DXPC_SCALAR, + [HLSL_CLASS_VECTOR] = D3DXPC_VECTOR, + [HLSL_CLASS_MATRIX] = D3DXPC_MATRIX_COLUMNS, + [HLSL_CLASS_OBJECT] = D3DXPC_OBJECT, + [HLSL_CLASS_STRUCT] = D3DXPC_STRUCT, + }; + static const uint32_t param_type[] = + { + [HLSL_TYPE_BOOL] = D3DXPT_BOOL, + [HLSL_TYPE_INT] = D3DXPT_INT, + [HLSL_TYPE_FLOAT] = D3DXPT_FLOAT, + [HLSL_TYPE_VOID] = D3DXPT_VOID, + }; + size_t i; + + /* Resolve arrays to element type and number of elements. */ + if (type->class == HLSL_CLASS_ARRAY) + { + elements_count = hlsl_get_multiarray_size(type); + type = hlsl_get_multiarray_element_type(type); + } + + name_offset = write_string(name, fx); + semantic_offset = write_string(semantic->name, fx); + + if (type->class == HLSL_CLASS_MATRIX && hlsl_type_is_row_major(type)) + class = D3DXPC_MATRIX_ROWS; + else + class = param_class[type->class]; + + switch (type->base_type) + { + case HLSL_TYPE_FLOAT: + case HLSL_TYPE_BOOL: + case HLSL_TYPE_INT: + case HLSL_TYPE_VOID: + break; + default: + FIXME("Type %u is not supported.\n", type->base_type); + set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); + return 0; + }; + + offset = put_u32(buffer, param_type[type->base_type]); + put_u32(buffer, class); + put_u32(buffer, name_offset); + put_u32(buffer, semantic_offset); + put_u32(buffer, elements_count); + + switch (type->class) + { + case HLSL_CLASS_VECTOR: + put_u32(buffer, type->dimx); + put_u32(buffer, type->dimy); + break; + case HLSL_CLASS_SCALAR: + case HLSL_CLASS_MATRIX: + put_u32(buffer, type->dimy); + put_u32(buffer, type->dimx); + break; + case HLSL_CLASS_STRUCT: + put_u32(buffer, type->e.record.field_count); + break; + default: + ; + } + + if (type->class == HLSL_CLASS_STRUCT) + { + for (i = 0; i < type->e.record.field_count; ++i) + { + const struct hlsl_struct_field *field = &type->e.record.fields[i]; + write_fx_2_parameter(field->type, field->name, &field->semantic, fx); + } + } + + return offset; +} + static void write_fx_2_technique(struct hlsl_ir_var *var, struct fx_write_context *fx) { struct vkd3d_bytecode_buffer *buffer = &fx->structured; @@ -629,6 +717,77 @@ static void write_fx_2_technique(struct hlsl_ir_var *var, struct fx_write_contex set_u32(buffer, count_offset, count); }
+static uint32_t get_fx_2_type_size(const struct hlsl_type *type) +{ + uint32_t size = 0; + size_t i; + + if (type->class == HLSL_CLASS_STRUCT) + { + for (i = 0; i < type->e.record.field_count; ++i) + { + const struct hlsl_struct_field *field = &type->e.record.fields[i]; + size += get_fx_2_type_size(field->type); + } + + return size; + } + + return type->dimx * type->dimy * sizeof(float); +} + +static uint32_t write_fx_2_initial_value(const struct hlsl_ir_var *var, struct fx_write_context *fx) +{ + struct vkd3d_bytecode_buffer *buffer = &fx->unstructured; + const struct hlsl_type *type = var->data_type; + uint32_t i, offset, size, elements_count; + + if (type->class == HLSL_CLASS_ARRAY) + { + elements_count = hlsl_get_multiarray_size(type); + type = hlsl_get_multiarray_element_type(type); + } + else + { + elements_count = 1; + } + + size = get_fx_2_type_size(type) * elements_count; + + /* FIXME: write actual initial value */ + offset = put_u32(buffer, 0); + + for (i = 1; i < size / sizeof(uint32_t); ++i) + put_u32(buffer, 0); + + return offset; +} + +static void write_fx_2_parameters(struct fx_write_context *fx) +{ + struct vkd3d_bytecode_buffer *buffer = &fx->structured; + uint32_t desc_offset, value_offset; + struct hlsl_ir_var *var; + + LIST_FOR_EACH_ENTRY(var, &fx->ctx->globals->vars, struct hlsl_ir_var, scope_entry) + { + if (var->data_type->class == HLSL_CLASS_OBJECT) + continue; + + desc_offset = write_fx_2_parameter(var->data_type, var->name, &var->semantic, fx); + value_offset = write_fx_2_initial_value(var, fx); + + put_u32(buffer, desc_offset); /* Parameter description */ + put_u32(buffer, value_offset); /* Value */ + put_u32(buffer, 0); /* Flags */ + + put_u32(buffer, 0); /* Annotations count */ + /* FIXME: write annotations */ + + ++fx->parameter_count; + } +} + static const struct fx_write_context_ops fx_2_ops = { .write_string = write_fx_2_string, @@ -638,9 +797,9 @@ static const struct fx_write_context_ops fx_2_ops =
static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) { + uint32_t offset, size, technique_count, parameter_count; struct vkd3d_bytecode_buffer buffer = { 0 }; struct vkd3d_bytecode_buffer *structured; - uint32_t offset, size, technique_count; struct fx_write_context fx;
fx_write_context_init(ctx, &fx_2_ops, &fx); @@ -652,12 +811,13 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) put_u32(&buffer, 0xfeff0901); /* Version. */ offset = put_u32(&buffer, 0);
- put_u32(structured, 0); /* Parameter count */ + parameter_count = put_u32(structured, 0); /* Parameter count */ technique_count = put_u32(structured, 0); put_u32(structured, 0); /* Unknown */ put_u32(structured, 0); /* Object count */
- /* TODO: parameters */ + write_fx_2_parameters(&fx); + set_u32(structured, parameter_count, fx.parameter_count);
write_techniques(ctx->globals, &fx); set_u32(structured, technique_count, fx.technique_count);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 546903707..da57d7b61 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -600,11 +600,15 @@ static uint32_t write_fx_2_string(const char *string, struct fx_write_context *f { struct vkd3d_bytecode_buffer *buffer = &fx->unstructured; const char *s = string ? string : ""; + static const char tail[3]; uint32_t size, offset;
size = strlen(s) + 1; offset = put_u32(buffer, size); bytecode_put_bytes(buffer, s, size); + size %= 4; + if (size) + bytecode_put_bytes_unaligned(buffer, tail, 4 - size); return offset; }
From: Nikolay Sivov nsivov@codeweavers.com
This is used for the object table at runtime. Object variable index is 1-based.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index da57d7b61..fd7daaaf0 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -801,12 +801,13 @@ static const struct fx_write_context_ops fx_2_ops =
static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) { - uint32_t offset, size, technique_count, parameter_count; + uint32_t offset, size, technique_count, parameter_count, object_count; struct vkd3d_bytecode_buffer buffer = { 0 }; struct vkd3d_bytecode_buffer *structured; struct fx_write_context fx;
fx_write_context_init(ctx, &fx_2_ops, &fx); + fx.object_variable_count = 1; structured = &fx.structured;
/* First entry is always zeroed and skipped. */ @@ -818,10 +819,11 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) parameter_count = put_u32(structured, 0); /* Parameter count */ technique_count = put_u32(structured, 0); put_u32(structured, 0); /* Unknown */ - put_u32(structured, 0); /* Object count */ + object_count = put_u32(structured, 0);
write_fx_2_parameters(&fx); set_u32(structured, parameter_count, fx.parameter_count); + set_u32(structured, object_count, fx.object_variable_count);
write_techniques(ctx->globals, &fx); set_u32(structured, technique_count, fx.technique_count);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 84 ++++++++++++++----- .../effect-shader-objects-fx_2.shader_test | 2 +- 2 files changed, 65 insertions(+), 21 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index fd7daaaf0..56561f6ed 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -160,6 +160,7 @@ static void fx_write_context_init(struct hlsl_ctx *ctx, const struct fx_write_co struct fx_write_context *fx) { unsigned int version = ctx->profile->major_version; + struct hlsl_block block;
memset(fx, 0, sizeof(*fx));
@@ -185,6 +186,11 @@ static void fx_write_context_init(struct hlsl_ctx *ctx, const struct fx_write_co list_init(&fx->types);
fx->child_effect = fx->ops->are_child_effects_supported && ctx->child_effect; + + hlsl_block_init(&block); + hlsl_prepend_global_uniform_copy(fx->ctx, &block); + hlsl_block_init(&block); + hlsl_calculate_buffer_offsets(fx->ctx); }
static int fx_write_context_cleanup(struct fx_write_context *fx) @@ -617,7 +623,8 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n { struct vkd3d_bytecode_buffer *buffer = &fx->unstructured; uint32_t semantic_offset, offset, elements_count = 0, name_offset; - uint32_t class; + struct hlsl_ctx *ctx = fx->ctx; + uint32_t class, type_value; static const uint32_t param_class[] = { [HLSL_CLASS_SCALAR] = D3DXPC_SCALAR, @@ -633,6 +640,14 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n [HLSL_TYPE_FLOAT] = D3DXPT_FLOAT, [HLSL_TYPE_VOID] = D3DXPT_VOID, }; + static const uint32_t param_texture_type[] = + { + [HLSL_SAMPLER_DIM_GENERIC] = D3DXPT_TEXTURE, + [HLSL_SAMPLER_DIM_1D] = D3DXPT_TEXTURE1D, + [HLSL_SAMPLER_DIM_2D] = D3DXPT_TEXTURE2D, + [HLSL_SAMPLER_DIM_3D] = D3DXPT_TEXTURE3D, + [HLSL_SAMPLER_DIM_CUBE] = D3DXPT_TEXTURECUBE, + }; size_t i;
/* Resolve arrays to element type and number of elements. */ @@ -656,6 +671,22 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n case HLSL_TYPE_BOOL: case HLSL_TYPE_INT: case HLSL_TYPE_VOID: + type_value = param_type[type->base_type]; + break; + case HLSL_TYPE_TEXTURE: + switch (type->sampler_dim) + { + case HLSL_SAMPLER_DIM_GENERIC: + case HLSL_SAMPLER_DIM_1D: + case HLSL_SAMPLER_DIM_2D: + case HLSL_SAMPLER_DIM_3D: + case HLSL_SAMPLER_DIM_CUBE: + type_value = param_texture_type[type->sampler_dim]; + break; + default: + hlsl_fixme(ctx, &ctx->location, "Unexpected sampler dim %u.\n", type->sampler_dim); + return 0; + } break; default: FIXME("Type %u is not supported.\n", type->base_type); @@ -663,7 +694,7 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n return 0; };
- offset = put_u32(buffer, param_type[type->base_type]); + offset = put_u32(buffer, type_value); put_u32(buffer, class); put_u32(buffer, name_offset); put_u32(buffer, semantic_offset); @@ -744,7 +775,9 @@ static uint32_t write_fx_2_initial_value(const struct hlsl_ir_var *var, struct f { struct vkd3d_bytecode_buffer *buffer = &fx->unstructured; const struct hlsl_type *type = var->data_type; - uint32_t i, offset, size, elements_count; + uint32_t value_offset = 0, offset, size, elements_count; + struct hlsl_ctx *ctx = fx->ctx; + uint32_t i, j;
if (type->class == HLSL_CLASS_ARRAY) { @@ -756,15 +789,35 @@ static uint32_t write_fx_2_initial_value(const struct hlsl_ir_var *var, struct f elements_count = 1; }
- size = get_fx_2_type_size(type) * elements_count; + size = get_fx_2_type_size(type);
- /* FIXME: write actual initial value */ - offset = put_u32(buffer, 0); - - for (i = 1; i < size / sizeof(uint32_t); ++i) - put_u32(buffer, 0); + for (i = 0; i < elements_count; ++i) + { + if (type->class == HLSL_CLASS_OBJECT) + { + switch (type->base_type) + { + case HLSL_TYPE_TEXTURE: + offset = put_u32(buffer, fx->object_variable_count++); + if (!value_offset) value_offset = offset; + break; + default: + hlsl_fixme(ctx, &ctx->location, "Writing initializer for object type %u is not implemented.\n", + type->base_type); + } + } + else + { + /* FIXME: write actual initial value */ + for (j = 0; j < size / sizeof(uint32_t); ++j) + { + offset = put_u32(buffer, 0); + if (!value_offset) value_offset = offset; + } + } + }
- return offset; + return value_offset; }
static void write_fx_2_parameters(struct fx_write_context *fx) @@ -773,11 +826,8 @@ static void write_fx_2_parameters(struct fx_write_context *fx) uint32_t desc_offset, value_offset; struct hlsl_ir_var *var;
- LIST_FOR_EACH_ENTRY(var, &fx->ctx->globals->vars, struct hlsl_ir_var, scope_entry) + LIST_FOR_EACH_ENTRY(var, &fx->ctx->extern_vars, struct hlsl_ir_var, extern_entry) { - if (var->data_type->class == HLSL_CLASS_OBJECT) - continue; - desc_offset = write_fx_2_parameter(var->data_type, var->name, &var->semantic, fx); value_offset = write_fx_2_initial_value(var, fx);
@@ -1002,12 +1052,6 @@ static void write_fx_4_buffer(struct hlsl_buffer *b, struct fx_write_context *fx static void write_buffers(struct fx_write_context *fx) { struct hlsl_buffer *buffer; - struct hlsl_block block; - - hlsl_block_init(&block); - hlsl_prepend_global_uniform_copy(fx->ctx, &block); - hlsl_block_init(&block); - hlsl_calculate_buffer_offsets(fx->ctx);
LIST_FOR_EACH_ENTRY(buffer, &fx->ctx->buffers, struct hlsl_buffer, entry) { diff --git a/tests/hlsl/effect-shader-objects-fx_2.shader_test b/tests/hlsl/effect-shader-objects-fx_2.shader_test index 7c6a8947a..8801ed1f7 100644 --- a/tests/hlsl/effect-shader-objects-fx_2.shader_test +++ b/tests/hlsl/effect-shader-objects-fx_2.shader_test @@ -26,7 +26,7 @@ float4 main() : sv_target return 0; }
-[effect] +[effect todo] vertexshader vs1; verteXshadeR vs2; pixelshader ps1;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/fx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 56561f6ed..1e925f63f 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -689,8 +689,7 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n } break; default: - FIXME("Type %u is not supported.\n", type->base_type); - set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); + hlsl_fixme(ctx, &ctx->location, "Type %u is not supported.\n", type->base_type); return 0; };
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
- uint32_t class;
- static const uint32_t param_class[] =
- {
[HLSL_CLASS_SCALAR] = D3DXPC_SCALAR,
[HLSL_CLASS_VECTOR] = D3DXPC_VECTOR,
[HLSL_CLASS_MATRIX] = D3DXPC_MATRIX_COLUMNS,
[HLSL_CLASS_OBJECT] = D3DXPC_OBJECT,
[HLSL_CLASS_STRUCT] = D3DXPC_STRUCT,
- };
- static const uint32_t param_type[] =
- {
[HLSL_TYPE_BOOL] = D3DXPT_BOOL,
[HLSL_TYPE_INT] = D3DXPT_INT,
[HLSL_TYPE_FLOAT] = D3DXPT_FLOAT,
[HLSL_TYPE_VOID] = D3DXPT_VOID,
- };
This could reuse the existing helpers in d3dbc.c...
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
set_u32(buffer, count_offset, count);
}
+static uint32_t get_fx_2_type_size(const struct hlsl_type *type)
Why not handle arrays inside of this function?
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
- {
elements_count = hlsl_get_multiarray_size(type);
type = hlsl_get_multiarray_element_type(type);
- }
- else
- {
elements_count = 1;
- }
- size = get_fx_2_type_size(type) * elements_count;
- /* FIXME: write actual initial value */
- offset = put_u32(buffer, 0);
- for (i = 1; i < size / sizeof(uint32_t); ++i)
put_u32(buffer, 0);
This kind of thing bothers me. I know we can't reach here without already hitting an earlier hlsl_fixme(), but it seems too easy to fix that case and forget about this one. Yeah, I know d3dbc does the same thing.
I suppose I may just have to live with it.
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
- /* FIXME: write actual initial value */
- offset = put_u32(buffer, 0);
- for (i = 1; i < size / sizeof(uint32_t); ++i)
put_u32(buffer, 0);
- return offset;
+}
+static void write_fx_2_parameters(struct fx_write_context *fx) +{
- struct vkd3d_bytecode_buffer *buffer = &fx->structured;
- uint32_t desc_offset, value_offset;
- struct hlsl_ir_var *var;
- LIST_FOR_EACH_ENTRY(var, &fx->ctx->globals->vars, struct hlsl_ir_var, scope_entry)
extern_vars?
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
- struct hlsl_ir_var *var;
- LIST_FOR_EACH_ENTRY(var, &fx->ctx->globals->vars, struct hlsl_ir_var, scope_entry)
- {
if (var->data_type->class == HLSL_CLASS_OBJECT)
continue;
desc_offset = write_fx_2_parameter(var->data_type, var->name, &var->semantic, fx);
value_offset = write_fx_2_initial_value(var, fx);
put_u32(buffer, desc_offset); /* Parameter description */
put_u32(buffer, value_offset); /* Value */
put_u32(buffer, 0); /* Flags */
put_u32(buffer, 0); /* Annotations count */
/* FIXME: write annotations */
This is an even worse case, because if I'm not mistaken we can write zero annotations and succeed even when there should be some. I know it's part of the initial fx bringup, and there's other similar problems, but at least in this case it seems easy enough to replace the single "FIXME" comment with something like "if (!list_empty(var->annotations->vars)) hlsl_fixme(...)", and that would avoid that problem.
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
list_init(&fx->types); fx->child_effect = fx->ops->are_child_effects_supported && ctx->child_effect;
- hlsl_block_init(&block);
- hlsl_prepend_global_uniform_copy(fx->ctx, &block);
- hlsl_block_init(&block);
I missed when this was done before, but this looks wrong (for one, it's generating instructions that get thrown away, and in fact leaked; for two, the block is subsequently initialized but never used). What's the intent here?
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/fx.c:
uint32_t desc_offset, value_offset; struct hlsl_ir_var *var;
- LIST_FOR_EACH_ENTRY(var, &fx->ctx->globals->vars, struct hlsl_ir_var, scope_entry)
- LIST_FOR_EACH_ENTRY(var, &fx->ctx->extern_vars, struct hlsl_ir_var, extern_entry) {
if (var->data_type->class == HLSL_CLASS_OBJECT)
continue;
This belongs in an earlier patch.
On Wed Mar 13 19:53:49 2024 +0000, Zebediah Figura wrote:
I missed when this was done before, but this looks wrong (for one, it's generating instructions that get thrown away, and in fact leaked; for two, the block is subsequently initialized but never used). What's the intent here?
The intent is to populate extern_vars. Yes, second _init() should've been _cleanup().