Commit Graph

3248 Commits

Author SHA1 Message Date
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
Hans-Kristian Arntzen
401296d3b8
Merge pull request #1808 from billhollings/depth-img-vs-depth-cmp
Separate (partially) the tracking of depth images from depth compare ops.
2021-11-12 10:41:28 +01:00
Sebastián Aedo
03f678dec4 Cast the switch selector in GLSL to uint32_t
We can safely cast the value since we check previously that we're not
using a uint64_t as the selector.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-11 09:58:46 -03:00
Bill Hollings
fd252b21ff Separate (partially) the tracking of depth images from depth compare ops.
SPIR-V allows an image to be marked as a depth image, but with a non-depth
format. Such images should be read or sampled as vectors instead of scalars,
except when they are subject to compare operations.

Don't mark an OpSampledImage as using a compare operation just because the
image contains a depth marker. Instead, require that a compare operation
is actually used on that image.

Compiler::image_is_comparison() was really testing whether an image is a
depth image, since it incorporates the depth marker. Rename that function
to is_depth_image(), to clarify what it is really testing.

In Compiler::is_depth_image(), do not treat an image  as a depth image
if it has been explicitly marked with a color format, unless the image
is subject to compare operations.

In CompilerMSL::to_function_name(), test for compare operations
specifically, rather than assuming them from the depth-image marker.

CompilerGLSL and CompilerMSL still contain a number of internal tests that
use is_depth_image() both for testing for a depth image, and for testing
whether compare operations are being used. I've left these as they are
for now, but these should be cleaned up at some point.

Add unit tests for fetch/sample depth images with color formats and no compare ops.
2021-11-08 15:59:45 -05:00
Sebastián Aedo
48046646ee Fixed wrong condition and formatting.
Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-08 15:21:19 -03:00
Hans-Kristian Arntzen
2e0fb3a778
Merge pull request #1807 from KhronosGroup/fix-1801
GLSL: Deal with buffer_reference_align.
2021-11-07 18:15:21 +01:00
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
Hans-Kristian Arntzen
1adc53b107
Merge pull request #1806 from KhronosGroup/fix-1777
CFG: Handle degenerate selection constructs.
2021-11-07 14:10:48 +01:00
Hans-Kristian Arntzen
21a15b90e5
Merge pull request #1804 from KhronosGroup/fix-1759
MSL: Handle non-thread storage class in Modf/Frexp pointer versions.
2021-11-07 13:36:32 +01:00
Hans-Kristian Arntzen
2714f5410c CFG: Handle degenerate selection constructs.
Apparently, it's legal to use a selection construct where both paths
branch to same location, but a different merge point is used.
This breaks many assumptions the variable scope analyzer makes.

The only logical way to generate code for this scenario is to treat the
selection construct as a trivial switch construct with only a default
case.
2021-11-07 13:32:29 +01:00
Hans-Kristian Arntzen
e40d19bdbf MSL: Handle non-thread storage class in Modf/Frexp pointer versions. 2021-11-07 12:51:15 +01:00
Hans-Kristian Arntzen
f1d4aff85e
Merge pull request #1805 from KhronosGroup/fix-1776
Handle Modf/Frexp in more cases.
2021-11-07 12:36:42 +01:00
Hans-Kristian Arntzen
2c53d30664
Merge pull request #1803 from KhronosGroup/fix-1802
Correctly reflect declared buffer size for out of order members.
2021-11-07 12:35:03 +01:00
Hans-Kristian Arntzen
4561ecddbd Handle Modf/Frexp in more cases.
Consider it a write to a variable, similar to OpStore.
2021-11-07 11:36:44 +01:00
Hans-Kristian Arntzen
d295c2a046
Merge pull request #1800 from EddeDev/master
Fixed potential compilation error in spirv_cross_containers.hpp
2021-11-07 10:36:05 +01:00
Hans-Kristian Arntzen
849978653a
Merge pull request #1798 from billhollings/tess-output-clip
MSL: Correctly emit user(clip/cullN) for clip/cull builtins in tess output struct.
2021-11-07 10:35:24 +01:00
Hans-Kristian Arntzen
05e8e5a953 Correctly reflect declared buffer size for out of order members.
Need to deduce size based on member with highest offset, not highest
index.
2021-11-07 10:08:17 +01:00
Edvin Pettersson
4dcf64a99b
Fixed potential compilation error in spirv_cross_containers.hpp 2021-11-05 01:39:35 +01:00
Sebastián Aedo
250a02967d Removed unnecessary tracking of types.
We don't need to keep track of the type itself, only its width since the
type check of the OpSwitch can be done at runtime. This also avoids
creating a dangling reference.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-03 16:12:14 -03:00
Bill Hollings
4ebd56bf9e MSL: Correctly emit user(clip/cullN) for clip/cull builtins in tess output struct.
Only emit user(locnN) for tess builtin input variables, and allow output builtin
to emit user(clip/cullN). Previously, output builtin would emit location if
input builtin also existed.
2021-11-03 00:03:26 -04:00
Sebastián Aedo
f099d714f3 Removing logic in the parser
Moving out the logic from the parser as requested because it's sensitive
to try to keep the parsing the most simple process as said.

For that, the load_types is now tracked in the ParsedIR, which can be
accessed in the Compiler struct. The switch cases are fixed in the CFG
stage since that's the point where the nullptr is deref.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-02 17:17:13 -03:00
Hans-Kristian Arntzen
04293e03fd
Merge pull request #1797 from KhronosGroup/clone-protocol
Always use https protocol when cloning external test deps.
2021-11-02 18:00:59 +01:00
Hans-Kristian Arntzen
0d03516382 Always use https protocol when cloning external test deps.
git:// is deprecated now and is starting to fail.
2021-11-02 17:36:22 +01:00
Hans-Kristian Arntzen
061397e32e
Merge pull request #1792 from billhollings/uniform-struct-packing-nested
MSL: Remove over-zealous check for struct packing compatibility.
2021-11-01 13:02:16 +01:00
Sebastián Aedo
3eb5532979 Add 64 bit support for OpSwitch
According to the spec, if the `condition` has a type wider than 32 bits,
the literals to be compared with will be of that size as well.

This caused some misalignments if the `condition` was bigger than 32,
causing a nullptr return without further explanation.

Currently neither GLSL nor MSL supports uint64 as the condition but the
SPIRV allows it anyway.

This also fixes #1768.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-10-29 11:02:16 -03:00
Bill Hollings
be812c45e5 MSL: Remove over-zealous check for struct packing compatibility.
Previous test for SPIRVCrossDecorationPhysicalTypePacked on parent struct
when unpacking member struct was too restrictive, and not needed as long
as padding compensates.
2021-10-28 19:36:32 -04:00
Hans-Kristian Arntzen
66adba17a8
Merge pull request #1791 from billhollings/msl-out-of-order-struct-offsets
MSL: Fix type redirection when struct members are reordered to align with offsets.
2021-10-28 18:03:54 +02: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