Commit Graph

3269 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
b3ff97d0fe
Merge pull request #1946 from KhronosGroup/fix-1943
Promote Unreachable cases into break to avoid fallthrough.
2022-05-18 19:22:45 +02:00
Hans-Kristian Arntzen
48d50fa911
Merge pull request #1945 from KhronosGroup/fix-1938
Attempt to overwrite SSA inputs in OpCompositeInsert
2022-05-18 19:22:36 +02:00
Hans-Kristian Arntzen
d08ce828f4 Promote Unreachable cases into break to avoid fallthrough.
HLSL is very fussy about fallthrough in switch blocks, so promote
Unreachable blocks to breaks if they are inside a switch construct.

Some false positives are possible in weird multi-break scenarios, but
this is benign.
2022-05-18 18:36:32 +02:00
Hans-Kristian Arntzen
4b9e60273c Add tests for OpCompositeInsert edge cases. 2022-05-18 16:43:32 +02:00
Hans-Kristian Arntzen
23662668dd Attempt more optimal codegen for OpCompositeInsert.
Speculate that we can modify the SSA value in-place. As long as it is
not used after the modify, this is fine.

Also need to make sure we don't attempt to RMW something that is
impossible to modify.
2022-05-18 16:37:33 +02:00
Hans-Kristian Arntzen
d0c8dc3045
Merge pull request #1942 from KhronosGroup/no-fetch-grad-workaround
GLSL: Don't apply Grad LOD workarounds for fetch.
2022-05-13 16:35:19 +02:00
Hans-Kristian Arntzen
a3c4177324 GLSL: Don't apply Grad LOD workarounds for fetch. 2022-05-13 15:47:38 +02:00
Hans-Kristian Arntzen
bfefb5f511
Merge pull request #1941 from KhronosGroup/fix-1934
MSL: Potentially cast loaded Input variables.
2022-05-13 14:17:59 +02:00
Hans-Kristian Arntzen
832d469048
Merge pull request #1940 from KhronosGroup/fix-1935
GLSL: Do not analyze precision for Undef variables.
2022-05-13 13:04:00 +02:00
Hans-Kristian Arntzen
05206005ca MSL: Potentially cast loaded Input variables.
If the sign is rewritten for an input, we might have to fixup the sign
in OpLoad, similar to builtins.
2022-05-13 13:02:45 +02:00
Hans-Kristian Arntzen
92164d38d1 GLSL: Do not analyze precision for Undef variables.
Undefs won't have a chance to emit aliases, and any expression depending
on Undef will be garbage either way.
2022-05-13 12:18:10 +02:00
Hans-Kristian Arntzen
940efca099
Merge pull request #1936 from KhronosGroup/rt-stage-cli
Add --stage handling for ray tracing.
2022-05-10 18:02:10 +02:00
Hans-Kristian Arntzen
0b303aab16 Add --stage handling for ray tracing. 2022-05-10 17:14:54 +02:00
Hans-Kristian Arntzen
0c8a79b0b5
Merge pull request #1932 from KhronosGroup/fix-1868
Implement more proper semantics for RelaxedPrecision vs mediump
2022-05-03 11:12:55 +02:00
Hans-Kristian Arntzen
7eb5ced2a0 Refactor out query for operation type/result IDs. 2022-05-02 15:27:09 +02:00
Hans-Kristian Arntzen
7a6c2da9aa GLSL: Handle more proper semantics for RelaxedPrecision.
GLSL and RelaxedPrecision are quite different in what they affect.
RelaxedPrecision affects operations, while this is merely implied in
GLSL based on inputs.

This leads to situations where we have to promote mediump inputs to
highp, and the simplest approach is to force highp temporaries for
inputs which are consumed in a highp context. For completeness, we also
demote RelaxedPrecision inputs to mediump variables.

PHI is handled by copying the PHI into a temporary.

We have to be very careful with hoisted temporaries, since the child
temporary will not be analyzed up-front. We inherit the hoisted-ness
state and emit the hoisted child temporary as necessary. When faking the
temporaries with OpCopyObject, we make sure to block any variable
hoisting.

Hoisting children of PHI variables is fine, since PHIs are not hoisted with
the same framework as other temporaries.
2022-05-02 15:11:24 +02:00
Hans-Kristian Arntzen
d28136cc7a GLSL: Clean up some ways of querying decoration flags. 2022-04-29 13:47:49 +02:00
Hans-Kristian Arntzen
a9d23d7652
Merge pull request #1931 from EpicGames/fixes_hlsl
HLSL: Add missing `BuiltInLayer` to HLSL backend.
2022-04-29 11:32:46 +02:00
Laura Hermanns
65431446f4 HLSL: Add missing BuiltInLayer to HLSL backend. 2022-04-28 16:44:34 -04:00
Hans-Kristian Arntzen
6ae7ddb92a
Merge pull request #1930 from KhronosGroup/fix-1928
HLSL: Add more comprehensible reserved identifier list.
2022-04-28 17:22:15 +02:00
Hans-Kristian Arntzen
960edcd396
Merge pull request #1929 from KhronosGroup/fix-1925
Handle early reads from loop variables with initializers.
2022-04-28 17:22:00 +02:00
Hans-Kristian Arntzen
10a7631d50 HLSL: Add more comprehensible reserved identifier list. 2022-04-28 14:56:43 +02:00
Hans-Kristian Arntzen
40b3053b4c Handle early reads from loop variables with initializers.
Need to consider that static_expression can be 0. Fallback as necessary.
Also need to clear the static expression.
2022-04-28 14:36:53 +02:00
Hans-Kristian Arntzen
c52333b984
Merge pull request #1924 from stefalie/master
cli: display missing memory qualifiers for reflect and dump-resources
2022-04-27 13:27:53 +02:00
Hans-Kristian Arntzen
ee4ac5c2ce
Merge pull request #1927 from billhollings/msl-interface-block-array-length-1
MSL: Emit interface block members of array length 1 as arrays instead of scalars.
2022-04-27 12:14:05 +02:00
Bill Hollings
3bca246ad2 MSL: Emit interface block members of array length 1 as arrays instead of scalars.
Test for array presence using is_array() instead of element count.
Add shaders-msl/vert/interface-block-single-element-array.vert regression test.

Fixes a regression error introduced in 3d4daab.
2022-04-26 20:39:18 -04:00
Stefan Lienhard
089cf27119 remove newline at eof 2022-04-26 19:15:51 +02:00
Stefan Lienhard
56fd17f552
add qualifiers to reference reflect json output 2022-04-26 14:30:17 +02:00
Stefan Lienhard
05c9a14422 cli: display missing memory qualifiers for reflect and dump-resources 2022-04-25 22:05:34 +02:00
Hans-Kristian Arntzen
d7cae5e7cd
Merge pull request #1917 from KhronosGroup/fix-1906
GLSL: Support GL_EXT_debug_printf.
2022-04-19 13:08:30 +02:00
Hans-Kristian Arntzen
0500f9ed5d
Merge pull request #1916 from KhronosGroup/fix-1910
MSL: Pass down global RayQuery object to leaf functions.
2022-04-19 13:08:19 +02:00
Hans-Kristian Arntzen
d2a4f9842b GLSL: Support GL_EXT_debug_printf. 2022-04-19 12:07:54 +02:00
Hans-Kristian Arntzen
5b18fb1bcd MSL: Pass down global RayQuery object to leaf functions. 2022-04-19 11:49:22 +02:00
Hans-Kristian Arntzen
779138f39f
Merge pull request #1914 from RandomShaper/hlsl_view_index
HLSL: Implement ViewIndex.
2022-04-19 11:27:23 +02:00
Pedro J. Estébanez
2ea1c9b642 HLSL: Implement ViewIndex. 2022-04-15 10:42:52 +02:00
Hans-Kristian Arntzen
6a67891418
Merge pull request #1909 from skkkksdkfak/primitive_id
Translate gl_PrimitiveID to SV_PrimitiveID.
2022-04-13 11:25:30 +02:00
skksdkfak
54c00b69a4 Translate gl_PrimitiveID to SV_PrimitiveID. 2022-04-07 12:56:53 +03:00
Hans-Kristian Arntzen
0d4ce028bf
Merge pull request #1903 from KhronosGroup/fix-1900
MSL: Fix goofy bugs in ray query.
2022-03-24 19:27:22 +01:00
Hans-Kristian Arntzen
17c52990d5 MSL: Fix goofy bugs in ray query. 2022-03-24 18:14:46 +01:00
Hans-Kristian Arntzen
a3996eccf3
Merge pull request #1896 from Roy-AMD/fix-condition-issue
Use types have same widths in loop condition.
2022-03-24 18:00:56 +01:00
Roy.li
749be80389 Use types have same widths in loop condition.
In case comparisons between types of different widths in a loop condition
caused the loop to behave unexpectedly.
2022-03-24 14:26:03 +08:00
Hans-Kristian Arntzen
44691aa975
Merge pull request #1899 from billhollings/forward-volatile-vars-except-builtins
Allow volatile vars that are not builtins to be forwarded.
2022-03-23 22:07:10 +01:00
Bill Hollings
85f98eb0c5 Allow volatile vars that are not builtins to be forwarded.
This fixes a regression introduced by 93b0dc7, where all volatile variables
were not allowed to be forwarded. This doesn't work well for volatile memory
object variables like images or buffer blocks, because it forces local variables
to be defined, which is unnecessary, and sometimes results in wrong types.

This patch restricts volatile builtin variables (eg. HelperInvocation) from
being forwarded, but allows other volatile variables to be forwarded, as before.
2022-03-23 14:48:22 -04:00
Hans-Kristian Arntzen
d000b9e71c
Merge pull request #1898 from KhronosGroup/pr-1859
Merge PR #1859 with minor fixes
2022-03-22 13:50:43 +01:00
Hans-Kristian Arntzen
191c57b6cc
Merge pull request #1897 from KhronosGroup/fix-1763
MSL: Handle awkward mix and match of Offset / ArrayStride in constants.
2022-03-22 13:50:33 +01:00
Hans-Kristian Arntzen
a7eefbc114 HLSL: Disable FXC testing for rayquery shaders.
Manually tested that it compiles on DXC.
2022-03-22 12:34:43 +01:00
Hans-Kristian Arntzen
cd209ff46d HLSL: Update test from review. 2022-03-22 12:31:52 +01:00
Hans-Kristian Arntzen
c95338e03e Merge branch 'ray_query' of https://github.com/k-payl/SPIRV-Cross into pr-1859 2022-03-22 12:29:49 +01:00
Hans-Kristian Arntzen
7b9eaf0b5e MSL: Handle awkward mix and match of Offset / ArrayStride in constants.
In normal buffer blocks, every member must be declared, but for
constants, you can technically mix and match, causing much pain and
suffering ...
2022-03-22 12:25:09 +01:00
Konstantin Pail
251361bd6f VK_KHR_ray_query implementation 2022-03-15 21:54:29 +03:00