Commit Graph

15 Commits

Author SHA1 Message Date
yuriy odonnell
355a38075e Fix compile error on linux/mac due to indexing arrays with char type
#rb none

[CL 28699927 by yuriy odonnell in ue5-main branch]
2023-10-11 23:46:03 -04:00
yuriy odonnell
dd72ffe26c ShaderMinifier - Optimize BuildLineBreakMap, SkipUntilNonIdentifierCharacter, ExtractIdentifiers and few other bits
* Generate line directive map during parsing
* Use xxhash instead of cityhash
* Avoid FStringView operator [] in ExtractIdentifiers
* Use TArray Reset instead of Empty where appropriate
* Vectorize SkipUntilNonIdentifierCharacter
* Vectorize ExtractBlock
* Vectorize line ending search
* Use FString directly instead of FStringBuilderBase for the final output to avoid a copy

#rb christopher.waters
#rb jason.hoerner

[CL 28699609 by yuriy odonnell in ue5-main branch]
2023-10-11 23:32:28 -04:00
yuriy odonnell
eb793d3fb5 ShaderMinifier - Use inline implementations of string view Equals and StartsWith
* Also use TEXTVIEW instead of TEXT where possible
* ~1.5x speedup

#rb dan.elksnitis

[CL 28494884 by yuriy odonnell in ue5-main branch]
2023-10-05 08:26:07 -04:00
christopher waters
9b84b8accd Fixing enum handling in the shader minifier. Since the enum elements weren't marked as reachable identifiers, the minifier was considering the whole enum block unused.
#rb yuriy.odonnell

[CL 28438918 by christopher waters in ue5-main branch]
2023-10-03 19:32:26 -04:00
yuriy odonnell
d635588f1b ShaderMinifier - Don't skip keyword blocks when building ChunksByIdentifier (temporary workaround for an issue introduced in 28384399)
#rb christopher.waters

[CL 28417897 by yuriy odonnell in ue5-main branch]
2023-10-03 12:08:28 -04:00
yuriy odonnell
86d5bb7306 ShaderMinifier - Add basic support for global operator overloads
#rb christopher.waters

[CL 28417810 by yuriy odonnell in ue5-main branch]
2023-10-03 12:06:47 -04:00
christopher waters
c1487a0042 Adding typedef support to ShaderMinifier.
- Before this, every typedef and the code using them was being included in the final source.
- This was primarily affecting Bindless Resources where all bindless resources were included in the minified code even if they weren't used.

#rb yuriy.odonnell

[CL 28365749 by christopher waters in ue5-main branch]
2023-09-30 11:10:06 -04:00
christopher waters
5dc4ce553d Removing redundant line directives from Shader Minifier.
#rb yuriy.odonnell

[CL 27872540 by christopher waters in ue5-main branch]
2023-09-14 05:20:23 -04: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
6911020bba ShaderMinifier - Fix handling of anonymous struct shader parameters
Declarations like `struct { uint Param; } Foo;` were previously incorrectly removed from code.

Also report explicit error when encountering 'namespace' keyword (which is currently unsupported)

#preflight 6387c5b1f213a116ebc18c5f
#rb dan.elksnitis

[CL 23343976 by Yuriy ODonnell in ue5-main branch]
2022-11-30 18:57:20 -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
f9824703c2 ShaderMinifier - Add basic test for MinifyShader, change SkipUntilNextLine to exclude new line character
#rb none (trivial)
#preflight 636068cde271e75dea59c739

[CL 22876523 by Yuriy ODonnell in ue5-main branch]
2022-10-31 21:34:29 -04:00
Yuriy ODonnell
9ab9403717 ShaderMinifier - Track and output line directives
#rb Jason.Nadro
#preflight 63406dd22a0a2c1ead8d1145

[CL 22405822 by Yuriy ODonnell in ue5-main branch]
2022-10-07 14:31:38 -04:00
Yuriy ODonnell
7e99cc870a ShaderMinifier - Ignore known resource types when looking for potential identifier names. Also add inclusion reason tracking for global variables.
#rb Jason.Nadro
#preflight 6322645eb602881e8e54709f

[CL 22029907 by Yuriy ODonnell in ue5-main branch]
2022-09-15 11:33:09 -04:00
Yuriy ODonnell
a18b223061 Groundwork for custom shader preprocessing step that removes unused code from shader source before compilation (not used yet by the shader pipeline)
#preflight 631bca62304480f8f8c2db54
#rb Jason.Nadro

[CL 21931128 by Yuriy ODonnell in ue5-main branch]
2022-09-09 19:33:52 -04:00