Commit Graph

3467 Commits

Author SHA1 Message Date
Chip Davis
41007cdc7d MSL: Deduplicate function constants.
It is possible in SPIR-V to declare multiple specialization constants
with the same constant ID. The most common cause of this in GLSL is
defining a spec constant, then declaring the workgroup size to use that
spec constant by its ID. But, MSL forbids defining multiple function
constants with the same function constant ID. So, we must only emit one
definition of the actual function constant (with the
`[[function_constant(id)]]` attribute); but we can point the other
variables at this one definition.

Fixes three tests in the Vulkan CTS under
`dEQP-VK.compute.basic.max_local_size_*`.
2023-02-17 10:43:50 -08:00
Hans-Kristian Arntzen
4e2fdb2567
Merge pull request #2104 from Ravbug/fix-int-sm6.7
Support integer samplers in Shader Model 6.7
2023-02-03 17:05:31 +01:00
Hans-Kristian Arntzen
388431604a
Merge pull request #2103 from cdavis5e/msl-sample-dref-lod-array-workaround
MSL: Add a workaround for broken `level()` arguments.
2023-02-03 16:36:44 +01:00
Chip Davis
e8d419854f MSL: Add a workaround for broken level() arguments.
Some Metal devices have a bug with depth array textures using comparison
with explicit LoD, where the LoD given will be biased by some amount.
For these devices, we can use a gradient instead, which does not exhibit
this problem. As with the fragment demote workaround, this is only
expected to be needed until the bug is fixed in Metal.
2023-02-02 22:01:46 -08:00
Ravbug
36691f902c Check for SM < 6.7 2023-02-02 12:42:17 -05:00
Hans-Kristian Arntzen
459fa67937
Merge pull request #2101 from rdb/glsl-fix-missing-qualifier
GLSL: Fix missing precision qualifier in spvDeterminant return value
2023-02-02 11:26:06 +01:00
rdb
c356dd6220 GLSL: Fix missing precision qualifier in spvDeterminant return value
Follow-up to #2100
2023-01-27 21:44:47 +01:00
Hans-Kristian Arntzen
199d0cb8a9
Merge pull request #2100 from rdb/glsl-matrix-polyfills
GLSL: Add matrix inverse/determinant polyfills, outerProduct()
2023-01-27 14:37:45 +01:00
rdb
20981666cc GLSL: Legacy matrix inverse/determinant polyfills, outerProduct()
Also refactors polyfill mechanism in GLSL and fixes transpose() lowering precision.
2023-01-27 13:51:47 +01:00
Hans-Kristian Arntzen
86a985f28c
Merge pull request #2093 from rdb/emulate-unsupported-hyperbolic-funcs
GLSL/HLSL: Add emulated fallbacks for hyperbolic math functions
2023-01-27 12:15:28 +01:00
Hans-Kristian Arntzen
cd612e7dde
Merge pull request #2090 from rdb/glsl-legacy-math-funcs
GLSL: Add support for trunc, modf, isnan and isinf in legacy GLSL
2023-01-27 12:13:14 +01:00
Hans-Kristian Arntzen
99f130bb95
Merge pull request #2099 from rdb/patch-1
GLSL: Drop invariant keyword in GLSL 110
2023-01-27 12:10:02 +01:00
rdb
f8cc03fd1e
GLSL: Drop invariant keyword in GLSL 110 2023-01-27 11:10:47 +01:00
rdb
53974b4fae GLSL/HLSL: Add emulated fallbacks for sinh/cosh/tanh/asinh/acosh/atanh
The inverse hyperbolic functions are not supported in HLSL, and none of them are supported in legacy GLSL.
2023-01-26 19:40:42 +01:00
rdb
d10044b23e GLSL: Add support for modf, isnan and isinf in legacy GLSL 2023-01-26 19:14:25 +01:00
Hans-Kristian Arntzen
ff7a11dbcb
Merge pull request #2097 from KhronosGroup/shader-clock-tweaks
GLSL: Minor fixes for shader clock implementation.
2023-01-26 17:14:38 +01:00
Hans-Kristian Arntzen
9de5abaf78 GLSL: Minor fixes for shader clock implementation. 2023-01-26 15:41:51 +01:00
Hans-Kristian Arntzen
f575b89436
Merge pull request #2091 from LDeakin/shader-clock
GLSL: Support OpReadClockKHR
2023-01-26 15:41:40 +01:00
Hans-Kristian Arntzen
9da448c9ff
Merge pull request #2096 from rdb/glsl-extension-checks
GLSL: Add various missing extension checks
2023-01-26 15:41:15 +01:00
Hans-Kristian Arntzen
45824ea13c
Merge pull request #2095 from rdb/glsl-matrix-times-scalar-no-transpose
GLSL: Multiplying matrix with scalar shouldn't force transpose
2023-01-26 15:38:05 +01:00
Hans-Kristian Arntzen
c98ebc0312
Merge pull request #2092 from rdb/patch-1
Add early exit for test_shaders if compilation fails
2023-01-26 15:14:08 +01:00
rdb
d70bfa5f34 GLSL: Allow sample inputs in desktop < 400 with GL_ARB_sample_shading
Neither legacy ES nor legacy desktop support these extensions
2023-01-23 14:51:26 +01:00
rdb
2202c2a701 GLSL: Add various additional extension checks. 2023-01-23 11:55:53 +01:00
rdb
dff276989b GLSL: Multiplying matrix with scalar shouldn't force transpose 2023-01-21 11:42:55 +01:00
Hans-Kristian Arntzen
eb9b273298
Merge pull request #2094 from LibretroAdmin/main
(spirv_glsl.cpp) Fix error: no matching function for call to 'max(uint32_t&, unsigned int)'
2023-01-20 18:39:38 +01:00
libretroadmin
5029e30f0a (spirv_glsl.cpp) Fix error: no matching function for call to 'max(uint32_t&, unsigned int)' 2023-01-20 18:36:11 +01:00
Hans-Kristian Arntzen
f3a75d1d4b MSL: Fix another warning on potentially uninitialized. 2023-01-20 16:56:11 +01:00
Hans-Kristian Arntzen
85a78324ef MSL: Fix potentially uninitialized warning. 2023-01-20 16:51:16 +01:00
rdb
e6d1c76e5c
Add early exit for test_shaders if compilation fails 2023-01-19 14:18:01 +01:00
Lachlan Deakin
3335835fad GLSL: Support OpReadClockKHR 2023-01-19 22:28:38 +11:00
Chip Davis
2a9091ce53 MSL: Use rint() instead of round() to round array coordinates.
Vulkan specifies round-to-nearest-even mode to round array coordinates.
But we were using `round()`, which is round-to-nearest-away-from-zero.
Instead, use `rint()`, which is specified to perform nearest-even
rounding in MSL.
2023-01-18 19:34:29 -08:00
Hans-Kristian Arntzen
4be568c004
Merge pull request #2089 from warmenhoven/patch-1
Win10 doesn't like std::max
2023-01-18 12:06:28 +01:00
Hans-Kristian Arntzen
c102385487
Merge pull request #2088 from rdb/hlsl-legacy-point-size
HLSL: Support PointSize output in vertex shader in SM 3.0
2023-01-18 11:56:23 +01:00
warmenhoven
c9f2186e83
Win10 doesn't like std::max 2023-01-17 23:17:22 -05:00
rdb
26da9c58a6 HLSL: Support PointSize output in vertex shader in SM 3.0 2023-01-17 23:42:04 +01:00
Hans-Kristian Arntzen
4212eef67e
Merge pull request #2087 from rdb/patch-1
GLSL: Support GL_NV_shader_noperspective_interpolation in GLES
2023-01-17 12:02:22 +01:00
Hans-Kristian Arntzen
b52faf8a17
Merge pull request #2086 from rdb/legacy-int-attributes
GLSL/HLSL: Add legacy handling for int vertex attributes
2023-01-17 11:59:30 +01:00
rdb
09dd11be96
GLSL: Support GL_NV_shader_noperspective_interpolation in GLES 2023-01-16 20:02:13 +01:00
Hans-Kristian Arntzen
6bba45d2a3 Fix misc compilation issues with std::max.
Apparently uint32_t and unsigned is not the same type on some esoteric
platforms.
2023-01-15 12:17:30 +01:00
rdb
4ba13e0c1a GLSL/HLSL: Add legacy handling for int vertex attributes 2023-01-14 18:57:24 +01:00
Hans-Kristian Arntzen
49e4117c5f Updates for main branch rename. 2023-01-12 17:52:15 +01:00
Hans-Kristian Arntzen
88c6b49959
Merge pull request #2085 from KhronosGroup/fix-2075
GLSL: Handle textureGatherOffsets properly.
2023-01-12 17:48:00 +01:00
Hans-Kristian Arntzen
a085227395
Merge pull request #2084 from KhronosGroup/fix-2069
GLSL: Declare gl_in/gl_out as array more robustly.
2023-01-12 17:47:47 +01:00
Hans-Kristian Arntzen
1047c13d40 GLSL: Handle textureGatherOffsets properly.
We forgot to pass down the offset ID, clean up coffset vs offset jank
while we're at it.
2023-01-12 16:27:11 +01:00
Hans-Kristian Arntzen
f84527346d GLSL: Declare gl_in/gl_out as array more robustly.
If a builtin block was not already declared, we would miss some
scenarios.
2023-01-12 16:05:17 +01:00
Hans-Kristian Arntzen
38cd214007
Merge pull request #2083 from KhronosGroup/pr-2080
Land PR 2080
2023-01-12 13:12:48 +01:00
Hans-Kristian Arntzen
d46c10ebd3 Refactor PHI checks into block_is_noop instead. 2023-01-12 12:42:01 +01:00
Hans-Kristian Arntzen
bcbe33ad11 Also consider NonSemantic ExtInst in block_is_noop. 2023-01-12 12:41:53 +01:00
Hans-Kristian Arntzen
9d8ef6b36c Update test for updated block_is_noop check. 2023-01-11 15:21:58 +01:00
Hans-Kristian Arntzen
a61a541e1c Merge branch 'accept_noop' of https://github.com/loic-sharma/SPIRV-Cross into pr-2080 2023-01-11 15:18:41 +01:00