Module: vkd3d Branch: master Commit: 58c456ff2bec9c413b23d898f15808316f25c69f URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/58c456ff2bec9c413b23d898f15808...
Author: Francisco Casas fcasas@codeweavers.com Date: Tue Feb 20 22:06:45 2024 -0300
vkd3d-shader/d3dbc: Implement bool to float cast as MOV.
In SM1, bools are always represented as either 0.0f or 1.0f at runtime.
---
libs/vkd3d-shader/d3dbc.c | 7 ++----- tests/hlsl/cast-to-float.shader_test | 4 ++-- tests/hlsl/cast-to-half.shader_test | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 0f5d34ee..a8cca17f 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1977,16 +1977,13 @@ static void write_sm1_cast(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b { case HLSL_TYPE_INT: case HLSL_TYPE_UINT: - /* Integers are internally represented as floats, so no change is necessary.*/ + case HLSL_TYPE_BOOL: + /* Integrals are internally represented as floats, so no change is necessary.*/ case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: write_sm1_unary_op(ctx, buffer, D3DSIO_MOV, &instr->reg, &arg1->reg, 0, 0); break;
- case HLSL_TYPE_BOOL: - hlsl_fixme(ctx, &instr->loc, "SM1 cast from bool to float."); - break; - case HLSL_TYPE_DOUBLE: hlsl_fixme(ctx, &instr->loc, "SM1 cast from double to float."); break; diff --git a/tests/hlsl/cast-to-float.shader_test b/tests/hlsl/cast-to-float.shader_test index bcb546e2..d80d4290 100644 --- a/tests/hlsl/cast-to-float.shader_test +++ b/tests/hlsl/cast-to-float.shader_test @@ -1,4 +1,4 @@ -[pixel shader todo(sm<4)] +[pixel shader] uniform int i; uniform uint u; uniform bool b; @@ -18,7 +18,7 @@ if(sm>=4) uniform 0 int -1 if(sm>=4) uniform 1 uint 3 if(sm>=4) uniform 2 int -2 if(sm>=4) uniform 3 float 0.5 -todo(sm<4) draw quad +draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)
diff --git a/tests/hlsl/cast-to-half.shader_test b/tests/hlsl/cast-to-half.shader_test index 0580fe25..8094a10a 100644 --- a/tests/hlsl/cast-to-half.shader_test +++ b/tests/hlsl/cast-to-half.shader_test @@ -1,4 +1,4 @@ -[pixel shader todo(sm<4)] +[pixel shader] uniform int i; uniform uint u; uniform bool b; @@ -18,7 +18,7 @@ if(sm>=4) uniform 0 int -1 if(sm>=4) uniform 1 uint 3 if(sm>=4) uniform 2 int -2 if(sm>=4) uniform 3 float 0.5 -todo(sm<4) draw quad +draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)