Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
e5b40092
Commit
e5b40092
authored
2 years ago
by
Nikolay Sivov
Committed by
Alexandre Julliard
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-shader/hlsl: Support all() intrinsic.
parent
2142d31f
No related branches found
No related tags found
1 merge request
!97
vkd3d-shader/hlsl: Support all() intrinsic.
Pipeline
#7786
skipped
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.am
+1
-0
1 addition, 0 deletions
Makefile.am
libs/vkd3d-shader/hlsl.y
+32
-0
32 additions, 0 deletions
libs/vkd3d-shader/hlsl.y
tests/all.shader_test
+63
-0
63 additions, 0 deletions
tests/all.shader_test
with
96 additions
and
0 deletions
Makefile.am
+
1
−
0
View file @
e5b40092
...
...
@@ -43,6 +43,7 @@ vkd3d_cross_tests = \
vkd3d_shader_tests
=
\
tests/abs.shader_test
\
tests/all.shader_test
\
tests/arithmetic-float.shader_test
\
tests/arithmetic-float-uniform.shader_test
\
tests/arithmetic-int.shader_test
\
...
...
This diff is collapsed.
Click to expand it.
libs/vkd3d-shader/hlsl.y
+
32
−
0
View file @
e5b40092
...
...
@@ -2370,6 +2370,37 @@ static bool intrinsic_abs(struct hlsl_ctx *ctx,
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_ABS, params->args[0], loc);
}
static bool intrinsic_all(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_node *arg = params->args[0], *mul;
struct hlsl_ir_constant *one, *zero;
struct hlsl_ir_load *load;
unsigned int i, count;
if (!(one = hlsl_new_float_constant(ctx, 1.0f, loc)))
return false;
list_add_tail(params->instrs, &one->node.entry);
if (!(zero = hlsl_new_float_constant(ctx, 0.0f, loc)))
return false;
list_add_tail(params->instrs, &zero->node.entry);
mul = &one->node;
count = hlsl_type_component_count(arg->data_type);
for (i = 0; i < count; ++i)
{
if (!(load = add_load_component(ctx, params->instrs, arg, i, loc)))
return false;
if (!(mul = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, &load->node, mul, loc)))
return false;
}
return !!add_binary_comparison_expr(ctx, params->instrs, HLSL_OP2_NEQUAL, mul, &zero->node, loc);
}
/* Find the type corresponding to the given source type, with the same
* dimensions but a different base type. */
static struct hlsl_type *convert_numeric_type(const struct hlsl_ctx *ctx,
...
...
@@ -2986,6 +3017,7 @@ intrinsic_functions[] =
{
/* Note: these entries should be kept in alphabetical order. */
{"abs", 1, true, intrinsic_abs},
{"all", 1, true, intrinsic_all},
{"asuint", -1, true, intrinsic_asuint},
{"clamp", 3, true, intrinsic_clamp},
{"cos", 1, true, intrinsic_cos},
...
...
This diff is collapsed.
Click to expand it.
tests/all.shader_test
0 → 100644
+
63
−
0
View file @
e5b40092
[require]
shader model >= 4.0
[pixel shader]
uniform float4 f;
float4 main() : sv_target
{
return all(f);
}
[test]
uniform 0 float4 -1.1 1.6 1.3 0.5
draw quad
probe all rgba (1.0, 1.0, 1.0, 1.0)
[test]
uniform 0 float4 0.0 1.6 1.3 0.5
draw quad
probe all rgba (0.0, 0.0, 0.0, 0.0)
[test]
uniform 0 float4 1.0 0.0 1.3 0.5
draw quad
probe all rgba (0.0, 0.0, 0.0, 0.0)
[pixel shader]
uniform float f;
float4 main() : sv_target
{
return all(f);
}
[test]
uniform 0 float4 1.0 0.0 0.0 0.0
draw quad
probe all rgba (1.0, 1.0, 1.0, 1.0)
[test]
uniform 0 float4 0.0 0.0 0.0 0.0
draw quad
probe all rgba (0.0, 0.0, 0.0, 0.0)
[pixel shader]
uniform float2x2 f;
float4 main() : sv_target
{
return all(f);
}
[test]
uniform 0 float4 1.0 2.0 0.0 0.0
uniform 4 float4 3.0 4.0 0.0 0.0
draw quad
probe all rgba (1.0, 1.0, 1.0, 1.0)
[test]
uniform 0 float4 1.0 2.0 0.0 0.0
uniform 4 float4 0.0 4.0 0.0 0.0
draw quad
probe all rgba (0.0, 0.0, 0.0, 0.0)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment