Commit Graph

3302 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
d8d051381f
Merge pull request #1970 from KhronosGroup/fix-1969
Handle PHI in collapsed switch constructs.
2022-07-04 15:17:52 +02:00
Hans-Kristian Arntzen
963fdfdf68 Handle PHI in collapsed switch constructs.
Collapsed switch constructs only branch directly to the merge block.
2022-07-04 13:55:00 +02:00
Hans-Kristian Arntzen
f46745095d
Merge pull request #1965 from billhollings/msl-physical_storage_buffer
MSL: Add support for SPV_KHR_physical_storage_buffer extension.
2022-07-04 12:59:42 +02:00
Bill Hollings
064a697b18 MSL: Fix implicit conversion precision build error. 2022-07-01 17:09:35 -04:00
Bill Hollings
4185acc70d MSL: Fixes from review for SPV_KHR_physical_storage_buffer extension.
- Assign ulongn physical type to buffer pointers in short arrays
  when array stride is larger than pointer size.
- Support GL_EXT_buffer_reference_uvec2 casting
  buffer reference pointers to and from uvec2 values.
- When packing structs, include structs inside physical buffers.
- Update mechanism for traversing pointer arrays when calculating type sizes.
- Added unit test shaders.
2022-07-01 16:10:41 -04:00
Bill Hollings
78eb5043f9 MSL: Fixes from review for SPV_KHR_physical_storage_buffer extension.
- For physical storage pointers, emit forward reference
  declarations in addition to definitions.
- Minor syntax corrections.
2022-06-24 17:28:17 -04:00
Hans-Kristian Arntzen
e6925974d1
Merge pull request #1966 from fred-wang/macos-snprintf
Fix compilation errors with deprecated sprintf function
2022-06-23 14:30:12 +02:00
Frédéric Wang
9c44a97faa address more review comments 2022-06-23 11:40:02 +02:00
Frédéric Wang
1310f5ba4d Keep using sprintf on windows. 2022-06-23 11:34:51 +02:00
Frédéric Wang
99f8613847 Fix compilation errors with deprecated sprintf function
This commit modifies sprintf calls to fix the following compilation
errors using XCode 14.0 beta on MacOS:

> 'sprintf' is deprecated: This function is provided for compatibility
> reasons only.  Due to security concerns inherent in the design of
> sprintf(3), it is highly recommended that you use snprintf(3) instead.
2022-06-21 16:28:16 +02:00
Hans-Kristian Arntzen
ba3e6ffe03
Merge pull request #1964 from sergmister/patch-1
Fix typo
2022-06-21 13:39:11 +02:00
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
Sergii Penner
1bba4d5137
Fix typo
Add a missing coma
2022-06-20 09:26:34 -06: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