Commit Graph

314 Commits

Author SHA1 Message Date
christopher waters
bb0a274b8c Reworking UniformBuffer code generation to not use an intermediate struct
- When generating Uniform Buffer HLSL code, a 'static const struct {} Name' was created which has been causing compiler issues off and on for years.
- When RemoveUniformBuffersFromSource removed said struct, it parsed the struct's structure to figure out how to translate UniformBuffer.Member into UniformBuffer_Member in code that accessed Uniform Buffers.
- Now, instead of a struct, a "UniformBuffer <Name>" declaration is created and filled with mappings from "UniformBuffer.Member" into the correct code.
- This allows ConstantBuffer objects to be used differently from cbuffer where the former generates "UniformBuffer.Member" and the latter generates "UniformBuffer_Member"
- This also allows resources to always be translated to "UniformBuffer_Member"
- Shader define 'PLATFORM_SUPPORTS_UB_STRUCT' is now 'PLATFORM_SUPPORTS_CONSTANTBUFFER_OBJECT' and will be set on shader formats that support ConstantBuffer<> objects.
- Removed lots of unused code from BindlessResources.ush

#jira UE-195103
#rb dan.elksnitis, jeannoe.morissette

[CL 28058373 by christopher waters in ue5-main branch]
2023-09-20 17:33:36 -04:00
carl lloyd
802f14d2bf Change Texture2DArray's to flatten by texture name instead of using shader names.
#rb jeannoe.morissette

[CL 27823019 by carl lloyd in ue5-main branch]
2023-09-13 05:09:45 -04:00
dan elksnitis
df634c7352 [shaders] metal shader format: enable minifier and migrate to independent preprocessing API
#rb Laura.Hermanns

[CL 27631995 by dan elksnitis in ue5-main branch]
2023-09-06 09:24:57 -04:00
adam kinge
06a3585301 Required Metal shader compiler changes to support iOS Simulator. Set to disabled by default via "bEnableSimulatorSupport" in IOSRuntimeSettings.
#jira UE-168571
#rnx
#rb carl.lloyd, jack.porter
#lockdown jack.porter

[CL 27022463 by adam kinge in ue5-main branch]
2023-08-11 01:01:38 -04:00
david harvey
da9b5b86f5 Do not include PreWindowsApi.h / PostWindowsApi.h directly in code.
- mostly just replacing them AllowWindowsPlatformTypes.h / HideWindowsPlatformTypes.h
 - some other files had both Pre/PostWindowsApi.h and Allow/HideWindowsPlatformTypes.h, so just removed
 - some occasional include order changes.

#jira UE-152863
#rnx
#rb Devin.Doucette

[CL 26985385 by david harvey in ue5-main branch]
2023-08-10 03:34:53 -04:00
david harvey
bdb4199eeb Remove unnecessary WindowsHWrapper.h & MinWindows.h include - both files will be automatically included by AllowWindowsPlatformTypes.h
#jira UE-152863
#rnx
#rb Josh.Adams

[CL 26912096 by david harvey in ue5-main branch]
2023-08-08 05:50:53 -04:00
dan elksnitis
9a5a1b6f74 [shaders] minor include cleanup
#rb Jason.Hoerner
#rb Laura.Hermanns

[CL 26817718 by dan elksnitis in ue5-main branch]
2023-08-03 13:40:32 -04:00
dan elksnitis
5f85b46590 [shaders] remove unnecessary passing of hlslcc flags as an option to debug info output. this was just used to pass a switch on the SCW directcompile cmdline which SCW no longer does anything with. also cleaned up some additional unnecessary code related to these flags in backends that no longer use hlslcc at all.
#rb Laura.Hermanns

[CL 26685354 by dan elksnitis in ue5-main branch]
2023-07-28 15:58:01 -04:00
joe kirchoff
d31b8ce8a3 Resolve several module public include paths not using references
#rnx

[CL 26558470 by joe kirchoff in ue5-main branch]
2023-07-24 18:35:16 -04:00
jason hoerner
7f22080814 Shader Compiler: Made FShaderCompilerDefinitions private, to reduce code publicly visible in ShaderCore.h. For now, it's just marked deprecated for 5.4, but will be hidden more generally in 5.5.
#rnx
#rb yuriy.odonnell dan.elksnitis jason.nadro

[CL 26534998 by jason hoerner in ue5-main branch]
2023-07-22 06:35:10 -04:00
carl lloyd
cb320ed6b4 Fixed bug where arrays were flattened when not using SM6, also marked SM6 as experimental
Enabled distance fields for the desktop renderer on iOS

#jira UE-190249

[CL 26436063 by carl lloyd in ue5-main branch]
2023-07-18 12:01:11 -04:00
carl lloyd
c42df3f2f9 Fixes for Nanite on Mac
- Disable COMPILER_SUPPORTS_WAVE_VOTE for Mac
- Fixed bug where Texture2DArray was flattened due to atomics, but bound as Texture2D
- Fixed bug where defines were read incorrectly in shader compiler

#rb Zack.Neyland, Jamie.Hayes

[CL 26291315 by carl lloyd in ue5-main branch]
2023-06-28 13:49:35 -04:00
axel riffard
de98664667 Metal 3.1, iOS17 and tvOS17
#jira UE-187878
#rb adam.kinge
[FYI] jack.porter,  carl.lloyd,  zack.neyland,  josh.adams

[CL 26277868 by axel riffard in ue5-main branch]
2023-06-27 21:41:51 -04:00
carl lloyd
a793c2fcd1 Add support to enable an SM6 platform for Mac
#rb Zack.Neyland
#jira UE-184435

[CL 26062749 by carl lloyd in ue5-main branch]
2023-06-16 14:24:06 -04:00
jason hoerner
88d847a0ad GlobalBeginCompileShader optimizations. 3.2x improvement in performance of the function on Lyra cook:
* Early out when adding uniform buffer resource entries, by checking if uniform buffer had been processed, before processing individual entries.
* Changed resource entry list from a map to an array, saving the cost of map operations adding items to it.
* Resource entries for global uniform buffers cached once at startup.
* Resource entry member names stored in an external buffer, to avoid per-entry string memory allocation overhead.
* Miscellaneous smaller optimizations -- for example, using ByHash to avoid redundant hashing and FString construction.

#jira none
#rnx
#rb jason.nadro dan.elksnitis
#preflight 646cfdbc1134ffac7034af60

[CL 25596308 by jason hoerner in ue5-main branch]
2023-05-23 20:16:11 -04:00
christopher waters
20984328ea Removing the cvar lookup string for shader dead code removal in all shader formats. This cvar can't be loaded on SCW startup so it was causing a hash mismatch.
#rb yuriy.odonnell
#preflight 646bc8f764351d76f3c85f5e

[CL 25570191 by christopher waters in ue5-main branch]
2023-05-22 16:57:05 -04:00
dan elksnitis
26464b581b [shaders] further rework of parameter parser API to simplify the independent preprocessing use case, plus adding serialization support and some minor cleanup.
#preflight 6442af0ec023bb1f734fc0d1
#rb Christopher.Waters

[CL 25148947 by dan elksnitis in ue5-main branch]
2023-04-21 13:45:43 -04:00
Luke Thatcher
e6b40d3954 Major refactor of RHICreateShaderResourceView and RHICreateUnorderedAccessView functions - Merging //UE5/Dev-ParallelRendering (up to CL 24988990) to //UE5/Main
This changelist is a merge of work done in //UE5/Dev-ParallelRendering to remove tech debt in the SRV/UAV create functions. See individual changelist descriptions in that stream for further details, but a summary of the change is as follows:
 - We had multiple overloads of each of the RHICreateShaderResourceView and RHICreateUnorderedAccessView functions. Each function had a different set of supported view types and using them was complicated / ambiguous.
 - There's now only 2 create functions, and a common FRHIViewDesc descriptor struct, which is stored on the base view class.

 - FRHIView takes a reference on the underlying resource, ensuring that RHI views keep their viewed resource alive. This was not the case on some platforms, since it was previously the platform RHI implementation's responsibility.
 - Platform RHI implementations resolve an FRHIViewDesc into a full FViewInfo struct using GetViewInfo. This centralizes the logic for computing num mips / num slices / format etc so it is the same across all platforms.

 - Views must never be created with nullptr resources. This used to happen in the mesh streamer, but now all views require a real underlying resource. That resource can be a "BUF_NullResource" buffer, which is what the mesh streamer uses as a placeholder for buffers that have not streamed yet.
 - We will eventually replace FRHITextureReference with a "null texture", similar to how BUF_NullResource works for buffers. This is not yet implemented, so there is no "null view" of a texture currently.

#rb kenzo.terelst,jeannoe.morissette,dmitriy.dyomin
#preflight 643534642855180717af410e
#jira none

[CL 24989901 by Luke Thatcher in ue5-main branch]
2023-04-11 08:59:21 -04:00
zack neyland
be4e1f0887 Metal: Add experimental Nanite support for M2 based devices.
#jira UE-182683
#preflight https://horde.devtools.epicgames.com/job/64309adf2855180717cd4332
#rb Josh.Adams
#p4v-cherrypick 24968466

[CL 24972129 by zack neyland in ue5-main branch]
2023-04-07 19:00:54 -04:00
dan elksnitis
3df31bd37f [shaders] deprecate FShaderCompilerEnvironment::RemoteServerData field; since backend-specific remote compile functionality was removed (see https://p4-swarm.epicgames.net/changes/13777670) this is only used for adding unnecessary ifdef'd out debug info to associated shaders.
#rb Laura.Hermanns
#preflight 642735ab486e7cce7dd5b388

[CL 24877333 by dan elksnitis in ue5-main branch]
2023-03-31 15:51:46 -04:00
dan elksnitis
49d7985a85 [shaders] Add "compile argument" functionality for generic parameters consumed by compile backends, along with helper to set both a compile arg AND define for cases which require both. The purpose of this is to move towards enforcing that preprocessor defines should _only_ be used during the preprocessing phase itself; the subset of defines that are currently used only as arguments to the compile backends (or used as both actual preprocessor defines and backend arguments) should use this mechanism instead. This allows us to explicitly identify and hash such parameters to be included in a stable key based primarily on a hash of preprocessed/deadstripped source; without it we would need to hash all defines which will defeat most of the deduplication benefit of doing this. A subsequent change will deprecate the GetDefinitions function on the shader compilation environment to enforce that defines cannot be read by anything outside of core shader system functionality.
#rb Massimo.Tristano
#rb Laura.Hermanns
#preflight 64258c2e5e52099fe3d03625

[CL 24854110 by dan elksnitis in ue5-main branch]
2023-03-30 10:47:09 -04:00
dmitriy dyomin
bf4ed820ba Fixed: Flickering artifacts occur in the Mobile Game Project on iOS.
Make sure iOS vertex shaders are compiled with PreserveInvariance option set
#jira UE-179372
#rb jack.porter
#preflight 6412df4cd0208e8564bbb732

[CL 24671983 by dmitriy dyomin in ue5-main branch]
2023-03-16 11:40:36 -04:00
calvin zheng
9f3db54591 Update Apple metal version string format to match latest
#rb Carl.Lloyd, Zack.Neyland
#preflight 640a46ab482188d710be6062

[CL 24581974 by calvin zheng in ue5-main branch]
2023-03-09 16:06:24 -05:00
calvin zheng
a83747d71a Reducing metal version check in shader cache key to major version only, this will reduce shader compiling time on user machines with a different Xcode version.
Repurpose XcodeVersionInShaderVersion into UseFullMetalVersionInShaderVersion, setting this to true will force shaders to rebuild for each new Xcode version (reverting to previous behaviour)

#jira UE-179011
#rb Zack.Neyland, Arciel.Rekman, Carl.Lloyd
#lockdown Rolando.Caloca
#preflight 6402755daa00423335e22d0f

[CL 24525802 by calvin zheng in ue5-main branch]
2023-03-06 13:21:17 -05:00
devin doucette
5f370d9b86 Fixed static analysis warnings exposed by the log macro refactor
#jira none
#preflight 63fcd0adc35a141980f70d99
#rb Zousar.Shaker
#rnx
#lockdown zousar.shaker

[CL 24425468 by devin doucette in ue5-main branch]
2023-02-27 12:00:24 -05:00