mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Support log2() intrinsic.
This commit is contained in:
parent
c93dac3620
commit
49b63fbeba
Notes:
Alexandre Julliard
2023-04-13 23:19:56 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/89
@ -122,6 +122,7 @@ vkd3d_shader_tests = \
|
||||
tests/hlsl-vector-indexing.shader_test \
|
||||
tests/hlsl-vector-indexing-uniform.shader_test \
|
||||
tests/lit.shader_test \
|
||||
tests/log.shader_test \
|
||||
tests/logic-operations.shader_test \
|
||||
tests/majority-syntax.shader_test \
|
||||
tests/math.shader_test \
|
||||
|
@ -2843,6 +2843,17 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool intrinsic_log2(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *arg;
|
||||
|
||||
if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
|
||||
return false;
|
||||
|
||||
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_LOG2, arg, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_max(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@ -3300,6 +3311,7 @@ intrinsic_functions[] =
|
||||
{"length", 1, true, intrinsic_length},
|
||||
{"lerp", 3, true, intrinsic_lerp},
|
||||
{"lit", 3, true, intrinsic_lit},
|
||||
{"log2", 1, true, intrinsic_log2},
|
||||
{"max", 2, true, intrinsic_max},
|
||||
{"min", 2, true, intrinsic_min},
|
||||
{"mul", 2, true, intrinsic_mul},
|
||||
|
12
tests/log.shader_test
Normal file
12
tests/log.shader_test
Normal file
@ -0,0 +1,12 @@
|
||||
[pixel shader]
|
||||
uniform float4 x;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return log2(x);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 float4 2.0 4.0 5.0 0.4
|
||||
draw quad
|
||||
probe all rgba (1.0, 2.0, 2.32192802, -1.32192802) 1
|
Loading…
x
Reference in New Issue
Block a user