Commit Graph

3810 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
ab608ac89c
Merge pull request #2343 from billhollings/recurs-desc-set-arg-buff
MSL: Support descriptor sets with recursive content when using argument buffers.
2024-06-17 12:45:23 +02:00
Hans-Kristian Arntzen
d7ad3d7257
Apply suggestions from code review
Fix nits
2024-06-17 12:44:22 +02:00
Hans-Kristian Arntzen
e818cfd02f
Merge pull request #2339 from billhollings/constexp-samp-arg-buff
MSL: Fixes for constexpr sampler use with argument buffers.
2024-06-17 12:34:00 +02:00
Bill Hollings
488559ff4c MSL: Support descriptor sets with recursive content when using argument buffers.
When using argument buffers, handle descriptor set entry points with
recursive content, similar to discrete entry points with recursive content.

- For descriptor sets entry points with recursive content, add
  descriptor set to recursive_inputs, and create a local var for it.

- For recursive entry points that are contained in a descriptor set
  argument buffer, don't add entry point to recursive_inputs, or create
  a local var for that content entry point.

- Add test shader.
2024-06-14 13:35:11 -04:00
Bill Hollings
495e5b0913 MSL: Fixes for constexpr sampler use with argument buffers.
Constexpr samplers are defined as local variables,
but were treated as held within an argument buffer.

- CompilerMSL::to_sampler_expression() support constexpr samplers
  when using argument buffers, plus refactor to minimize generating
  expression text that may not be used.

- Handle padding around multi-plane images that require multiple textures.
  Only check for padding on the first plane, but include plane count in
  total argument buffer slots consumed.
2024-06-11 16:52:07 -04:00
Hans-Kristian Arntzen
2d990d355a MSL: Add median3 to list of banned func names. 2024-06-03 16:47:44 +02:00
Hans-Kristian Arntzen
d47a140735
Merge pull request #2331 from aitor-lunarg/force-depth-passthrough
MSL: Add option to force depth write in fragment shaders
2024-05-24 17:11:06 +02:00
Aitor Camacho
a43fabbe2a MSL: Add option to force depth write in fragment shaders
Metal writes to the depth/stencil attachment before fragment
shader execution if the execution does not modify the depth
value. However, Vulkan expects the write to happen after
fragment shader execution. To circumvent the issue we add
a simple depth passthrough if the user opts in. Only
required when the depth/stencil attachment is used as
input attachment at the same time. It seems Metal does not
correctly detect the dependency.
2024-05-24 12:13:17 +02:00
Hans-Kristian Arntzen
ce22ebb88a
Merge pull request #2330 from KhronosGroup/spirv-intrinsics
GLSL: Use SPIR-V intrinsics for N{Min,Max,Clamp}.
2024-05-21 18:51:12 +02:00
Hans-Kristian Arntzen
d1285ec08e GLSL: Use SPIR-V intrinsics for N{Min,Max,Clamp}.
When targeting Vulkan semantics, we should emit code that is actually
readable.

Also, make sure to use plain F{Min,Max,Clamp} on HLSL. HLSL has
NaN-aware semantics by default.
2024-05-21 17:56:42 +02:00
Hans-Kristian Arntzen
5934c8fc1c
Merge pull request #2329 from KhronosGroup/fix-2318
MSL: Improve handling of padded descriptors with argument buffers
2024-05-21 17:56:32 +02:00
Hans-Kristian Arntzen
8b3aa21944 Pass down orig_id to type_to_array_glsl as well.
Allows UBO/SSBO resources in MSL to get the layout-derived size as well.
2024-05-21 15:43:04 +02:00
Hans-Kristian Arntzen
b236352fef MSL: Always use layout-declared array size for argument buffers. 2024-05-21 15:41:56 +02:00
Hans-Kristian Arntzen
ffdcefe250 MSL: Only consider padding for non-aliased resources. 2024-05-21 15:41:56 +02:00
Hans-Kristian Arntzen
854759fd64 MSL: Do not overwrite rez_bind when padding. 2024-05-21 15:41:56 +02:00
Hans-Kristian Arntzen
d8eece47ff
Merge pull request #2328 from KhronosGroup/dynamic-buffer-cleanup
Dynamic buffer cleanup
2024-05-21 15:41:41 +02:00
Hans-Kristian Arntzen
e680b72416 MSL: Don't bother supporting invalid multi-dimensional dynamic buffers.
This was never legal in any API and I'm not sure why I ever bothered.
2024-05-21 14:05:33 +02:00
Hans-Kristian Arntzen
e406fb215c Fixup invalid shader that should not pass. 2024-05-21 14:04:20 +02:00
Hans-Kristian Arntzen
1f68d0f420
Merge pull request #2327 from KhronosGroup/pr-2324
Land PR 2324
2024-05-21 11:36:55 +02:00
Hans-Kristian Arntzen
485b4c6e27 Update C API minor version. 2024-05-21 11:26:18 +02:00
Aitor Camacho
cd8865deab Add option to enforce fragment execution with side effects in MSL
Metal will incorrectly discard fragments with side effects under
certain circumstances prematurely. The conditions are the following:
 - Fragment will always be discarded after side effect operation
 - Pre fragment depth fails
 - Modifies depth value for a constant value in the fragment shader.
   This constant value will also fail the depth test.

However, Metal will also discard the fragment even if it has
operations with side effects inside the fragment shader before the
discard operation.

Vulkan states the graphics pipeline to execute in the following
order:
 - Pre fragment depth test (cannot discard here due to modifying
   depth value in fragment shader)
 - Fragment shader (where the depth is modified and fragment
   discarded)
 - Post fragment depth test

Therefore, we need to enforce fragment shader execution and not
let Metal discard the fragment before that for such cases. This
change adds an option to provide such utility.
2024-05-21 11:24:56 +02:00
Hans-Kristian Arntzen
e2204e3fe9
Merge pull request #2326 from KhronosGroup/pr-2325
Land PR 2325.
2024-05-21 11:23:42 +02:00
Hans-Kristian Arntzen
641b92fa8f MSL: Clean up some nits for review. 2024-05-21 11:10:55 +02:00
Bill Hollings
ab1f9f4d7f MSL: Support ConstOffsets on image gather.
- Add TextureFunctionArguments::has_array_offsets.
- Add support functions spvGatherConstOffsets() &
  spvGatherCompareConstOffsets().
- Add SPVFuncImpl::SPVFuncImplGatherConstOffsets &
  SPVFuncImplGatherCompareConstOffsets.
- Add unit tests.
2024-05-20 12:10:35 -04:00
Hans-Kristian Arntzen
1ddd8b629c
Merge pull request #2321 from KhronosGroup/control-dependent-function
Mark function call results as control dependent as necessary.
2024-05-10 15:21:42 +02:00
Hans-Kristian Arntzen
04ddb9a809 Mark function call results as control dependent as necessary.
Inner function calls can contain flow-control sensitive code.
In this case, the function call itself must inherit the
control-dependence.

Rarely happens in practice since optimized code with SSA tends to
inline.
2024-05-10 14:52:24 +02:00
Hans-Kristian Arntzen
476f384eb7 Fix unused variable warning on GCC 14. 2024-05-09 12:26:58 +02:00
Bill Hollings
84cdc3b68e MSL: Fix argument buffer padding.
- After padding a resource, retrieve either the next padded slot,
  or the next resource, in order to correctly offset the slot index.
2024-05-06 09:57:31 +02:00
Hans-Kristian Arntzen
2ccc81fd82
Merge pull request #2317 from KhronosGroup/fix-2309
MSL: Handle missing FP16 trancendental overloads.
2024-04-29 12:02:51 +02:00
Hans-Kristian Arntzen
cbaa86982a MSL: Handle missing FP16 trancendental overloads. 2024-04-29 11:49:28 +02:00
Hans-Kristian Arntzen
71fe131ed0
Merge pull request #2314 from js6i/gpu-crash
Remove spvDescriptor wrapper in spvDescriptorArray
2024-04-29 10:17:43 +02:00
Jan Sikorski
84b4a54b0d Updated tests. 2024-04-18 09:19:01 +02:00
Jan Sikorski
298c2315f5 MSL: Remove pointer wrapper stored in spvDescriptorArray.
This works around what looks like a compiler bug which can cause GPU crashes.
2024-04-18 09:13:29 +02:00
Hans-Kristian Arntzen
cb956675fd
Merge pull request #2312 from KhronosGroup/fix-2305
MSL: Inherit interpolation qualifiers through recursive composites.
2024-04-15 16:40:47 +02:00
Hans-Kristian Arntzen
dc6db52356 MSL: Inherit interpolation qualifiers through recursive composites. 2024-04-15 15:44:21 +02:00
Hans-Kristian Arntzen
8edbda4206
Merge pull request #2311 from KhronosGroup/fix-2303
MSL: Handle Atomic{S,U}{Min,Max} with mismatched image sign.
2024-04-15 14:47:18 +02:00
Hans-Kristian Arntzen
4f17bf76b1 MSL: Handle Atomic{S,U}{Min,Max} with mismatched image sign.
Gross reinterpret_cast, but gotta do what you gotta do.
2024-04-15 14:29:01 +02:00
Hans-Kristian Arntzen
25b7772102
Merge pull request #2310 from KhronosGroup/fix-2300
MSL: Fix SUMulExtended for 64-bit inputs.
2024-04-15 13:55:25 +02:00
Hans-Kristian Arntzen
eef4c2af9c MSL: Fix SUMulExtended for 64-bit inputs. 2024-04-15 13:37:00 +02:00
Hans-Kristian Arntzen
56f24d86ec
Merge pull request #2304 from etang-cw/ArrayCleanup
Use recursive template for spvArrayCopy
2024-04-15 11:47:10 +02:00
Hans-Kristian Arntzen
06407561ec
Merge pull request #2306 from KhronosGroup/pr-2292
MSL: Implement support for EXT_mutable_descriptor_type and general aliasing with argument buffers
2024-04-03 15:16:49 +02:00
Hans-Kristian Arntzen
061bf6b445 Fix tabbing nits. 2024-04-03 13:49:41 +02:00
Hans-Kristian Arntzen
8219ccf706 MSL: Reassign bindings so they work with decoration binding in test. 2024-04-03 13:45:18 +02:00
Hans-Kristian Arntzen
ee77265ae5 MSL: Workaround compiler issue with image fence when used as reference. 2024-04-03 13:28:12 +02:00
Hans-Kristian Arntzen
218a8bfd86 MSL: Improve argument buffer descriptor aliasing implementation. 2024-04-03 13:15:51 +02:00
Hans-Kristian Arntzen
32e33e40b5 Cleanup overlap tag from review. 2024-04-02 12:42:12 +02:00
Jan Sikorski
ffb2c9bb6f MSL: Added tests for overlapping bindings. 2024-04-02 12:01:07 +02:00
Jan Sikorski
221a517be5 MSL: Pass variable id when emitting image entry point declarations. 2024-04-02 12:01:07 +02:00
Jan Sikorski
064186e474 MSL: Check for device argument buffers for overlapping bindings. 2024-04-02 12:01:07 +02:00
Jan Sikorski
760a659f5c MSL: Avoid emitting multiple declaration of the same variable. 2024-04-02 12:01:07 +02:00