Commit Graph

2302 Commits

Author SHA1 Message Date
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
Mark Satterthwaite
9ce3158193 When compiling from HLSL which pads and aligns float[]/float2[] within structures to float4[] we need to unpack the original type in Metal from the float4. 2019-09-10 11:21:43 -04:00
Mark Satterthwaite
40a4456a54 Fix conversion of the SampleMask intrinsic from SPIRV, where it is an array to Metal where it isn't. 2019-09-10 10:46:42 -04:00
Mark Satterthwaite
42b8a62870 Fixes to the generation of Metal tessellation shaders from SPIRV so that it works correctly in more complicated cases.
First, when generating from HLSL before invoking the code that comes from the HLSL patch-function a control-flow and full memory-barrier are required to ensure that all the temporary values in thread-local storage for the patch are available.
    Second, the inputs to control and evaluation shaders must be properly forwarded from the global variables in SPIRV to the member variables in the relevant input structure.
    Finally when arrays of interpolators are used for input or output we need to add an extra level of array indirection because Metal works at a different granularity than SPIRV.

    Five parts.
    1. Fix tessellation patch function processing.
    2. Fix loads from tessellation control inputs not being forwarded to the gl_in structure array.
    3. Fix loads from tessellation evaluation inputs not being forwarded to the stage_in structure array.
    4. Workaround SPIRV losing an array indirection in tessellation shaders - not the best solution but enough to keep things progressing.
    5. Apparently gl_TessLevelInner/Outer is special and needs to not be placed into the input array.
2019-09-10 10:37:07 -04:00
Mark Satterthwaite
de6441af88 Work-around HLSL using zero-based InstanceID and VertexID variables, but SPIRV, like Metal, includes BaseInstance & BaseVertex. Until this can be fixed in DXC, which is really the proper place to solve this, we can decrement InstanceID & VertexID when the source is HLSL. Made in two parts. 1. Handle HLSL-style 0-based vertex/instance index. 2. We zero-base the InstanceID & VertexID variables for HLSL emulation elsewhere, so don't do it twice. 2019-09-09 16:55:59 -04:00
Mark Satterthwaite
97a66ff906 On iOS sub-passes can be implemented using the frame-buffer fetch API which is much more efficient than binding the textures. Change was made in three parts. 1. Use Metal's native frame-buffer fetch API for subpass inputs. 2. Make sure that frame-buffer-fetch is only available on iOS. 3. Default to using Metal's native frame-buffer fetch for subpass inputs on iOS. 2019-09-09 15:02:11 -04:00
Hans-Kristian Arntzen
b32a1b4150
Merge pull request #1150 from wadetb/master
MSL: Fix array copies to/from interpolators
2019-09-08 22:31:43 +02:00