Commit Graph

3290 Commits

Author SHA1 Message Date
Bill Hollings
52c7c2dab6 MSL: Add support for SPV_KHR_physical_storage_buffer extension.
- Determine sizing and alignments of pointers to types as
  distinct from the size and alignment of the types themselves.
- Declare all buffer pointers in the MSL device address space.
- Support struct pointer recursion, where structs can
  contain pointers to themselves or to a parent struct.
- Add SPIRType::was_forward_referenced to track if a type was forward
  referenced, to help emit MSL structs in the correct dependency order.
- Handle pointers to pointers that are not just arrays of arrays.
2022-06-20 20:21:00 -04:00
Hans-Kristian Arntzen
99b59b3528
Merge pull request #1963 from KhronosGroup/convert-u-to-rtas-fix
GLSL: Handle forced temporary OpConvertUToAccelerationStructureKHR.
2022-06-17 15:18:00 +02:00
Hans-Kristian Arntzen
e08e0cf28d GLSL: Handle forced temporary OpConvertUToAccelerationStructureKHR.
Need to lower to temporary before casting to RTAS.
2022-06-17 13:38:45 +02:00
Hans-Kristian Arntzen
89b1c24bdc
Merge pull request #1961 from RandomShaper/hlsl_more_bitcasts
HLSL: Implement bit casts between Half and UShort.
2022-06-15 22:43:05 +02:00
Pedro J. Estébanez
d8c5e39436 HLSL: Implement bit casts between Half and UShort. 2022-06-15 19:19:04 +02:00
Hans-Kristian Arntzen
197a273fd4
Merge pull request #1959 from KhronosGroup/fix-1955-1956
GLSL: Add more extension ladder fallbacks for unusual integer sizes.
2022-06-10 10:42:51 +02:00
Hans-Kristian Arntzen
df21a99d1a GLSL: Add more extension ladder fallbacks for unusual integer sizes. 2022-06-07 18:30:10 +02:00
Hans-Kristian Arntzen
a97bbc24c5
Merge pull request #1958 from KhronosGroup/fix-1957
Fix control flow bug where we missed continue;
2022-06-07 16:00:54 +02:00
Hans-Kristian Arntzen
cdafafe93b
Merge pull request #1954 from vkaytsanov/patch-1
Fix missing function in README sample
2022-06-07 15:42:42 +02:00
Hans-Kristian Arntzen
533aab00b6 GLSL: Add missing KHR barycentric references. 2022-06-07 15:17:34 +02:00
Hans-Kristian Arntzen
46e4b5a3c8 Fix control flow bug where we missed continue;
Case which caused failure:

if (cond)
{
    continue;
}
break;

Only allow tracing from inner selections if the outer header never
merges execution.
2022-06-07 15:04:01 +02:00
vkaytsanov
612de70b38
Fix missing function in README sample 2022-06-04 00:54:45 +03:00
Hans-Kristian Arntzen
50b4d5389b
Merge pull request #1953 from KhronosGroup/bary-khr
Emit KHR barycentrics when source SPIR-V uses it.
2022-05-27 14:23:52 +02:00
Hans-Kristian Arntzen
e45d01c41f Emit KHR barycentrics if source enables the KHR extension.
For roundtrip purposes, need to match KHR or NV extension.
2022-05-27 13:28:25 +02:00
Hans-Kristian Arntzen
0aedc7d128 Roll dependencies. 2022-05-27 13:28:25 +02:00
Hans-Kristian Arntzen
af223101c6
Merge pull request #1952 from KhronosGroup/fix-1944
GLSL: Add basic support for GL_EXT_shader_atomic_float.
2022-05-27 13:17:22 +02:00
Hans-Kristian Arntzen
c8ab790163
Merge pull request #1951 from KhronosGroup/fix-1950
GLSL: Implement 1D texture emulation for ES.
2022-05-27 13:17:12 +02:00
Hans-Kristian Arntzen
88e583d062 GLSL: Add basic support for GL_EXT_shader_atomic_float. 2022-05-27 12:13:40 +02:00
Hans-Kristian Arntzen
1c88730e12 GLSL: Implement 1D texture emulation for ES.
ES does not support 1D images at all. Fake it by promoting 1D images to
2D.
2022-05-27 11:51:34 +02:00
Hans-Kristian Arntzen
3f855646f0
Merge pull request #1948 from iwubcode/gl_layer_hlsl
HLSL: fix BuiltInLayer to emit semantic 'SV_RenderTargetArrayIndex'
2022-05-26 14:41:17 +02:00
iwubcode
a6976d596a HLSL: fix BuiltInLayer to emit semantic 'SV_RenderTargetArrayIndex' instead of 'SV_RenderTargetIndex' 2022-05-21 00:52:23 -05:00
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