Commit Graph

2458 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
f59688b5d1 Workaround MSVC issue. 2019-10-07 12:40:21 +02:00
Hans-Kristian Arntzen
a0c13e4ee8 Do not consider aliased struct types if the master is not a block.
It is possible for a shader to declare two plain struct types which
simply share the same OpName without there being an implicit
value/buffer alias relationship.

For to_member_name(), make sure to use the type alias master when
resolving member names. The member name may be different in a type alias
master if the SPIR-V is being intentionally difficult.
2019-10-07 10:52:16 +02:00
Hans-Kristian Arntzen
2d20b1ab93 Run format_all.sh. 2019-10-07 10:29:04 +02:00
Hans-Kristian Arntzen
f5e6a5476f
Merge pull request #1166 from KhronosGroup/workgroup-size-spec-constant-reflect
Merge workgroup size support for JSON reflection
2019-10-04 15:51:44 +02:00
Hans-Kristian Arntzen
309e994224 Do not value compare JSON files for regression purposes.
0 was comparing equal to False. We expect text equality.
2019-10-04 11:04:52 +02:00
Hans-Kristian Arntzen
43e89bd269 Reflect: Deal with workgroup size being specialization constants. 2019-10-04 10:50:50 +02:00
Hans-Kristian Arntzen
1a20737af7 Merge branch 'reflect-workgroup_size' of git://github.com/res2k/SPIRV-Cross 2019-10-04 10:24:59 +02:00
Frank Richter
6bb2cf8bb0 reference: Update to include workgroup_size 2019-10-03 17:06:30 +02:00
Frank Richter
227a004b57 reflection: Write workgroup_size to JSON for compute shaders 2019-10-03 16:36:17 +02:00
Lukas Hermanns
f3a6d28a1d Further updates for pull request #1162; also added two test cases for spvCubemapTo2DArrayFace function and added '--msl-framebuffer-fetch'/ '--msl-emulate-cube-array' compiler options. 2019-09-27 15:49:54 -04:00
Lukas Hermanns
c3d6022956 Update for pull request #1162 rev. 1 2019-09-24 18:13:04 -04:00
Lukas Hermanns
7ad0a84778 Updates for pull request #1162 2019-09-24 14:35:25 -04:00
Lukas Hermanns
37df74035b Merge branch 'ue4_dev' 2019-09-20 09:42:42 -04:00
Lukas Hermanns
9f9276f5ce Fixed false-positive optimization of builtin variables (may happen when 'spvOut' is emitted). 2019-09-19 14:44:30 -04:00
Hans-Kristian Arntzen
5431e1da2d
Merge pull request #1161 from KhronosGroup/roll-deps-merge
Merge dependency update
2019-09-19 10:41:43 +02:00
Hans-Kristian Arntzen
02c34fe575 Update SPIR-V headers. 2019-09-19 10:26:04 +02:00
Hans-Kristian Arntzen
3c11254ece MSL: Fix 16-bit integer literals.
There is no suffix, so bitcasts failed.
2019-09-19 10:19:51 +02:00
Hans-Kristian Arntzen
470fd76fd4 Merge branch 'rollDEPS' of git://github.com/zoddicus/SPIRV-Cross 2019-09-19 09:52:17 +02:00
Ryan Harrison
cf1bf1c6ae Update external/ to SPIR-V 1.5
Rolled the hashes used for glslang, SPIRV-Tools, and SPIRV-Headers to
HEAD, which includes the update to 1.5.

Added passing '--amb' to glslang, so I didn't have to explicitly set
bindings in a large number of test shaders that currently don't, and
now glslang considers them invalid.

Marked all shaders that no longer pass spirv-val as .invalid.
2019-09-18 16:04:27 -04:00
Lukas Hermanns
744cc3e595 Updated test shaders. 2019-09-18 14:18:22 -04:00
Lukas Hermanns
50ac6862ac Rearranged all 'UE Change' comments to match to project's coding style. 2019-09-18 14:03:54 -04:00
Hans-Kristian Arntzen
d821a90091
Merge pull request #1159 from KhronosGroup/fix-1157
CMake: Add option to force -fPIC.
2019-09-18 11:41:11 +02:00
Hans-Kristian Arntzen
467d970704 CMake: Add option to force -fPIC.
Used by projects who might embed SPIRV-Cross as part of a shared
library, but not exported.
2019-09-18 10:00:25 +02:00
Lukas Hermanns
137e9d6d98 Removed reference specifiers in 'spvFMul*' functions to avoid address specifiers. 2019-09-17 16:50:33 -04:00
Lukas Hermanns
cb3ecb9e1b Updated reference Metal shaders. 2019-09-17 15:11:19 -04:00
Lukas Hermanns
51be601922 Avoid emitting 'spvUnsafeArray<>', 'spvFMul*', and 'spvFAdd' custom functions if they are not needed. 2019-09-17 15:10:39 -04:00
Lukas Hermanns
36eab88b23 Further adjustments to make Metal backend work again in UE4 on Mac. 2019-09-17 11:40:01 -04:00
Hans-Kristian Arntzen
87a3d4cf44
Merge pull request #1156 from KhronosGroup/fix-1155
Disable -Werror by default in CMake, fix -Wshorten-64-to-32 warnings.
2019-09-17 12:39:13 +02:00
Hans-Kristian Arntzen
c3ff67c3f0 Fix -Wshorten-64-to-32 warnings. 2019-09-17 10:18:38 +02:00
Lukas Hermanns
0be20cd933 Renamed new test shaders to fit the naming convention in SPIRV-Cross. 2019-09-16 10:33:45 -04:00
Hans-Kristian Arntzen
f20011733a
Merge pull request #1154 from KhronosGroup/fix-1153
CMake: Add option to skip installation targets.
2019-09-16 11:40:17 +02:00
Hans-Kristian Arntzen
9b9ea1fac6 CMake: Add option to skip installation targets. 2019-09-16 10:21:28 +02:00
Lukas Hermanns
7cf5d4f7a1 Added a new 'emulate_cube_array' option to SPIRV-Cross to cope with translating TextureCubeArray into texture2d_array for iOS where this type is not available. (Original Author: Mark Satterthwaite) 2019-09-13 17:24:27 -04:00
Lukas Hermanns
9573faa56d Removed all '.DS_Store' files. 2019-09-13 14:04:32 -04:00
Lukas Hermanns
a9f3c981d9 Adjustments after rebase of ue4_dev branch. 2019-09-13 14:03:02 -04:00
Hans-Kristian Arntzen
c13e951634
Merge pull request #1152 from KhronosGroup/fix-1151
Consider discard and demote as impure statements.
2019-09-12 15:12:29 +02:00
Mark Satterthwaite
c4f9704af0 OpImageTexelPointer needs to use an int coordinate type for GLSL, but not for MSL. 2019-09-12 08:52:08 -04:00
Mark Satterthwaite
fdaf9b47bd Remove obsolete memory barrier scope specification from Metal output, this API has been removed. 2019-09-12 08:35:28 -04:00
Mark Satterthwaite
69b703f1da Add an option to SPIRV-Cross to enforce invariant floating point math to prevent different depth calculation between prepass & basepass when running on Metal 2.0 and earlier. 2019-09-12 08:35:15 -04:00
Hans-Kristian Arntzen
bfa76ee2ab Consider discard and demote as impure statements.
Fixes cases where discard and demote are called in pure functions and
the function result is not consumed.
2019-09-12 14:21:10 +02:00
Mark Satterthwaite
e4c6388571 More fixes to handling packing & access elements in an array. Made in two parts. 1. Don't allow AccessChain operations to add duplicated swizzles when accessing packed arrays. 2. Only pack arrays when there is the proper amount of space between members in a struct, otherwise it will definitely be wrong. 2019-09-11 16:15:10 -04:00
Mark Satterthwaite
564cb3c08d Update the Metal shaders to account for changes in the shader compilation. 2019-09-11 15:06:05 -04:00
Mark Satterthwaite
b491806b47 Fix texture swizzling. 2019-09-11 14:56:54 -04:00
Mark Satterthwaite
869d628521 The result of an AccessChain intrinsic in SPIRV can be referenced by multiple blocks but when they are loops that can result in compilation problems because the source variables might not be declared early enough. This forces us to hoist those variables high enough to make it work. 2019-09-11 14:01:40 -04:00
Mark Satterthwaite
a80c74b40e There are occasions where phi-variable copies are introduced for original variables which are fully declared, which coud result in the phi-variable never being declared and the shader not compiling, so declare the phi-variables when this happens. Change made in two parts. 1. Ensure that we declare phi-variable copies even if the original declaration isn't deferred. 2. Only flush phi variables once, avoids duplicate definitions. 2019-09-11 14:00:49 -04:00
Mark Satterthwaite
2af70b837c When converting from HLSL the dxc SPIRV output often contains variables that are written through (e.g. a = b = c;) which seems to break the tracking of expressions in SPIRV-Cross, so don't reset everything once configured. 2019-09-10 13:25:20 -04:00
Mark Satterthwaite
842e8c48c6 Provide the Metal bindings as part of the options structure as that is more convenient. 2019-09-10 13:24:59 -04:00
Mark Satterthwaite
9e54a8dd7b Slight modifications to IAB support for Metal output, so that the caller can specify an offset for the IAB start index, as for HLSL shaders UAVs need to occupy slots 0-7. The runtime support for SSBO robustness is also much simpler if the buffer size block is at index 0. Change made in two parts. 1. Allow the caller to specify the Metal translation should use argument buffers. 2. Move this to the front of IABs for convenience of the runtime. 2019-09-10 13:09:49 -04:00
Mark Satterthwaite
d9f3576305 Metal doesn't automatically enforce robust access to buffers unlike other APIs, so for storage-buffers, which become raw T* buffers in Metal, we need to fetch the buffer size and clamp the access to a valid index within the buffer ourselves. This is essential for shaders converted from HLSL which expects all resource access to be robust, though this implementation is technically different to the HLSL specification of return-0 for OOB reads, ignore OOB writes. 2019-09-10 12:32:32 -04:00
Mark Satterthwaite
0428faada3 HLSL makes position calculations invariant by default to eliminate problems with depth-precision, Apple added a similar qualifier for Metal 2.1 that can and should be used in Vertex & Domain/TessEval shaders for the same effect. 2019-09-10 11:47:40 -04:00