mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Don't lower integer MOD and DIV on const passes for d3dbc target profiles.
These bitwise operations are not available in these profiles.
This commit is contained in:
committed by
Henri Verbeet
parent
e3923876c0
commit
828afe188c
Notes:
Henri Verbeet
2025-03-18 16:03:46 +01:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1427
@@ -4222,7 +4222,7 @@ struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct hlsl_bloc
|
||||
return hlsl_block_add_expr(ctx, instrs, HLSL_OP3_TERNARY, operands, if_true->data_type, &condition->loc);
|
||||
}
|
||||
|
||||
static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
static bool lower_int_division_sm4(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
{
|
||||
struct hlsl_ir_node *arg1, *arg2, *xor, *and, *abs1, *abs2, *div, *neg, *cast1, *cast2, *cast3, *high_bit;
|
||||
struct hlsl_type *type = instr->data_type, *utype;
|
||||
@@ -4262,7 +4262,7 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
return hlsl_add_conditional(ctx, block, and, neg, cast3);
|
||||
}
|
||||
|
||||
static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
static bool lower_int_modulus_sm4(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
{
|
||||
struct hlsl_ir_node *arg1, *arg2, *and, *abs1, *abs2, *div, *neg, *cast1, *cast2, *cast3, *high_bit;
|
||||
struct hlsl_type *type = instr->data_type, *utype;
|
||||
@@ -7067,8 +7067,11 @@ void hlsl_run_const_passes(struct hlsl_ctx *ctx, struct hlsl_block *body)
|
||||
|
||||
lower_ir(ctx, lower_narrowing_casts, body);
|
||||
lower_ir(ctx, lower_int_dot, body);
|
||||
lower_ir(ctx, lower_int_division, body);
|
||||
lower_ir(ctx, lower_int_modulus, body);
|
||||
if (hlsl_version_ge(ctx, 4, 0))
|
||||
{
|
||||
lower_ir(ctx, lower_int_modulus_sm4, body);
|
||||
lower_ir(ctx, lower_int_division_sm4, body);
|
||||
}
|
||||
lower_ir(ctx, lower_int_abs, body);
|
||||
lower_ir(ctx, lower_casts_to_bool, body);
|
||||
lower_ir(ctx, lower_float_modulus, body);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[pixel shader todo(sm<4)]
|
||||
[pixel shader]
|
||||
uniform float2 a;
|
||||
|
||||
float4 main() : SV_TARGET
|
||||
@@ -10,7 +10,7 @@ float4 main() : SV_TARGET
|
||||
|
||||
[test]
|
||||
uniform 0 float4 5.0 16.0 0.0 0.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
todo(glsl | msl) draw quad
|
||||
probe (0, 0) rgba (21.0, -11.0, 80.0, 0.0)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
@@ -28,7 +28,7 @@ uniform 0 float4 5.0 16.0 0.0 0.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
probe (0, 0) rgba (5.0, 5.0, -5.0, 3.0)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
[pixel shader]
|
||||
uniform float2 a;
|
||||
|
||||
float4 main() : SV_TARGET
|
||||
@@ -40,7 +40,7 @@ float4 main() : SV_TARGET
|
||||
|
||||
[test]
|
||||
uniform 0 float4 42.0 5.0 0.0 0.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
todo(glsl | msl) draw quad
|
||||
probe (0, 0) rgba (8.0, -8.0, -8.0, 8.0)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
@@ -58,7 +58,7 @@ uniform 0 float4 42.0 5.0 0.0 0.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
probe (0, 0) rgba (2.0, -2.0, 2.0, -2.0)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
[pixel shader]
|
||||
uniform float2 a;
|
||||
|
||||
float4 main() : SV_TARGET
|
||||
@@ -70,7 +70,7 @@ float4 main() : SV_TARGET
|
||||
|
||||
[test]
|
||||
uniform 0 float4 45.0 5.0 0.0 0.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
todo(glsl | msl) draw quad
|
||||
probe (0, 0) rgba (9.0, -9.0, -9.0, 9.0)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
@@ -137,7 +137,7 @@ todo(sm<4 | glsl | msl) draw quad
|
||||
if(sm<4) probe (0, 0) rgba(6, 6, -6, -6)
|
||||
if(sm>=4) probe (0, 0) rgba(7, 7, -7, -7)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
[pixel shader]
|
||||
float f;
|
||||
|
||||
float4 main() : sv_target
|
||||
@@ -150,11 +150,11 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float 999.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
todo(glsl | msl) draw quad
|
||||
if(sm<4) probe (0, 0) rgba(16798, -16798, -16798, 16798)
|
||||
if(sm>=4) probe (0, 0) rgba(16799, -16799, -16799, 16799)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
[pixel shader]
|
||||
float f;
|
||||
|
||||
float4 main() : sv_target
|
||||
@@ -167,7 +167,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float 999.0
|
||||
todo(sm<4 | glsl | msl) draw quad
|
||||
todo(glsl | msl) draw quad
|
||||
probe (0, 0) rgba(16798, -16798, -16798, 16798)
|
||||
|
||||
[require]
|
||||
|
Reference in New Issue
Block a user