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.
This commit is contained in:
Francisco Casas 2024-02-20 22:06:45 -03:00 committed by Alexandre Julliard
parent 747511131d
commit 58c456ff2b
Notes: Alexandre Julliard 2024-03-06 23:29:16 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/671
3 changed files with 6 additions and 9 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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)