Interface variable scalar replacement pass rewrite (added as a new pass into spirv-opt, will replace existing one in future).
Things done so far:
- Rewritten to properly handle non-aggregate types and other tricky cases (both for Patch decorated variables and not)
- Matrix scalarization is now optional.
- More test cases added
- Path is now exposed as a command-line flag
- Fixed https://github.com/KhronosGroup/SPIRV-Tools/issues/4795
Few shaders contained loops, which were not unrolled, leading to the scalarization pass to fail. Loops were not unrolled due to "complex" condition expression. Those are changed to be accepted by the loop unroller (induction variable is the only lhs in the condition expression now).
This new pass is now always enabled for both Vulkan/GLES shaders for Android.
Multiple location remapping passes were removed: one was overriding another one results + not needed now due to arrays being removed by the scalarization pass.
#rb carl.lloyd, denys.mentiei
[FYI] Dmitriy.Dyomin, Allan.Bentham
[CL 34122278 by laura hermanns in ue5-main branch]
[FYI] denys.mentiei
Original CL Desc
-----------------------------------------------------------------
[Shaders] SPIRV-Tools pass rewrite
Interface variable scalar replacement pass rewrite (added as a new pass into spirv-opt, will replace existing one in future).
Things done so far:
- Rewritten to properly handle non-aggregate types and other tricky cases (both for Patch decorated variables and not)
- Matrix scalarization is now optional.
- More test cases added
- Path is now exposed as a command-line flag
- Fixed https://github.com/KhronosGroup/SPIRV-Tools/issues/4795
Few shaders contained loops, which were not unrolled, leading to the scalarization pass to fail. Loops were not unrolled due to "complex" condition expression. Those are changed to be accepted by the loop unroller (induction variable is the only lhs in the condition expression now).
This new pass is now always enabled for both Vulkan/GLES shaders for Android.
Multiple location remapping passes were removed: one was overriding another one results + not needed now due to arrays being removed by the scalarization pass.
#rb carl.lloyd, Laura.Hermanns
[FYI] Dmitriy.Dyomin, Allan.Bentham
[CL 34107760 by laura hermanns in ue5-main branch]
Interface variable scalar replacement pass rewrite (added as a new pass into spirv-opt, will replace existing one in future).
Things done so far:
- Rewritten to properly handle non-aggregate types and other tricky cases (both for Patch decorated variables and not)
- Matrix scalarization is now optional.
- More test cases added
- Path is now exposed as a command-line flag
- Fixed https://github.com/KhronosGroup/SPIRV-Tools/issues/4795
Few shaders contained loops, which were not unrolled, leading to the scalarization pass to fail. Loops were not unrolled due to "complex" condition expression. Those are changed to be accepted by the loop unroller (induction variable is the only lhs in the condition expression now).
This new pass is now always enabled for both Vulkan/GLES shaders for Android.
Multiple location remapping passes were removed: one was overriding another one results + not needed now due to arrays being removed by the scalarization pass.
#rb carl.lloyd, Laura.Hermanns
[FYI] Dmitriy.Dyomin, Allan.Bentham
[CL 34100366 by denys mentiei in ue5-main branch]
This adds "-Wno-unknown-attributes" to DXC backends and platform specific compiler argument to their respective backend.
#rnx
#rb Yuriy.ODonnell
[CL 33437776 by laura hermanns in ue5-main branch]
This affects Vulkan, Metal, GLES, and SPIR-V based platform backends.
Warnings will not be treated as errors for intermediate shader code, such as the one generated by the HLSL rewriter for dead-code removal.
#rnx
#rb carl.lloyd, massimo.tristano
[CL 31645356 by laura hermanns in ue5-main branch]
- Disabled by default
- Removed MetalDerivedData and moved shader compiler specific code to seperate files
#rb Laura.Hermanns
#jira UE-204112
[CL 31527482 by carl lloyd in ue5-main branch]
DxcCreateBlob apparently force adds this on creation of strings, so we need to account for that when creating a view of the result.
#rb dan.elksnitis, Laura.Hermanns
[CL 31311047 by christopher waters in ue5-main branch]
- add support to shaderconductor to load shader source from a FAnsiStringView
- remove internal string conversion helpers in favour of using FAnsiString
- don't make copies of input strings if they are provided in ANSI format
#rb Laura.Hermanns
[CL 30594203 by dan elksnitis in ue5-main branch]
- add FShaderSource class which wraps source as populated by preprocessing and subsequently accessed by compilation and other debug features; this class automatically inserts zeroed padding such that 16-byte-wide SIMD string comparison operations do not require a non-SIMD tail to process any overhang.
- add typedefs for the string/view/character types and update preprocessing code to use these typedefs instead of the explicit types
- add explicit if constexprs in minifier code around char width to disable simd optimizations for char width != 2 (and subsequently skip the non-simd tail if char width == 2 since FShaderSource automatically adds the required padding)
#rb Jason.Nadro, Yuriy.ODonnell
[CL 30358137 by dan elksnitis in ue5-main branch]
-Add a new define to wrap the output semantic that we want to be post declare as precise.
-Modify DXC-SIRV to add the NoContraction decorator on precise output semantics.
-Modify spirv_glsl to post declare as precise output semantics
-Example: out precise float4 gl_positon; will add precise gl_position; post declaration.
[REVIEW] [at]laura.hermanns
[CL 29338529 by serge bernier in ue5-main branch]
- Avoid explicit FMA instructions in platform-specific GLSL to let backend-compiler decide when to use them.
- Fix code refelction when using SPIR-V directly with backend-compiler.
- Define preset of SPIR-V optimization passes to reduce nested expressions "preset(relax-nested-expr)".
#rb Serge.Bernier, Brian.White
[FYI] Graeme.Thornton, Jason.Nadro, Carl.Lloyd, Florin.Pascu, Michael.WAnderson
#jira UE-195236, UE-194869
[CL 27994871 by laura hermanns in ue5-main branch]
* Major define optimization involves converting map of defines to use FName keys and variant values rather than strings -- this eliminates most of the cost of string hashing, allocation, and conversion.
* Lower overhead FHashTable used instead of TMap.
* An initial map of defines can optionally be provided globally. Anything using an initial define can have its map index cached for optimized lookup when reading or writing.
Other micro-optimizations:
* Added Reserve calls for uniform buffer related maps, to eliminate map resizing / rehashing. Saved around 15% perf (after define optimizations).
* Added a map for UB lookup, instead of iterating through the linked list. Saved around 10% perf.
Non-optimization: Sort the order in which uniform buffer variable names are searched in BuildShaderFileToUniformBufferMap, to create determinism in ShaderDebug data for A/B testing (previously order was dependent on global constructor order for UB definitions, which could vary arbitrarily with unrelated changes).
#jira UE-187334
#rnx
#rb dan.elksnitis jason.nadro yuriy.odonnell
[CL 26142884 by jason hoerner in ue5-main branch]
- Support structured buffers in HLSL backend of SPIRV-Cross (PR #2143).
- Integrate SPIRV-Cross fix to forward opaque types in GLSL backend (PR #2110).
- Integrate SPIRV-Cross fix to use actual field offset to validate vec4 boundary alignment (#PR 2139).
- Integrate SPIRV-Cross fix to not restrict SV_RenderTargetArrayIndex to GS and MS (#PR 2138).
- Make SV_Position decoration as implicitly invariant optional (Used to address Z-fighting issues in Vulkan and Metal; Drastically impacts vertex shader performance on certain platforms).
- Don't force DXC for all shaders when r.Substrate is enabled.
#jira UE-174555
#rb Sebastien.Hillaire, Carl.Lloyd, Dan.Elksnitis
#fyi Brian.White, Jason.Nadro, JeaNoe.Morissette, Yuriy.Odonnell, Guillaume.Abadie
#preflight 6453d3df0e33f2d51d2b032e
[CL 25353473 by Laura Hermanns in ue5-main branch]