Commit Graph

883 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
f1b411c9e8 GLSL: Deal with buffer_reference_align.
This is somewhat awkward to support, but the best effort we can do here
is to analyze various Load/Store opcodes and deduce the ideal overall
alignment based on this. This is not a 100% perfect solution, but should
be correct for any reasonable use case.

Also fix various nitpicks with BDA support while I'm at it.
2021-11-07 17:11:46 +01:00
Bill Hollings
76cb807c19 MSL: Fix type redirection when struct members are reordered to align with offsets.
Populate member_type_index_redirection as reverse lookup, not forward lookup.
Move use of member_type_index_redirection from CompilerMSL::to_member_reference()
to CompilerGLSL::access_chain_internal() to access all redirected type info,
not just name.
2021-10-28 10:16:34 -04:00
Hans-Kristian Arntzen
edf247fb1c MSL: Workaround compiler crashes when using threadgroup bool.
Promote to short instead and do simple casts on load/store instead.

Not 100% complete fix since structs can contain booleans, but this is
getting into pretty ridiculously complicated territory.
2021-10-25 10:55:11 +02:00
Erfan Ahmadi
43eecb2360 SPIRV-Cross contribution needed for INTEL_fragment_shader_ordering 2021-10-25 10:50:10 +02:00
Bill Hollings
974a0818b8 MSL: Support more usecases for unpacked vectors.
Additional usecases include array and vector indexing, variable declarations,
loop initializers, function return values, switch statement evaluations,
and various specialized MSL operations.

Ultimately, we might consider refactoring CompilerMSL::to_expression()
to always take into consideration possible unpacking behavior.

Refactor CompilerGLSL::to_enclosed_unpacked_expression()
for conciseness and consistency with similar functionality.
2021-10-21 16:11:33 -04:00
Bill Hollings
595eb0c21d Per spec, support undefined behavior for out-of-bounds swizzles.
Per spec, instead of throwing exception for out-of-bounds swizzles,
engage undefined behavior by defaulting to the .x swizzle.
2021-10-20 14:46:30 -04:00
Hans-Kristian Arntzen
6382f15470 Test behavior around OpSelect with matrices. 2021-10-13 16:08:29 +02:00
Hans-Kristian Arntzen
6071df5840 Fix wrong detection of trivial_mix_op.
Effectively, only the last component of the select was considered, need
to correctly early out if any case is hit.
2021-10-13 15:34:00 +02:00
Hans-Kristian Arntzen
f72bb3c6f5 Improve handling of INT_MIN/INT64_MIN literals.
We cannot naively convert these to decimal literals. C/C++ (and thus
MSL) has extremely awkward literal promotion rules.
2021-09-30 16:29:30 +02:00
Bill Hollings
35e92e6ffb MSL: Return fragment function value even when last SPIR-V Op is discard (OpKill).
Add test shader for new functionality.
Add legacy test reference shader for unrelated buffer-bitcast
test, that doesn't seem to have been added previously.
2021-09-12 16:28:21 -04:00
Bill Hollings
5fb1ca4f0d Add support for additional ops in OpSpecConstantOp.
MSL: Support op OpQuantizeToF16 in OpSpecConstantOp.
All: Support op OpSRem in OpSpecConstantOp.
2021-09-03 18:20:49 -04:00
Hans-Kristian Arntzen
b8f1e71907 GLSL: Emit GL_EXT_buffer_reference_uvec2 as required. 2021-09-02 13:17:13 +02:00
Hans-Kristian Arntzen
23c4480d8e Fix switch fallthrough case in some cases. 2021-08-31 17:24:09 +02:00
Hans-Kristian Arntzen
ac11a91792 GLSL: Emit precise for fp16/fp64 types as well. 2021-07-26 22:05:55 +02:00
Hans-Kristian Arntzen
18f3cd6810 GLSL: Ensure ray query object decls are flushed if allocated in Function.
glslang always emits Private variables, but DXC not so much.
2021-07-20 12:04:00 +02:00
Hans-Kristian Arntzen
5b227cc57c GLSL: Implement GL_EXT_ray_query. 2021-07-19 14:01:21 +02:00
Hans-Kristian Arntzen
1ae2b58f19
Merge pull request #1700 from pkasting/master
Fix -Wunreachable-code-aggressive.
2021-06-30 22:16:02 +02:00
Peter Kasting
7cdab07efe Fix -Wunreachable-code-aggressive.
Bug: chromium:1066980
2021-06-30 09:17:59 -07:00
Hans-Kristian Arntzen
206ee8f171 GLSL: Support pervertexNV in NV barycentric extension. 2021-06-30 16:27:46 +02:00
Jon Leech
f2a65545b8 Finish adding SPDX tags and setup a reuse checked in Github Actions CI 2021-06-29 11:03:52 +02:00
Hans-Kristian Arntzen
d6b29ab017 HLSL: Rewrite how block IO is emitted.
Emit block members directly in the IO structs and sort them.
Ensures we can get some kind of stable order between stages.

To complete the story, we'll need to be able to inject unused inputs /
builtins, or eliminate unused outputs (probably easiest solution).
2021-06-28 15:04:49 +02:00
Hans-Kristian Arntzen
9338996f3b
Merge pull request #1697 from KhronosGroup/fix-1693
GLSL: Emit num_views for OVR_multiview2.
2021-06-28 14:26:29 +02:00
Hans-Kristian Arntzen
d75666b170 GLSL: Emit num_views for OVR_multiview2. 2021-06-28 12:56:27 +02:00
Hans-Kristian Arntzen
8216e87f02 Handle SPIR-V 1.4 selection constructs.
Fix bug in to_trivial_mix_op, where we made a pre-1.4 assumption that
component count of selector is equal to value component count.
2021-06-28 12:23:44 +02:00
Hans-Kristian Arntzen
2e1b5fb39e
Merge pull request #1686 from KhronosGroup/fix-1684
GLSL: Support control flow hints
2021-06-03 14:13:18 +02:00
Hans-Kristian Arntzen
449f68ef3b Ensure loop control flow hints only appear above loops. 2021-06-03 12:19:10 +02:00
Hans-Kristian Arntzen
d62b3c2b92 GLSL: Implement control flow hints. 2021-06-03 12:01:49 +02:00
Hans-Kristian Arntzen
165dbff228 Handle odd type for textureGather component. 2021-06-03 11:37:45 +02:00
xndcn
02fb8f2a24 Add comment after inf/nan float number for clarifying. 2021-05-27 02:40:41 +08:00
Hans-Kristian Arntzen
26a4986009 GLSL: Implement noncoherent framebuffer fetch. 2021-05-21 14:22:57 +02:00
Hans-Kristian Arntzen
e47a30e807 Honor NoContraction qualifier.
We'll need to force a temporary and mark it as precise.
MSL is a little weird here, but we can piggyback on top of the invariant
float math option here to force fma() operations everywhere.
2021-05-07 12:59:47 +02:00
Przemog1
0408c592dd Fixed 16 bit int types 2021-05-07 11:06:19 +02:00
Hans-Kristian Arntzen
532f65583e Rewrite how non-uniform qualifiers are handled.
Remove all shenanigans with propagation, and only consume nonuniform
qualifiers exactly where needed (last minute).
2021-04-22 16:03:08 +02:00
Hans-Kristian Arntzen
d137abeef5
Merge pull request #1655 from KhronosGroup/fix-1640
GLSL: Support shading rate builtins.
2021-04-20 16:35:02 +02:00
Hans-Kristian Arntzen
8e24e0b224
Merge pull request #1654 from KhronosGroup/fix-1641
GLSL: Implement gl_FragFullyCoveredNV.
2021-04-20 16:34:53 +02:00
Hans-Kristian Arntzen
71eb1754e3
Merge pull request #1653 from KhronosGroup/fix-1638
GLSL: Support GL_EXT_shader_image_load_formatted.
2021-04-20 16:34:44 +02:00
Hans-Kristian Arntzen
c89b5a1a3f GLSL: Support shading rate builtins. 2021-04-20 13:58:07 +02:00
Hans-Kristian Arntzen
3fd148450a GLSL: Implement gl_FragFullyCoveredNV. 2021-04-20 13:44:52 +02:00
Hans-Kristian Arntzen
f93a8fb1fe GLSL: Support GL_EXT_shader_image_load_formatted. 2021-04-20 13:36:51 +02:00
Hans-Kristian Arntzen
96ba044f01 HLSL: Fix automatic location assignment in block IO. 2021-04-20 13:04:26 +02:00
Hans-Kristian Arntzen
ae9ca7d73c MSL: Fix copy of arrays to/from stage IO variables.
Need to take into account effective storage classes and whether or not
we target stage IO blocks since native arrays are conditionally enabled.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
75ed73818c MSL: Handle loading Clip/CullDistance in TESE.
Need to allow the flattened space to go through in some edge cases where
we cannot reasonably unflatten.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
c9946296dd MSL: Fix initialization of masked threadgroup variables. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
436b1250da MSL: Do not perform scalar fixups for control-point outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
ae7bb41ef4 MSL: Test that we can mask location writes in TESC. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
ba93b6518d MSL: Fix masking of vertex block outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
a393de31e6 MSL: Refactor out variable/block member masking. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
394c038bfd MSL: Do not consider effective storage for any composite. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
04988b89b9 MSL: Handle effective storage for masked CP outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
f2b5fb3f45 MSL: Emit threadgroup storage class for masked control point outputs.
Shader can still rely on writes to threadgroup memory to be visible.
2021-04-19 12:10:49 +02:00