From 24c1eb562f1493f60e6e93514b2ef09494cdd43b Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 5 Apr 2023 00:09:55 +0200 Subject: [PATCH] vkd3d-shader/hlsl: Treat half as float for casts. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/hlsl_sm4.c | 5 +---- tests/cast-to-half.shader_test | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c index 8551cfd8..dd95c308 100644 --- a/libs/vkd3d-shader/hlsl_sm4.c +++ b/libs/vkd3d-shader/hlsl_sm4.c @@ -1581,6 +1581,7 @@ static void write_sm4_cast(struct hlsl_ctx *ctx, switch (dst_type->base_type) { + case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: switch (src_type->base_type) { @@ -1662,10 +1663,6 @@ static void write_sm4_cast(struct hlsl_ctx *ctx, } break; - case HLSL_TYPE_HALF: - hlsl_fixme(ctx, &expr->node.loc, "SM4 cast to half."); - break; - case HLSL_TYPE_DOUBLE: hlsl_fixme(ctx, &expr->node.loc, "SM4 cast to double."); break; diff --git a/tests/cast-to-half.shader_test b/tests/cast-to-half.shader_test index e2b66d4b..81d6bc5d 100644 --- a/tests/cast-to-half.shader_test +++ b/tests/cast-to-half.shader_test @@ -1,7 +1,7 @@ [require] shader model >= 4.0 -[pixel shader todo] +[pixel shader] float4 main(uniform int i, uniform uint u, uniform bool b, uniform float f) : sv_target { @@ -13,7 +13,7 @@ uniform 0 int -1 uniform 1 uint 3 uniform 2 int -2 uniform 3 float 0.5 -todo draw quad +draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) [pixel shader]