mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Implement broadcasts in constant folding.
Normally lower_broadcasts() takes care of this, but loop unrolling executes before other constant passes.
This commit is contained in:
parent
9065a1ee23
commit
d049ea640f
Notes:
Henri Verbeet
2025-01-27 15:04:24 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1349
@ -148,15 +148,7 @@ static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst,
|
||||
float f = 0.0f;
|
||||
int32_t i = 0;
|
||||
|
||||
if (dst_type->e.numeric.dimx != src->node.data_type->e.numeric.dimx
|
||||
|| dst_type->e.numeric.dimy != src->node.data_type->e.numeric.dimy)
|
||||
{
|
||||
FIXME("Cast from %s to %s.\n", debug_hlsl_type(ctx, src->node.data_type),
|
||||
debug_hlsl_type(ctx, dst_type));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (k = 0; k < dst_type->e.numeric.dimx; ++k)
|
||||
for (k = 0; k < src->node.data_type->e.numeric.dimx; ++k)
|
||||
{
|
||||
switch (src->node.data_type->e.numeric.type)
|
||||
{
|
||||
@ -221,6 +213,13 @@ static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (src->node.data_type->e.numeric.dimx == 1)
|
||||
{
|
||||
for (k = 1; k < dst_type->e.numeric.dimx; ++k)
|
||||
dst->u[k] = dst->u[0];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ float4 main() : sv_target
|
||||
draw quad
|
||||
probe (0,0) rgba(1337.0, 0, 0, 0)
|
||||
|
||||
[pixel shader todo(sm<6)]
|
||||
[pixel shader]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
float i = 0;
|
||||
@ -79,5 +79,5 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo(sm<6) draw quad
|
||||
draw quad
|
||||
probe (0,0) rgba(0, 0, 0, 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user