Commit Graph

158 Commits

Author SHA1 Message Date
mark satterthwaite
be68614031 When compiling Metal shaders sometimes local temporary arrays are actually declared as variables - these should use safe_array too.
#rb none


#ROBOMERGE-SOURCE: CL 5808821 via CL 5808822 via CL 5808823 via CL 5812117

[CL 5812326 by mark satterthwaite in Main branch]
2019-04-09 16:21:31 -04:00
mark satterthwaite
40f221ade4 Invalidating the MetalShaderFormat version seems to cure the build machine of generating bogus shaders for the BoneMatrix SRV change.
#rb none


#ROBOMERGE-SOURCE: CL 5691957 via CL 5691961 via CL 5691963 via CL 5696013 via CL 5696965

[CL 5697149 by mark satterthwaite in Main branch]
2019-04-02 20:04:43 -04:00
mark satterthwaite
486f873d3d MetalBackend changes to actually convert local constant arrays to the new safe_array template which sanitises input addresses - because iOS doesn't do that for you. This should reduce the number of bad-access GPU timeouts according to Apple.
#rb none


#ROBOMERGE-SOURCE: CL 5659739 via CL 5659747 via CL 5659748 via CL 5659749 via CL 5659823

[CL 5659843 by mark satterthwaite in Main branch]
2019-03-29 22:32:23 -04:00
mark satterthwaite
63dca5adc0 Fix Metal shader translation bugs:
- Texture*Array.Load needs to split the array index out of the vector coordinate for Metal.
- The GetDimensions function needs to support the array-length/depth output argument.
- RemovePackedVarReferences was inserting new variables at the top of the function, not the same scope as the source variable, which won't compile in cases where structs are used as temporaries and not function arguments.

#rb none


#ROBOMERGE-SOURCE: CL 5502462 via CL 5503115

[CL 5535524 by mark satterthwaite in Main branch]
2019-03-25 13:53:06 -04:00
mark satterthwaite
354abb943a Missed some Metal shader defines from CL #5419941 that were then causing compile errors on the builders.
#jira UE-71698
#rb none

#ROBOMERGE-SOURCE: CL 5434778 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)

[CL 5434784 by mark satterthwaite in Main branch]
2019-03-18 15:57:35 -04:00
mark satterthwaite
c4b75c343f Make RWBuffer's use raw Metal T* buffers so that we don't run into problems where texture_buffer/texture2d can't be both read & write at the same time on iOS. This will be slower but it will work on more iOS/tvOS devices. This does not affect macOS.
#jira UE-71589
#rb none

#ROBOMERGE-SOURCE: CL 5419941 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)

[CL 5419946 by mark satterthwaite in Main branch]
2019-03-15 14:31:06 -04:00
rolando caloca
955a14de37 UE4 - Fix invalid IR on hlslcc potentially causing a crash
#rb none
[FYI] Jonas.Meyer
#rnx
#jira UE-71397

#ROBOMERGE-OWNER: rolando.caloca
#ROBOMERGE-AUTHOR: rolando.caloca
#ROBOMERGE-SOURCE: CL 5399410 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)

[CL 5399503 by rolando caloca in Main branch]
2019-03-14 14:16:41 -04:00
mark satterthwaite
b6d781c1ba Duplicate 5263216 to aid debugging Metal shader issues in games using native shader libraries without having to cook locally:
Package Metal shader source into a zip file rather than a tgz so it can be done on Windows builds too and do this asynchronously while generating the Metal libraries. This file is stored in the MetaData folder so should be moved out of the content and not get packaged. Must be unzipped at the command-line for some reason, but it works.

#rb none


#ROBOMERGE-SOURCE: CL 5333983

[CL 5333997 by mark satterthwaite in Main branch]
2019-03-06 19:28:17 -05:00
mark satterthwaite
c2493dd022 Apply the workaround from CL #3722943 to the patchCount variable as well in the hope that this will fix Nvidia PSO compiler failures - it fixes at least one of the examples we have logged.
#jira UE-69104
#rb none

#ROBOMERGE-SOURCE: CL 5289294 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)

[CL 5308163 by mark satterthwaite in Main branch]
2019-03-05 18:07:32 -05:00
mark satterthwaite
6a40ecf5c9 Previous commit overlooked the subtlties that FixIntrinsics was dealing with in addition to FramebufferFetchES2 - so pass through the shader type and only handle FramebufferFetchES2 for fragment shaders instead.
#rb none


#ROBOMERGE-SOURCE: CL 5296814 via CL 5296819 via CL 5307410

[CL 5307511 by mark satterthwaite in Main branch]
2019-03-05 17:59:32 -05:00
mark satterthwaite
34cef20ad6 Framebuffer fetch is fragment-shader only for Metal - you can't use it in vertex shaders.
#rb none


#ROBOMERGE-SOURCE: CL 5296664 via CL 5296665 via CL 5307395

[CL 5307467 by mark satterthwaite in Main branch]
2019-03-05 17:58:59 -05:00
mark satterthwaite
7f42ccb517 Fix compiling shaders to Metal that use SceneDepth nodes but do not write any color targets - only depth. If a shader writes nothing at all then it will assume float4 input for the fragment fetch binding.
#rb none


#ROBOMERGE-SOURCE: CL 5295610 via CL 5295687 via CL 5306310

[CL 5306417 by mark satterthwaite in Main branch]
2019-03-05 17:23:37 -05:00
Josh Adams
d0bf843c9c - Merging Dev-Kairos/Engine/... to Main/Engine/...
- Brings over the necessary engine changes for embedding UE4 mobile as a dylib/so in native mobile app
- Various changes for facial animation, screen recording, others
- ARKit and ARCore plugins were removed, as deemed "not ready"
#rb many people


#ROBOMERGE-OWNER: josh.adams
#ROBOMERGE-AUTHOR: josh.adams
#ROBOMERGE-SOURCE: CL 5201138 via CL 5203024

[CL 5226277 by Josh Adams in Main branch]
2019-02-27 11:57:17 -05:00
mark satterthwaite
11d042e5cf Compile out all support for Metal tessellation shaders from the MetalRHI runtime & remove all vestigial references to geometry shaders using the new pre-processor flags. This resizes all the various arrays to eliminate unused entries which were previously SF_NumFrequencies in size.
[FYI] Marcus.Wassmer, rolando.caloca, peter.sauerbrei
#rb none


#ROBOMERGE-OWNER: mark.satterthwaite
#ROBOMERGE-AUTHOR: mark.satterthwaite
#ROBOMERGE-SOURCE: CL 5010458 via CL 5010459 via CL 5013401

[CL 5047337 by mark satterthwaite in Main branch]
2019-02-18 15:20:11 -05:00
mark satterthwaite
3e7977bf7d Use dynamic casting to access Metal tessellation shader index buffers - means restoring the code path for R16Uint and R32Uint but that should be fine. This avoids the AMD driver bug that causes incorrect reads at the extreme beginning/end of a texture_buffer or texture2d created from an index buffer. Need to get to the bottom of this with the driver team.
#jira UE-69266
#rb none

#ROBOMERGE-SOURCE: CL 4956763 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)

[CL 4968434 by mark satterthwaite in Main branch]
2019-02-12 09:39:43 -05:00
Mark Satterthwaite
2d3d685ec8 Dupe 4858714:
Remove obsolete alternative Metal shader frequency table that was causing PVS to spit out an invalid error.

#rb none
#jira UE-69379

[CL 4860561 by Mark Satterthwaite in Main branch]
2019-01-31 15:55:23 -05:00
Mark Satterthwaite
4ffaae2172 Support packed vector types in RW/StructureBuffer types in MetalSL.
#rb none
#jira N/A
#lockdown marcus.wassmer

[CL 4823507 by Mark Satterthwaite in Dev-Rendering branch]
2019-01-28 12:30:54 -05:00
Mark Satterthwaite
8ba414e181 Add an option "Force 32bit Floating Point Precision" to the iOS project settings to have the shader compiler promote all half-float operations to FP32 as some projects on iOS encounter rendering issues when fragment shader calculations run into half-float precision limits.
#jira UE-68654
#rb none
#lockdown marcus.wassmer

[CL 4804101 by Mark Satterthwaite in Dev-Rendering branch]
2019-01-24 15:59:40 -05:00
Rolando Caloca
732810a13b DR - Copying //UE4/Dev-Main@4785067 to //UE4-DevRendering
#rb none
#rnx
#lockdown Marcus.Wassmer

[CL 4790611 by Rolando Caloca in Dev-Rendering branch]
2019-01-23 17:01:56 -05:00
Rolando Caloca
12beff7e67 DR - Fix static analysis warning
#codereview Mark.Satterthwaite
#rb none
#rnx

[CL 4771011 by Rolando Caloca in Dev-Rendering branch]
2019-01-22 12:39:16 -05:00
Mark Satterthwaite
79cd81f246 Remove tessellation function constant as we can use linear-textures to achieve the same result which means we no longer need separate variants of the shader. DrawIndexedPrimitiveUP can no longer draw a tessellated mesh - but that was never advisable anyway.
#rb none

[CL 4757784 by Mark Satterthwaite in Dev-Rendering branch]
2019-01-18 20:19:31 -05:00
Mark Satterthwaite
4294baba11 Remove a lot of dead-code for Metal tessellation that hasn't been touched in the last few years and that won't be revived at this stage.
#rb none

[CL 4757159 by Mark Satterthwaite in Dev-Rendering branch]
2019-01-18 18:10:25 -05:00
Mark Satterthwaite
ae9401146d Remove all support for Metal prior to Metal 1.2 on iOS/tvOS and Metal 2.0 on macOS. This permits some fairly radical simplifications and removal of a number of workarounds.
- All Buffer<>/RWBuffer<> objects are now bound as texture2d or texture_buffer, unless they are 3-component, in which case they are bound as raw T* buffer pointers.
- 3-component Buffer/RWBuffer objects should now work - Metal needed to use packed_* types internally as normal 3-component types in Metal are the same size as 4-component types which is different to HLSL. This is untested as we have no such example.
- Texture Gather/GatherCompare operations have been fixed and should now work.
- Remove all the TypedBufferFormat function-constant specialisation infrastructure and metadata as it is no longer necessary.
- Remove all the raw-conversion for 1, 2 and 4 component vector types as it is no longer required.
- Fixed input qualifiers (centroid, linear, etc.) for Fragment shader inputs - they should now work.
- Remove a bunch of Metal specific shader changes due to buffer type casting and swizzling that will now just work.
- Use the BGRA vertex format for FColor on Metal when available (everywhere but iOS/tvOS 10 using Metal 1.2).
- Simplify ShouldCompilePermutation & similar functions now that we have fewer versions to support.

#rb none
#jira N/A

[CL 4729845 by Mark Satterthwaite in Dev-Rendering branch]
2019-01-15 18:01:31 -05:00
Marcus Wassmer
b0182a326d DR - Fix Metal compilation (rebuilt hlslcc)
#rb none

[CL 4686883 by Marcus Wassmer in Dev-Rendering branch]
2019-01-07 17:48:26 -05:00
Rolando Caloca
c6ce9f0790 DR - Dump hlslcc flags for Metal direct compiler
- Don't validate on Vulkan shaders unless on debug
#rb none

[CL 4686842 by Rolando Caloca in Dev-Rendering branch]
2019-01-07 17:35:21 -05:00