Commit Graph

1058 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
7e469d0908 MSL: Fix indent. 2024-06-19 14:45:24 +02:00
Hans-Kristian Arntzen
098427a9ce MSL: Cast to packed format when using unexpected stride.
We're still technically missing handling for Aligned mask on Load/Store,
but that needs separate analysis and gets horribly annoying ...
This should cover most use cases.
2024-06-19 14:24:50 +02:00
Hans-Kristian Arntzen
eeb35a97e9 MSL: Clean up some obsolete use of type.pointer. 2024-06-19 14:23:49 +02:00
Hans-Kristian Arntzen
bc105b6ad0 MSL: Consider pointer arithmetic for OpPtrAccessChain.
If the stride is weird for non-struct types you gotta do what you gotta
do.
2024-06-19 13:43:08 +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
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
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
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
eef4c2af9c MSL: Fix SUMulExtended for 64-bit inputs. 2024-04-15 13:37:00 +02:00
Hans-Kristian Arntzen
b4c84bb135 Block loop optimization if Phi is used.
Somehow this hasn't been caught until now. Impressive.

We'll have to emit side effects in condition block to make this work,
which breaks loop conditionals.
2024-03-18 12:09:38 +01:00
penghaiyi
18cb2ce961 GLSL: Fix atomic_uint being incorrectly generated as uint 2024-02-23 09:33:08 +08:00
Hans-Kristian Arntzen
376a308dc7 GLSL: Handle ptr-to-array casts with unexpected array strides. 2024-01-18 14:14:10 +01:00
Hans-Kristian Arntzen
3da5bc7a57 GLSL: Forward declare non-block BDA types as well.
With non-block structs, we can have pointers in those types too.
2024-01-18 12:56:31 +01:00
Hans-Kristian Arntzen
871ac0e5b7 GLSL: Handle BDA to plain non-block struct.
The implementation assumed that BDA to struct would always result in a
Block-like type, but that is not necessarily the case. Treat non-Block
structs as POD types as well.
2024-01-18 12:40:47 +01:00
Wooyoung Kim
1efe04cfce Add supprot for the SPV_QCOM_image_processing extension 2024-01-08 09:58:27 -08:00
Wooyoung Kim
8028f75685
Merge branch 'KhronosGroup:main' into SPV_QCOM_image_processing 2024-01-08 09:36:01 -08:00
Wooyoung Kim
a7b6f3a34a Add supprot for the SPV_QCOM_image_processing extension 2024-01-05 22:38:08 -08:00
Hans-Kristian Arntzen
ec87a03655 MSL: Plumb through member state to image/sampler types. 2024-01-05 16:08:29 +01:00
Hans-Kristian Arntzen
bedc49b859 HLSL: Fix issue with vec4 straddle rules in substructs. 2024-01-05 14:07:05 +01:00
Hans-Kristian Arntzen
833c5936b0 Various nit fixes and improvements from review. 2023-12-07 14:31:36 +01:00
Hans-Kristian Arntzen
e3d1b9afbb Merge branch 'spirtype-refactor' of https://github.com/Hugobros3/SPIRV-Cross into pr-2238 2023-12-07 12:05:48 +01:00
Hans-Kristian Arntzen
ffab994ab0 MSL: Wrap dereferenced ptr-chain expressions. 2023-12-06 17:09:25 +01:00
Hans-Kristian Arntzen
6dbec321d2 MSL: Defererence pointer expressions before traversing access chain.
Exception is struct which does -> for us.
2023-12-06 17:09:25 +01:00
Hans-Kristian Arntzen
0836c81e73 MSL: Only do address-of expression when needed. 2023-12-06 16:18:58 +01:00
Hans-Kristian Arntzen
e2886f0946 MSL: Consider PtrAccessChain on array types. 2023-12-06 16:18:58 +01:00
Chip Davis
c0760eb91f MSL: Fix patch vertex count with raw buffer tese input.
We can no longer rely on the `patch_control_point<>` array being
present, so the best we can do is use the value given us at compile
time.

This was an oversight on my part when I initially implemented the
raw-buffer tessellation evaluation input mode. The lack of tests for the
`PatchVertices` built-in almost certainly contributed, so I fixed that
in this patch.

Fixes the test
`dEQP-VK.tessellation.shader_input_output.patch_vertices_in_tes`. This
is the last failing test under `dEQP-VK.tessellation`.
2023-12-04 14:24:16 -08:00
Hugo Devillers
738bfd49e3 msl: fix test regressions with samplemask 2023-12-04 12:47:15 +01:00
Hugo Devillers
950cad5913 Added an Op field to SPIRType
This field allows telling what the 'head' of the type is, without having to look at parent types.
2023-11-30 12:28:50 +01:00
Hans-Kristian Arntzen
57dbfa0400 MSL: Support std140 half matrices and arrays.
Super awkward since there is no clean way to express this.
2023-11-27 15:28:20 +01:00
chirsz-ever
20dd53b312
Allow to customize float literals in output 2023-11-22 22:17:24 +08:00
Hans-Kristian Arntzen
bf059200be
Only use lowp path for legacy ES 2023-11-16 14:00:48 +01:00
Hans-Kristian Arntzen
0e9bc69128
Review nit, update brace placement 2023-11-16 14:00:00 +01:00
Eliza Velasquez
93150ed7fb Workaround for generating bool uniforms in ESSL1
Fixes #2223.
2023-11-13 15:23:36 -08:00
Hans-Kristian Arntzen
2fba284b4e MSL: Improve handling of sample masks. 2023-10-23 14:40:28 +02:00
Hans-Kristian Arntzen
f12ee5e0a4 Merge remote-tracking branch 'epic/fixes_hlsl' 2023-10-23 11:54:49 +02:00
Laura Hermanns
5d7ee6ad11 Fix declaration of gl_SampleMaskIn[1] in HLSL backend. 2023-10-17 09:11:09 -04:00
Hans-Kristian Arntzen
724433d729
Merge pull request #2216 from KhronosGroup/buffer-reference-2
GLSL: Use buffer_reference2 instead of 1.
2023-10-11 14:20:36 +02:00
Hans-Kristian Arntzen
255ff2b19c GLSL: Use buffer_reference2 instead of 1.
Supports more syntax.
2023-10-11 14:18:36 +02:00
Hans-Kristian Arntzen
be944258be GLSL: Ignore bogus constant/undefs which use block types.
This is banned in more recent SPIR-V.
We cannot implement this in any reasonable way since block types don't
participate as normal types in GLSL.
2023-10-11 13:48:25 +02:00
Hans-Kristian Arntzen
75620181bc GLSL: Handle empty block declarations.
Similar fix as for structs.
2023-10-11 13:09:55 +02:00
Hans-Kristian Arntzen
b76394e66a GLSL: Fix Clip/Cull in mesh shaders. 2023-08-25 11:59:21 +02:00
Hans-Kristian Arntzen
633dc30135
Merge pull request #2187 from KhronosGroup/mesh-invariant-position
GLSL: Emit inline invariant position for mesh shaders.
2023-08-17 13:51:54 +02:00
Hans-Kristian Arntzen
a3f026815a
Merge pull request #2186 from KhronosGroup/64bit-images
GLSL: Implement 64-bit image support.
2023-08-17 13:50:29 +02:00
Hans-Kristian Arntzen
79d63934a6 GLSL: Emit inline invariant position for mesh shaders.
Work around missing feature from GLSL. Normally we can emit a global
invariant gl_Position; and call it a day, but it does not work for mesh
shaders it seems. Declaring invariance inside an explicit IO block works
fine on the other hand ...
2023-08-17 12:45:54 +02:00
Hans-Kristian Arntzen
5e3ea64843 GLSL: Implement 64-bit image support. 2023-08-17 12:17:55 +02:00
Hans-Kristian Arntzen
5ffc813dc4 GLSL: Require mesh shader when using perprimitiveEXT in frag shader. 2023-08-17 12:07:11 +02:00
Hans-Kristian Arntzen
8ec95fbe16 Consider dynamically indexed gl_Position in mesh. 2023-07-03 14:20:27 +02:00
Hans-Kristian Arntzen
601b60c531 Consider plain Position builtin variable as well. 2023-07-03 14:15:26 +02:00
Hans-Kristian Arntzen
a065c3b48a Merge branch 'dx12-mesh-flip-y' of https://github.com/Try/SPIRV-Cross into pr-2168 2023-07-03 13:55:02 +02:00
Try
68376504a0 track access to meshlet position.y, via SPIRExpression 2023-07-01 15:49:35 +02:00