Commit Graph

130 Commits

Author SHA1 Message Date
dan elksnitis
2834fb7c85 [shaders] strip out some 5.2 deprecations
#rb Jason.Nadro
#preflight 63d9227ecf52968117a45f9a

[CL 23926994 by dan elksnitis in ue5-main branch]
2023-01-31 10:14:30 -05:00
Yuriy ODonnell
e5d4d76bed ShaderMinifier - Add basic namespace support
* Track namespaces for symbols
* Re-emit namespace scopes
* Conservatively include symbols from all namespaces in minified code (as if they were all global)
* Additional parsing work will be required to more accurately track used symbols based on active namespaces (i.e. handle `using` keyword, etc.)
* Added RemoveDeadCode() overload that takes an explicit list of required symbols instead of just an entry point name

#rb dan.elksnitis
#preflight 6398be5e35203bc7aa7f9b47

[CL 23494729 by Yuriy ODonnell in ue5-main branch]
2022-12-13 13:42:42 -05:00
yuriy odonnell
a9591ee1e1 ShaderMinifier - Disable some of the debug features by default
#rb none (trivial)
#preflight skip

[CL 23385508 by yuriy odonnell in ue5-main branch]
2022-12-04 02:56:30 -05:00
christopher waters
85bd9bb007 Moving ShaderSymbolExport implementation into its own compilation unit.
#jira none
#rb matt.peters
#preflight 637d24918b12eb83a7ddea74

[CL 23241530 by christopher waters in ue5-main branch]
2022-11-22 16:14:14 -05:00
dan elksnitis
a3253bae46 [shaders] tiny change to allow skipping output of directcompile.txt file ignoring bool in compile input (used in some forthcoming debug code which dumps extra copies of preprocessed shader code and doesn't need these)
#preflight 6377fcab8b12eb83a7e6e3d1
#rb Jason.Nadro

[CL 23235560 by dan elksnitis in ue5-main branch]
2022-11-22 10:25:53 -05:00
matt peters
df72d2d4e9 ShaderCompilerCommon: Fix missing symbols in monolithic editor build due to spurious inline keyword in on function definition.
#rb None, trivial
#rnx
#preflight None, fixing build break

[CL 23212668 by matt peters in ue5-main branch]
2022-11-18 20:36:49 -05:00
Matt Peters
3fc09ce67b Multiprocess editor support: Add the parameter -MultiprocessId=<N> to allow instances of the engine to have a unique id in their group of multiprocess instances.
MPCook and Shaders: Change ShaderSymbolExport to export to different .zip files when in a -MultiprocessId environment.
Add part of the implementation for merging the different zip files created by CookWorkers together. The rest of the implementation requires reading from .zip files and will be coming in a future change.

#rb Christopher.Waters, Zousar.Shaker
#rnx
#preflight 6377fcedfa348e8480e25a2b

[CL 23209604 by Matt Peters in ue5-main branch]
2022-11-18 18:47:21 -05:00
Yuriy ODonnell
398f6e6d79 ShaderMinifier - Add an option to preserve comment lines
#rb dan.elksnitis
#preflight 63630eac522c8f7ab36344e0

[CL 22943808 by Yuriy ODonnell in ue5-main branch]
2022-11-03 02:13:18 -04:00
yuriy odonnell
9de862ab0b Add UE::ShaderCompilerCommon::RemoveDeadCode() high-level wrapper for shader minifier, to be consistently used in all shader compiler back-ends
#preflight 635af3aa1b7de936a5295629
#rb jason.nadro

[CL 22850483 by yuriy odonnell in ue5-main branch]
2022-10-29 01:51:27 -04:00
dan elksnitis
ecab3b4a9a [shaders] refactor usf/directcompile.txt dump into a utility in ShaderCompilerCommon to reduce code duplication in the shader backends
#rb Jason.Nadro
#rb Christopher.Waters
#preflight 635bf1e1df01edd149f5727e

[CL 22829548 by dan elksnitis in ue5-main branch]
2022-10-28 11:45:49 -04:00
christopher waters
f5ff98f2e1 ShaderParameterParser cleanup
- Making ConstantBufferType a constructor only argument. This removes the duplicated logic of calling ShouldUseStableConstantBuffer.
- Moving ShouldUseStableConstantBuffer to ShaderCompilerCommon.
- Made UE::ShaderCompilerCommon::ParseParameterType array arguments const

#jira UE-166341
#rb Guillaume.Abadie
#preflight 634eeceea1527f6b3bda9ff0

[CL 22608320 by christopher waters in ue5-main branch]
2022-10-18 15:25:05 -04:00
christopher waters
93ae33e36e Fixing parsing resource types like "Texture3D < uint4 >" where the space between the type and the "<" prevented the type from being found.
#jira UE-166341
#rb yuriy.odonnell
#preflight 633f0069607039cbc1082ef0

[CL 22378331 by christopher waters in ue5-main branch]
2022-10-06 13:04:52 -04:00
Yuriy ODonnell
bdcb1cc814 Move duplicated implementations of ParseRayTracingEntryPoint() to ShaderCommon module
#preflight 631a28a0967ffc68fbe3d8a7
#rb jason.nadro

[CL 21900443 by Yuriy ODonnell in ue5-main branch]
2022-09-08 15:20:52 -04:00
christopher waters
bd14aa177e Moving bindless resource count validation into the new UE::ShaderCompilerCommon::ValidatePackedResourceCounts
#jira UE-161950
#rb kenzo.terelst, yuriy.odonnell
#preflight 6307a0d03703fd9528673032

[CL 21567446 by christopher waters in ue5-main branch]
2022-08-25 13:02:21 -04:00
christopher waters
a987160f55 Reworking the parameter rewrite code to do automatic bindless
- Refactoring FShaderParameterParser to use more string views since we can rely on OriginalParsedShader not changing.
- Split FShaderParameterParser::ParseAndMoveShaderParametersToRootConstantBuffer into smaller functions
- Moving FShaderParametersMetadata::IterateShaderParameterMembers into the only module it's used in, ShaderParameterParser.cpp
- Adding CFLAG_BindlessResources which will be set when ENABLE_BINDLESS_RESOURCES is set
- Adding CFLAG_BindlessSamplers which will be set when ENABLE_BINDLESS_SAMPLERS is set
- Adding resource/sampler detection and conversion to bindless in FShaderParameterParser

#jira UE-139616
#rb guillaume.abadie, jeannoe.morissette, yuriy.odonnell, laura.hermanns
#preflight 62d180cce468fcfd0b7001a0

[CL 21111994 by christopher waters in ue5-main branch]
2022-07-15 12:25:44 -04:00
Charles deRousiers
f28dbfe6dd Fix false-positive error when adding an empty TEXT("") macro to a shader.
#rb none
#jira none
#preflight 62c84bc3e060ecd065bc63a9

[CL 21036977 by Charles deRousiers in ue5-main branch]
2022-07-11 02:41:07 -04:00
Florin Pascu
f64fc575d2 Re-submiting with Mac fixes
Changed ShaderArchive, GlobalShaderCache, ShaderDebugInfo and Autogen to use ShaderPlatformName and not ShaderFormat when naming their output files.
#rb Jack.Porter, Chris.Waters, Mihnea.Balta, Jason.Nadro
#jira UE-120561
#preflight 62c31f6fc9410537282296c6

[CL 20937870 by Florin Pascu in ue5-main branch]
2022-07-04 19:06:33 -04:00
Florin Pascu
09cb19fcfd Backout 20871665 to fix Mac cook
#rb none
#jira none
#preflight 62be0c68d94b57687c3ff309

[CL 20904999 by Florin Pascu in ue5-main branch]
2022-06-30 17:41:55 -04:00
Florin Pascu
1844e8e514 Changed ShaderArchive, GlobalShaderCache, ShaderDebugInfo and Autogen to use ShaderPlatformName and not ShaderFormat when naming their output files.
#rb Jack.Porter, Chris.Waters, Mihnea.Balta, Jason.Nadro
#jira UE-120561
#preflight 62bbf93ae353c20ac2361d94

[CL 20871665 by Florin Pascu in ue5-main branch]
2022-06-29 04:19:06 -04:00
christopher waters
b28a0c467f Moving ShaderParameterParser into its own source files.
#jira none
#rb guillaume.abadie, kenzo.terelst
#preflight 62b0ecb8ec13d14b5a1897ba

[CL 20757788 by christopher waters in ue5-main branch]
2022-06-21 10:49:56 -04:00
christopher waters
1e01768e33 Bindless shader parameters
- Adding support for bindless resources/samplers. The loose resources have to be wrapped in a macro that generates an index and proxy resource when bindless is enabled. Reflection has to parse these differently from other resources since they're parsed as uint parameters. The runtime also has to bind these differently since they end up needing to find their real resource in the binding data and then update a constant buffer.
- To assist in conversions, the shader compiler will detect if a shader is compiled with both bindless and non-bindless resources/samplers and will emit errors if that is the case.
- Adding support for bindless Uniform Buffer resources/samplers. Because Uniform Buffers aren't per-shader, they'll always update their constants with the bindless indices of their resources.
- Adding more flags to FShaderCodePackedResourceCounts required changing all the array initializations to individual parameters since not all the new flags are used everywhere.
- No shaders have been configured to support bindless resources/samplers. Yet.

#jira UE-139616
#rb zach.bethel, arciel.rekman
#preflight 6282b8ec44349a6581a21a39

[CL 20250348 by christopher waters in ue5-main branch]
2022-05-17 16:30:48 -04:00
christopher waters
4e12726208 Migrating back to using UniformBuffer structs.
Since the cbuffer uses the same name as the struct, we have to rename the cbuffer using a consistent prefix. The reflection handling also needs to reinterpret the renamed cbuffer as the correct UniformBuffer.

#jira none
#rb mihnea.balta
#preflight 626c1762ce3959ce8fe7766e

[CL 20026049 by christopher waters in ue5-main branch]
2022-05-03 11:09:45 -04:00
eric mcdaniel
bf7658a0f6 [Backout] - CL19813742
- backing out due to assertions in Vulkan shader compiler
  - constant buffer renaming causes failures to lookup parameter name

#preflight 625f6ed5e239763df51ba585
#fyi christopher.waters

Original CL Desc
-----------------------------------------------------------------
Migrating back to using UniformBuffer structs.
Since the cbuffer uses the same name as the struct, we have to rename the cbuffer using a consistent prefix. The reflection handling also needs to reinterpret the renamed cbuffer as the correct UniformBuffer.

#jira none
#rb kenzo.terelst
#preflight 625edc5f034d8924cdcc35e2

[CL 19825755 by eric mcdaniel in ue5-main branch]
2022-04-19 22:40:31 -04:00
christopher waters
5c395bb058 Migrating back to using UniformBuffer structs.
Since the cbuffer uses the same name as the struct, we have to rename the cbuffer using a consistent prefix. The reflection handling also needs to reinterpret the renamed cbuffer as the correct UniformBuffer.

#jira none
#rb kenzo.terelst
#preflight 625edc5f034d8924cdcc35e2

[CL 19813742 by christopher waters in ue5-main branch]
2022-04-19 14:32:30 -04:00
christopher waters
46d39f296a Reorganizing reflection handling to funnel through common functions.
This is a prerequisite for upcoming bindless changes as it centralizes key points where we register the different binding types.

#jira none
#rb jason.nadro, eric.mcdaniel, jeannoe.morissette
#preflight 62574453f7476d662c8dd2fe

[CL 19761676 by christopher waters in ue5-main branch]
2022-04-14 15:46:20 -04:00