mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d-shader/tpf: Write default values for SM4.
This commit is contained in:
parent
b44a25ce19
commit
253c994155
Notes:
Henri Verbeet
2024-06-11 16:55:09 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/787
@ -1744,6 +1744,8 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe
|
||||
}
|
||||
put_u32(buffer, 0); /* type */
|
||||
put_u32(buffer, 0); /* FIXME: default value */
|
||||
if (var->default_values)
|
||||
FIXME("Write SM1 default values.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3522,7 +3522,7 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||
put_u32(&buffer, var->data_type->reg_size[HLSL_REGSET_NUMERIC] * sizeof(float));
|
||||
put_u32(&buffer, flags);
|
||||
put_u32(&buffer, 0); /* type */
|
||||
put_u32(&buffer, 0); /* FIXME: default value */
|
||||
put_u32(&buffer, 0); /* default value */
|
||||
|
||||
if (profile->major_version >= 5)
|
||||
{
|
||||
@ -3546,6 +3546,34 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||
set_u32(&buffer, var_offset, string_offset);
|
||||
write_sm4_type(ctx, &buffer, var->data_type);
|
||||
set_u32(&buffer, var_offset + 4 * sizeof(uint32_t), var->data_type->bytecode_offset);
|
||||
|
||||
if (var->default_values)
|
||||
{
|
||||
unsigned int reg_size = var->data_type->reg_size[HLSL_REGSET_NUMERIC];
|
||||
unsigned int comp_count = hlsl_type_component_count(var->data_type);
|
||||
unsigned int default_value_offset;
|
||||
unsigned int k;
|
||||
|
||||
default_value_offset = bytecode_reserve_bytes(&buffer, reg_size * sizeof(uint32_t));
|
||||
set_u32(&buffer, var_offset + 5 * sizeof(uint32_t), default_value_offset);
|
||||
|
||||
for (k = 0; k < comp_count; ++k)
|
||||
{
|
||||
struct hlsl_type *comp_type = hlsl_type_get_component_type(ctx, var->data_type, k);
|
||||
unsigned int comp_offset;
|
||||
enum hlsl_regset regset;
|
||||
|
||||
comp_offset = hlsl_type_get_component_offset(ctx, var->data_type, k, ®set);
|
||||
if (regset == HLSL_REGSET_NUMERIC)
|
||||
{
|
||||
if (comp_type->e.numeric.type == HLSL_TYPE_DOUBLE)
|
||||
hlsl_fixme(ctx, &var->loc, "Write double default values.");
|
||||
|
||||
set_u32(&buffer, default_value_offset + comp_offset * sizeof(uint32_t),
|
||||
var->default_values[k].value.u);
|
||||
}
|
||||
}
|
||||
}
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
@ -1863,7 +1863,7 @@ static void test_default_values_reflection(void)
|
||||
|
||||
if (expect->var_desc.DefaultValue)
|
||||
{
|
||||
todo ok(var_desc.DefaultValue, "Didn't get default value.\n");
|
||||
ok(var_desc.DefaultValue, "Didn't get default value.\n");
|
||||
|
||||
if (var_desc.DefaultValue && var_desc.Size == expect->var_desc.Size)
|
||||
{
|
||||
@ -1872,7 +1872,7 @@ static void test_default_values_reflection(void)
|
||||
unsigned int var_val = *((unsigned int *)var_desc.DefaultValue + k);
|
||||
unsigned int expect_val = *((unsigned int *)expect->var_desc.DefaultValue + k);
|
||||
|
||||
ok(var_val == expect_val, "Expected default value 0x%08x, but got 0x%08x, at offset %u.\n",
|
||||
todo_if(var_val != expect_val) ok(var_val == expect_val, "Expected default value 0x%08x, but got 0x%08x, at offset %u.\n",
|
||||
expect_val, var_val, 4 * k);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user