mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Parse the saturate() intrinsic.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4ecdd280ac
commit
f0955c164a
@ -87,6 +87,7 @@ vkd3d_shader_tests = \
|
|||||||
tests/preproc-invalid.shader_test \
|
tests/preproc-invalid.shader_test \
|
||||||
tests/preproc-macro.shader_test \
|
tests/preproc-macro.shader_test \
|
||||||
tests/preproc-misc.shader_test \
|
tests/preproc-misc.shader_test \
|
||||||
|
tests/saturate.shader_test \
|
||||||
tests/swizzle-0.shader_test \
|
tests/swizzle-0.shader_test \
|
||||||
tests/swizzle-1.shader_test \
|
tests/swizzle-1.shader_test \
|
||||||
tests/swizzle-2.shader_test \
|
tests/swizzle-2.shader_test \
|
||||||
@ -295,6 +296,7 @@ XFAIL_TESTS = \
|
|||||||
tests/hlsl-vector-indexing-uniform.shader_test \
|
tests/hlsl-vector-indexing-uniform.shader_test \
|
||||||
tests/math.shader_test \
|
tests/math.shader_test \
|
||||||
tests/max.shader_test \
|
tests/max.shader_test \
|
||||||
|
tests/saturate.shader_test \
|
||||||
tests/trigonometry.shader_test \
|
tests/trigonometry.shader_test \
|
||||||
tests/writemask-assignop-1.shader_test
|
tests/writemask-assignop-1.shader_test
|
||||||
endif
|
endif
|
||||||
|
@ -1577,6 +1577,14 @@ static bool intrinsic_max(struct hlsl_ctx *ctx,
|
|||||||
return !!add_expr(ctx, params->instrs, HLSL_OP2_MAX, args, &loc);
|
return !!add_expr(ctx, params->instrs, HLSL_OP2_MAX, args, &loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool intrinsic_saturate(struct hlsl_ctx *ctx,
|
||||||
|
const struct parse_initializer *params, struct vkd3d_shader_location loc)
|
||||||
|
{
|
||||||
|
struct hlsl_ir_node *args[3] = {params->args[0]};
|
||||||
|
|
||||||
|
return !!add_expr(ctx, params->instrs, HLSL_OP1_SAT, args, &loc);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct intrinsic_function
|
static const struct intrinsic_function
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -1588,6 +1596,7 @@ intrinsic_functions[] =
|
|||||||
{
|
{
|
||||||
{"clamp", 3, true, intrinsic_clamp},
|
{"clamp", 3, true, intrinsic_clamp},
|
||||||
{"max", 2, true, intrinsic_max},
|
{"max", 2, true, intrinsic_max},
|
||||||
|
{"saturate", 1, true, intrinsic_saturate},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int intrinsic_function_name_compare(const void *a, const void *b)
|
static int intrinsic_function_name_compare(const void *a, const void *b)
|
||||||
|
10
tests/saturate.shader_test
Normal file
10
tests/saturate.shader_test
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[pixel shader]
|
||||||
|
float4 main(uniform float2 u) : sv_target
|
||||||
|
{
|
||||||
|
return float4(saturate(u), saturate(u.x + 0.5), saturate(-1.2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
uniform 0 float4 0.7 -0.1 0.0 0.0
|
||||||
|
draw quad
|
||||||
|
probe all rgba (0.7, 0.0, 1.0, 0.0)
|
Loading…
Reference in New Issue
Block a user