vkd3d-shader/fx: Correct one of the object counters in the fx_2_0 header.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-07-11 14:02:31 +02:00 committed by Henri Verbeet
parent 97cd941710
commit 91dce79227
Notes: Henri Verbeet 2024-07-24 16:15:38 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/951

View File

@ -145,7 +145,6 @@ struct fx_write_context
unsigned int max_technique_version; unsigned int max_technique_version;
uint32_t technique_count; uint32_t technique_count;
uint32_t pass_count;
uint32_t group_count; uint32_t group_count;
uint32_t buffer_count; uint32_t buffer_count;
uint32_t shared_buffer_count; uint32_t shared_buffer_count;
@ -194,7 +193,6 @@ static void write_pass(struct hlsl_ir_var *var, struct fx_write_context *fx)
hlsl_fixme(fx->ctx, &var->loc, "Write pass assignments."); hlsl_fixme(fx->ctx, &var->loc, "Write pass assignments.");
fx->ops->write_pass(var, fx); fx->ops->write_pass(var, fx);
++fx->pass_count;
} }
static uint32_t write_annotations(struct hlsl_scope *scope, struct fx_write_context *fx) static uint32_t write_annotations(struct hlsl_scope *scope, struct fx_write_context *fx)
@ -399,6 +397,9 @@ static void write_fx_2_pass(struct hlsl_ir_var *var, struct fx_write_context *fx
/* TODO: annotations */ /* TODO: annotations */
/* TODO: assignments */ /* TODO: assignments */
/* For some reason every pass adds to the total shader object count. */
fx->shader_count++;
} }
static uint32_t get_fx_4_type_size(const struct hlsl_type *type) static uint32_t get_fx_4_type_size(const struct hlsl_type *type)
@ -854,6 +855,10 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n
case HLSL_CLASS_STRUCT: case HLSL_CLASS_STRUCT:
put_u32(buffer, type->e.record.field_count); put_u32(buffer, type->e.record.field_count);
break; break;
case HLSL_CLASS_VERTEX_SHADER:
case HLSL_CLASS_PIXEL_SHADER:
fx->shader_count += elements_count;
break;
default: default:
; ;
} }
@ -1065,7 +1070,7 @@ 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) static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
{ {
uint32_t offset, size, technique_count, pass_count, parameter_count, object_count; uint32_t offset, size, technique_count, shader_count, parameter_count, object_count;
struct vkd3d_bytecode_buffer buffer = { 0 }; struct vkd3d_bytecode_buffer buffer = { 0 };
struct vkd3d_bytecode_buffer *structured; struct vkd3d_bytecode_buffer *structured;
struct fx_write_context fx; struct fx_write_context fx;
@ -1082,7 +1087,7 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
parameter_count = put_u32(structured, 0); /* Parameter count */ parameter_count = put_u32(structured, 0); /* Parameter count */
technique_count = put_u32(structured, 0); technique_count = put_u32(structured, 0);
pass_count = put_u32(structured, 0); shader_count = put_u32(structured, 0);
object_count = put_u32(structured, 0); object_count = put_u32(structured, 0);
write_fx_2_parameters(&fx); write_fx_2_parameters(&fx);
@ -1091,7 +1096,7 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
write_techniques(ctx->globals, &fx); write_techniques(ctx->globals, &fx);
set_u32(structured, technique_count, fx.technique_count); set_u32(structured, technique_count, fx.technique_count);
set_u32(structured, pass_count, fx.pass_count); set_u32(structured, shader_count, fx.shader_count);
put_u32(structured, 0); /* String count */ put_u32(structured, 0); /* String count */
put_u32(structured, 0); /* Resource count */ put_u32(structured, 0); /* Resource count */