Commit Graph

3175 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
c716a9a5dd Add debug option to modify maximum number of compile iterations.
Should be seen as a hack, but it's pragmatic in some scenarios.
2022-02-16 12:12:27 +01:00
Hans-Kristian Arntzen
29cc18988c Fix regression from adding 64-bit switch support.
Missed some cases where we did not handle the loaded type width
properly.
2022-02-16 11:49:24 +01:00
Hans-Kristian Arntzen
339e61a0e0 Do not emit hoisted access chain temporaries unless backend supports it.
This can happen for access chains into buffer objects which were marked
as potentially hoisted, but it's benign in almost all cases.
2022-02-16 11:36:38 +01:00
Hans-Kristian Arntzen
5d9a95370f GLSL: Ensure correct signed integer type for more texture functions. 2022-02-16 11:14:07 +01:00
Hans-Kristian Arntzen
131278458e
Merge pull request #1860 from KhronosGroup/docs-update
Update documentation for descriptor set support in MSL/HLSL.
2022-02-04 14:25:19 +01:00
Hans-Kristian Arntzen
a8016a6470 Update documentation for descriptor set support in MSL/HLSL.
Ancient outdated README.
2022-02-04 12:51:32 +01:00
Rodolphe
1a36968e5d
[Spirv_msl] Fix normalize on half3/half2 (#1856)
When emitting a normalize OP, conditionally stop using the fast namespace
2022-02-01 23:17:22 +01:00
Hans-Kristian Arntzen
53d94a982e
Merge pull request #1852 from KhronosGroup/fix-1850
MSL: Rethink how opaque descriptors are passed to leaf functions.
2022-01-18 15:25:32 +01:00
Hans-Kristian Arntzen
5a29181b35
Merge pull request #1851 from KhronosGroup/fix-1835
Handle aliased names in spec constants.
2022-01-18 15:25:17 +01:00
Hans-Kristian Arntzen
5b952d2cbf MSL: Rethink how opaque descriptors are passed to leaf functions.
We were passing arrays by value which the compiler fails to optimize,
causing abyssal performance. To fix this, we need to consider that
descriptors can be in constant or const device address spaces.

Also, lone descriptors are passed by value, so we explicitly remove address
space qualifiers.

One failure case is when shader passes a texture/sampler array as an
argument. It's all UniformConstant in SPIR-V, but in MSL it might be
thread, const device or constant, so that won't work ...
Global variable use works fine though, and that should cover 99.9999999%
of use cases.
2022-01-18 14:40:52 +01:00
Hans-Kristian Arntzen
ac46140ba3 Test aliased names in declared LUTs. 2022-01-18 12:39:16 +01:00
Hans-Kristian Arntzen
48b5a9069f Handle aliased names in spec constants.
Need to register resource name.
2022-01-18 12:31:28 +01:00
Hans-Kristian Arntzen
08d5f5ed18
Merge pull request #1849 from KhronosGroup/fix-1844
MSL: Handle constant construct of block-like array types.
2022-01-17 20:40:37 +01:00
Hans-Kristian Arntzen
9b25581d49 MSL: Handle constant construct of block-like array types.
Need this to be context sensitive, since array of block-like struct is
template, but struct of block-like array is C-style.

Also, test a mix and match, so we have constant array of block-like
struct with array inside. :v
2022-01-17 18:28:25 +01:00
Hans-Kristian Arntzen
79b13813c6
Merge pull request #1848 from KhronosGroup/fix-1843
MSL: Handle signed atomic min/max.
2022-01-17 16:55:35 +01:00
Hans-Kristian Arntzen
5a5be7f9b9 MSL: Handle signed atomic min/max.
C++ deduces this based on the pointer type, so cast to atomic_uint/int
if we have to.
2022-01-17 15:40:58 +01:00
Hans-Kristian Arntzen
7dd974b9db
Merge pull request #1847 from KhronosGroup/fix-1775
Rework how loop iteration counts are validated.
2022-01-17 14:55:56 +01:00
Hans-Kristian Arntzen
e940577fba
Merge pull request #1846 from KhronosGroup/fix-1760
Do not forward expressions which carry a huge amount of dependencies.
2022-01-17 14:55:46 +01:00
Hans-Kristian Arntzen
1d13a3e36a Rework how loop iteration counts are validated.
Introduces an idea of a recompilation making forward progress.

There are some extreme edge cases where we need more than 3 loops, but
only allow this in specific circumstances where we can reason about
forward progress being made.
2022-01-17 14:12:01 +01:00
Hans-Kristian Arntzen
ef6bde6580 Do not forward expressions which carry a huge amount of dependencies.
Need to force temporaries eventually, or compilers have a tendency to
explode.
2022-01-17 13:45:12 +01:00
Hans-Kristian Arntzen
a1bb29ccbb
Merge pull request #1845 from KhronosGroup/pr-1842-fix
Fixups for PR 1842
2022-01-14 15:42:56 +01:00
Hans-Kristian Arntzen
017cdfe25b Update references for GL_EXT_texture_buffer. 2022-01-14 14:57:24 +01:00
miomioreimu
4407c0dd14 fix: GL_EXT_texture_buffer is more common than GL_OES_texture_buffer 2022-01-10 16:49:45 +08:00
Hans-Kristian Arntzen
fe5a0aa72f
Merge pull request #1839 from KhronosGroup/spv1.6
Add sanity test for SPIR-V 1.6 modules.
2022-01-06 15:51:11 +01:00
Hans-Kristian Arntzen
e8b30cc31d
Merge pull request #1838 from KhronosGroup/fix-1811
Support LocalSizeId
2022-01-06 14:41:29 +01:00
Hans-Kristian Arntzen
7c12228359 Add sanity test for SPIR-V 1.6 modules.
Just verify that we don't blow up on these modules.
2022-01-06 14:16:28 +01:00
Hans-Kristian Arntzen
7c83fc22fa Add support for LocalSizeId.
WorkgroupSize builtin is deprecated in 1.6 and LocalSizeId is supported
in Vulkan starting with maintenance4.
2022-01-06 13:57:10 +01:00
Hans-Kristian Arntzen
35bb328443 Test: Add --allow-localsizeid flag for spirv-val. 2022-01-06 13:52:27 +01:00
Hans-Kristian Arntzen
eadca962c8
Merge pull request #1837 from KhronosGroup/roll-deps
Roll dependencies.
2022-01-05 17:33:39 +01:00
Hans-Kristian Arntzen
a10d72e3b1
Merge pull request #1834 from chirsz-ever/chirsz/fix-msl-copy-array
MSL: Allow copy array from UniformConstant storage
2022-01-05 16:10:18 +01:00
Hans-Kristian Arntzen
fe8848a6f2 Roll dependencies. 2022-01-05 14:56:01 +01:00
Hans-Kristian Arntzen
9c0b74f73b
Merge pull request #1836 from KhronosGroup/pr-1824-fixup
Fix incorrect TessCoord type in some cases
2022-01-05 14:13:23 +01:00
Hans-Kristian Arntzen
be333e0cab MSL: Move float2->3 TessCoord fixup to a better location. 2022-01-05 13:32:17 +01:00
Hans-Kristian Arntzen
2793d22af5 Merge branch 'master' of git://github.com/cfnptr/SPIRV-Cross 2022-01-05 12:53:45 +01:00
Hans-Kristian Arntzen
e0ae55d5e2
Merge pull request #1822 from etra0/add-diff
test_shaders: Add the option to generate diff instead.
2022-01-05 12:45:19 +01:00
Hans-Kristian Arntzen
55a0291ce5
Merge pull request #1817 from etra0/fix-1784
Clamp vector element access to vector size.
2022-01-05 12:43:24 +01:00
chirsz-ever
90c252274d
MSL: Allow copy array from UniformConstant storage 2022-01-05 17:45:21 +08:00
Nikita Fediuchin
2acf0e73dd Fix gl_TessCoord arguments presence. Update reference shaders.
* Added check for "gl_TessCoord" presence in the entry point arguments.
* Updated reference tessellation evaluation shaders.
2021-12-20 22:58:21 +02:00
Nikita Fediuchin
a66984072b Fix incorrect MSL gl_TessCoord variable type
Adds "In" postfix to the "gl_TessCoord" on entry point arguments decompilation stage if built in type is "BuiltInTessCoord" and execution mode is "ExecutionModeQuads". And declares shadow  variable "gl_TessCoord" on entry point declarations.
2021-12-17 22:51:18 +02:00
Sebastián Aedo
2bb051206b test_shaders: Add the option to generate diff instead.
Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-12-09 13:38:03 -03:00
Sebastián Aedo
905b8244e7 Clamp vector element access to vector size.
In cases where we know the size of the vector and the index at compile
time, we can check if it's accessing in bounds and rely in undefined
behavior otherwise.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-12-07 16:00:06 -03:00
Hans-Kristian Arntzen
e9cc640334
Merge pull request #1815 from etra0/fix-1768
MSL: Add 64 bit switch support
2021-11-30 14:21:40 +01:00
Hans-Kristian Arntzen
25868923da
Merge pull request #1819 from sindney/master
ESSL: Throw if array input var is found in vs.
2021-11-30 14:18:25 +01:00
Sebastián Aedo
6d8302ef14 MSL: Add 64 bit switch support
Add 64 bit switch support for MSL version 2.2.

* Also fixes a wrong endianness conversion.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-26 15:54:56 -03:00
xinhou
4b0584ce70 ESSL: Vertex shader input doesn't support array types. 2021-11-26 10:06:42 +08:00
Hans-Kristian Arntzen
37dfb3f45f
Merge pull request #1794 from etra0/master
Add 64 bit support for OpSwitch
2021-11-15 15:05:10 +01:00
Sebastián Aedo
5345051a85 Removed tracking of OpConstant and OpPhi.
We don't need to keep track of them because when the block.condition is
either a SPIRConstant or a SPIRVariable, we can get the type directly in
the get_case_list.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-13 14:13:30 -03:00
Hans-Kristian Arntzen
7c3cb0b12c
Merge pull request #1810 from billhollings/early-frag-tests-depth-out
MSL: Don't output depth and stencil values with explicit early fragment tests.
2021-11-13 16:25:51 +01:00
Bill Hollings
248e9ae9ed MSL: Don't output depth and stencil values with explicit early fragment tests.
Fragment shaders that require explicit early fragment tests are incompatible
with specifying depth and stencil values within the shader. If explicit early
fragment tests is specified, remove the depth and stencil outputs from the
output structure, and replace them with dummy local variables.

Add CompilerMSL:uses_explicit_early_fragment_test() function to consolidate
testing for whether early fragment tests are required.

Add two unit tests for depth-out with, and without, early fragment tests.
2021-11-12 14:17:00 -05:00
Sebastián Aedo
75e3752273 Added block.cases_32bit and reworked the cases fix
Now we added block.cases_32bit as requested and we only parse if the
remaining ops are a multiple of 2. None of them are mutable because we
return a reference of them depending of the op.condition width.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-12 12:50:39 -03:00