vkd3d-shader/d3dbc: Write the actual constant info offset in write_sm1_uniforms().

This commit is contained in:
Henri Verbeet 2024-09-17 13:14:34 +02:00
parent ee8e005209
commit 1e97e1203f
Notes: Henri Verbeet 2024-09-23 15:56:40 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1098

View File

@ -1721,7 +1721,7 @@ static void sm1_sort_externs(struct hlsl_ctx *ctx)
void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer) void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer)
{ {
size_t ctab_offset, ctab_start, ctab_end, vars_start, size_offset, creator_offset, offset; size_t ctab_offset, ctab_start, ctab_end, vars_offset, vars_start, size_offset, creator_offset, offset;
unsigned int uniform_count = 0; unsigned int uniform_count = 0;
struct hlsl_ir_var *var; struct hlsl_ir_var *var;
@ -1757,11 +1757,12 @@ void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buff
creator_offset = put_u32(buffer, 0); creator_offset = put_u32(buffer, 0);
put_u32(buffer, sm1_version(ctx->profile->type, ctx->profile->major_version, ctx->profile->minor_version)); put_u32(buffer, sm1_version(ctx->profile->type, ctx->profile->major_version, ctx->profile->minor_version));
put_u32(buffer, uniform_count); put_u32(buffer, uniform_count);
put_u32(buffer, sizeof(D3DXSHADER_CONSTANTTABLE)); /* offset of constants */ vars_offset = put_u32(buffer, 0);
put_u32(buffer, 0); /* FIXME: flags */ put_u32(buffer, 0); /* FIXME: flags */
put_u32(buffer, 0); /* FIXME: target string */ put_u32(buffer, 0); /* FIXME: target string */
vars_start = bytecode_align(buffer); vars_start = bytecode_align(buffer);
set_u32(buffer, vars_offset, vars_start - ctab_start);
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
{ {