mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/d3dbc: Add an option to treat doubles as floats.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55448 Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Henri Verbeet
parent
d7def84253
commit
799e6105a4
Notes:
Henri Verbeet
2024-09-23 15:55:06 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1025
@@ -1835,8 +1835,10 @@ void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buff
|
||||
switch (comp_type->e.numeric.type)
|
||||
{
|
||||
case HLSL_TYPE_DOUBLE:
|
||||
hlsl_fixme(ctx, &var->loc, "Write double default values.");
|
||||
uni.u = 0;
|
||||
if (ctx->double_as_float_alias)
|
||||
uni.u = var->default_values[k].number.u;
|
||||
else
|
||||
uni.u = 0;
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_INT:
|
||||
|
@@ -4248,6 +4248,7 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct vkd3d_shader_compil
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY:
|
||||
ctx->semantic_compat_mapping = option->value & VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
||||
ctx->double_as_float_alias = option->value & VKD3D_SHADER_COMPILE_OPTION_DOUBLE_AS_FLOAT_ALIAS;
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT:
|
||||
|
@@ -1091,6 +1091,7 @@ struct hlsl_ctx
|
||||
bool child_effect;
|
||||
bool include_empty_buffers;
|
||||
bool warn_implicit_truncation;
|
||||
bool double_as_float_alias;
|
||||
};
|
||||
|
||||
static inline bool hlsl_version_ge(const struct hlsl_ctx *ctx, unsigned int major, unsigned int minor)
|
||||
|
@@ -6622,7 +6622,13 @@ static bool sm1_generate_vsir_instr_expr_cast(struct hlsl_ctx *ctx,
|
||||
return true;
|
||||
|
||||
case HLSL_TYPE_DOUBLE:
|
||||
hlsl_fixme(ctx, &instr->loc, "SM1 cast from double to float.");
|
||||
if (ctx->double_as_float_alias)
|
||||
{
|
||||
sm1_generate_vsir_instr_expr_single_instr_op(ctx, program, expr, VKD3DSIH_MOV, 0, 0, true);
|
||||
return true;
|
||||
}
|
||||
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"The 'double' type is not supported for the %s profile.", ctx->profile->name);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -6660,7 +6666,22 @@ static bool sm1_generate_vsir_instr_expr_cast(struct hlsl_ctx *ctx,
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_DOUBLE:
|
||||
hlsl_fixme(ctx, &instr->loc, "SM1 cast to double.");
|
||||
switch (src_type->e.numeric.type)
|
||||
{
|
||||
case HLSL_TYPE_FLOAT:
|
||||
if (ctx->double_as_float_alias)
|
||||
{
|
||||
sm1_generate_vsir_instr_expr_single_instr_op(ctx, program, expr, VKD3DSIH_MOV, 0, 0, true);
|
||||
return true;
|
||||
}
|
||||
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"The 'double' type is not supported for the %s profile.", ctx->profile->name);
|
||||
break;
|
||||
|
||||
default:
|
||||
hlsl_fixme(ctx, &instr->loc, "SM1 cast to double.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_BOOL:
|
||||
|
Reference in New Issue
Block a user