diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 3c31cb18..15a518c0 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -145,7 +145,6 @@ struct fx_write_context unsigned int max_technique_version; uint32_t technique_count; - uint32_t pass_count; uint32_t group_count; uint32_t 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."); fx->ops->write_pass(var, fx); - ++fx->pass_count; } 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: 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) @@ -854,6 +855,10 @@ static uint32_t write_fx_2_parameter(const struct hlsl_type *type, const char *n case HLSL_CLASS_STRUCT: put_u32(buffer, type->e.record.field_count); break; + case HLSL_CLASS_VERTEX_SHADER: + case HLSL_CLASS_PIXEL_SHADER: + fx->shader_count += elements_count; + break; 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) { - 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 *structured; 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 */ technique_count = put_u32(structured, 0); - pass_count = put_u32(structured, 0); + shader_count = put_u32(structured, 0); object_count = put_u32(structured, 0); 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); 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); /* Resource count */