Add support for LowEndRenderPipeline for mobile and the cleanup associated with it (#2292)

Signed-off-by: moudgils <moudgils@amazon.com>
This commit is contained in:
moudgils
2021-07-20 14:58:54 -07:00
committed by GitHub
parent 92571c2ae4
commit 1c2f5ab6d5
16 changed files with 15 additions and 522 deletions
@@ -1,51 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "PassAsset",
"ClassData": {
"PassTemplate": {
"Name": "DiffuseGlobalFullscreenPass_nomsaaTemplate",
"PassClass": "FullScreenTriangle",
"Slots": [
{
"Name": "AlbedoInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "NormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "DepthStencilTextureInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader",
"ImageViewDesc": {
"AspectFlags": [
"Depth"
]
}
},
{
"Name": "DiffuseInputOutput",
"SlotType": "InputOutput",
"ScopeAttachmentUsage": "RenderTarget"
},
{
"Name": "DepthStencilInputOutput",
"SlotType": "InputOutput",
"ScopeAttachmentUsage": "DepthStencil"
}
],
"PassData": {
"$type": "FullscreenTrianglePassData",
"ShaderAsset": {
"FilePath": "Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen_nomsaa.shader"
},
"StencilRef": 128, // See RenderCommon.h and DiffuseGlobalFullscreen.shader
"PipelineViewTag": "MainCamera"
}
}
}
}
@@ -1,63 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "PassAsset",
"ClassData": {
"PassTemplate": {
"Name": "LightCullingTilePrepareTemplate",
"PassClass": "LightCullingTilePreparePass",
"Slots": [
{
"Name": "TileLightData",
"SlotType": "Output",
"ShaderInputName": "m_tileLightData",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "Depth",
"SlotType": "Input",
"ShaderInputName": "m_depthBuffer",
"ScopeAttachmentUsage": "Shader",
"ImageViewDesc": {
"AspectFlags": [
"Depth"
]
}
}
],
"ImageAttachments": [
{
"Name": "TileLightData",
"SizeSource": {
"Source": {
"Pass": "This",
"Attachment": "Depth"
},
"Multipliers": {
"WidthMultiplier": 0.0625,
"HeightMultiplier": 0.0625
}
},
"ImageDescriptor": {
"Format": "R32G32B32A32_UINT"
}
}
],
"Connections": [
{
"LocalSlot": "TileLightData",
"AttachmentRef": {
"Pass": "This",
"Attachment": "TileLightData"
}
}
],
"PassData": {
"$type": "ComputePassData",
"ShaderAsset": {
"FilePath": "Shaders/LightCulling/LightCullingTilePrepare.shader"
}
}
}
}
}
@@ -212,10 +212,6 @@
"Name": "LightCullingTemplate",
"Path": "Passes/LightCulling.pass"
},
{
"Name": "LightCullingTilePrepareTemplate",
"Path": "Passes/LightCullingTilePrepare.pass"
},
{
"Name": "LightCullingTilePrepareMSAATemplate",
"Path": "Passes/LightCullingTilePrepareMSAA.pass"
@@ -1,119 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "PassAsset",
"ClassData": {
"PassTemplate": {
"Name": "ReflectionGlobalFullscreenPass_nomsaaTemplate",
"PassClass": "FullScreenTriangle",
"Slots": [
{
"Name": "DepthStencilTextureInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader",
"ImageViewDesc": {
"AspectFlags": [
"Depth"
]
}
},
{
"Name": "NormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "SpecularF0Input",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ReflectionBlendWeightInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "BRDFTextureInput",
"ShaderInputName": "m_brdfMap",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "DepthStencilInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "DepthStencil",
"ImageViewDesc": {
"AspectFlags": [
"Stencil"
]
}
},
{
"Name": "ReflectionOutput",
"SlotType": "Output",
"ScopeAttachmentUsage": "RenderTarget",
"LoadStoreAction": {
"ClearValue": {
"Value": [
0.4000000059604645,
0.4000000059604645,
0.4000000059604645,
0.0
]
},
"LoadAction": "Clear"
}
}
],
"ImageAttachments": [
{
"Name": "ReflectionImage",
"SizeSource": {
"Source": {
"Pass": "This",
"Attachment": "SpecularF0Input"
}
},
"MultisampleSource": {
"Pass": "This",
"Attachment": "SpecularF0Input"
},
"ImageDescriptor": {
"Format": "R16G16B16A16_FLOAT",
"SharedQueueMask": "Graphics"
}
},
{
"Name": "BRDFTexture",
"Lifetime": "Imported",
"AssetRef": {
"FilePath": "Textures/BRDFTexture.attimage"
}
}
],
"Connections": [
{
"LocalSlot": "ReflectionOutput",
"AttachmentRef": {
"Pass": "This",
"Attachment": "ReflectionImage"
}
},
{
"LocalSlot": "BRDFTextureInput",
"AttachmentRef": {
"Pass": "This",
"Attachment": "BRDFTexture"
}
}
],
"PassData": {
"$type": "FullscreenTrianglePassData",
"ShaderAsset": {
"FilePath": "Shaders/Reflections/ReflectionGlobalFullscreen_nomsaa.shader"
},
"PipelineViewTag": "MainCamera"
}
}
}
}
@@ -1,56 +0,0 @@
{
"Source" : "DiffuseComposite_nomsaa",
"RasterState" :
{
"CullMode" : "Back"
},
"DepthStencilState" :
{
"Depth" :
{
"Enable" : false
},
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0x80",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
}
}
},
"BlendState" : {
"Enable" : true,
"BlendSource" : "One",
"BlendDest" : "One",
"BlendOp" : "Add",
"BlendAlphaSource" : "Zero",
"BlendAlphaDest" : "One",
"BlendAlphaOp" : "Add"
},
"DrawList" : "forward",
"ProgramSettings":
{
"EntryPoints":
[
{
"name": "MainVS",
"type": "Vertex"
},
{
"name": "MainPS",
"type": "Fragment"
}
]
}
}
@@ -1,56 +0,0 @@
{
"Source" : "DiffuseGlobalFullscreen_nomsaa",
"RasterState" :
{
"CullMode" : "Back"
},
"DepthStencilState" :
{
"Depth" :
{
"Enable" : false
},
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0x80",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
}
}
},
"BlendState" : {
"Enable" : true,
"BlendSource" : "One",
"BlendDest" : "One",
"BlendOp" : "Add",
"BlendAlphaSource" : "Zero",
"BlendAlphaDest" : "One",
"BlendAlphaOp" : "Add"
},
"DrawList" : "forward",
"ProgramSettings":
{
"EntryPoints":
[
{
"name": "MainVS",
"type": "Vertex"
},
{
"name": "MainPS",
"type": "Fragment"
}
]
}
}
@@ -1,34 +0,0 @@
{
"Source" : "DiffuseProbeGridDownsample_nomsaa",
"RasterState" :
{
"CullMode" : "Back"
},
"DepthStencilState" :
{
"Depth" :
{
"Enable" : true, // required to bind the depth buffer SRV
"CompareFunc" : "Always"
}
},
"DrawList" : "forward",
"ProgramSettings":
{
"EntryPoints":
[
{
"name": "MainVS",
"type": "Vertex"
},
{
"name": "MainPS",
"type": "Fragment"
}
]
}
}
@@ -66,9 +66,7 @@ void StoreTransparentMinMaxIntoSharedMemory(float2 data)
ShaderResourceGroup PassSrg : SRG_PerPass
{
// We will use one or the other depending upon if MSAA is enabled or not
Texture2D<float4> m_depthBuffer;
Texture2DMS<float4> m_depthBufferMSAA;
Texture2DMS<float4> m_depthBufferMSAA;
// Depth buffer where we rendered the nearest pixels of transparent objects
Texture2D<float4> m_depthBufferTransparentMin;
@@ -282,9 +280,19 @@ void MainCS(
float2 minmaxDepth_transparent = ReadTransparentMinMaxMSAA(dispatchThreadID.xy);
if (o_msaaMode == MsaaMode::Msaa2x)
if (o_msaaMode == MsaaMode::None || o_msaaMode == MsaaMode::Msaa2x)
{
float2 opaqueDepthSamples = ReadOpaqueDepthSamples2xMSAA(dispatchThreadID.xy);
float2 opaqueDepthSamples;
if (o_msaaMode == MsaaMode::None)
{
float depth = PassSrg::m_depthBufferMSAA.Load(dispatchThreadID.xy, 0).x;
opaqueDepthSamples = float2(depth, depth);
}
else if (o_msaaMode == MsaaMode::Msaa2x)
{
opaqueDepthSamples = ReadOpaqueDepthSamples2xMSAA(dispatchThreadID.xy);
}
// Transparent geometry can't be behind opaque geometry. Just pick the first MSAA sample since we are trying to reduce reading from MSAA buffer
minmaxDepth_transparent = DEPTH_MIN(minmaxDepth_transparent, opaqueDepthSamples.x);
opaqueDepthSamples = ReplaceSkyPixelsWithFurthestPixelsFromTransparentObjects2x(opaqueDepthSamples, minmaxDepth_transparent);
@@ -1,53 +0,0 @@
{
"Source" : "ReflectionComposite_nomsaa",
"RasterState" :
{
"CullMode" : "Back"
},
"DepthStencilState" :
{
"Depth" :
{
"Enable" : false,
"WriteMask" : "Zero",
"CompareFunc" : "GreaterEqual"
},
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "LessEqual",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
}
}
},
"BlendState" : {
"Enable" : true,
"BlendSource" : "One",
"BlendDest" : "One",
"BlendOp" : "Add"
},
"ProgramSettings":
{
"EntryPoints":
[
{
"name": "MainVS",
"type": "Vertex"
},
{
"name": "MainPS",
"type": "Fragment"
}
]
}
}
@@ -1,44 +0,0 @@
{
"Source" : "ReflectionGlobalFullscreen_nomsaa",
"RasterState" :
{
"CullMode" : "Back"
},
"DepthStencilState" :
{
"Depth" :
{
"Enable" : false
},
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
}
}
},
"ProgramSettings":
{
"EntryPoints":
[
{
"name": "MainVS",
"type": "Vertex"
},
{
"name": "MainPS",
"type": "Fragment"
}
]
}
}
@@ -113,7 +113,6 @@ set(FILES
Passes/DepthUpsample.pass
Passes/DiffuseComposite.pass
Passes/DiffuseGlobalFullscreen.pass
Passes/DiffuseGlobalFullscreen_nomsaa.pass
Passes/DiffuseGlobalIllumination.pass
Passes/DiffuseProbeGridBlendDistance.pass
Passes/DiffuseProbeGridBlendIrradiance.pass
@@ -152,7 +151,6 @@ set(FILES
Passes/LightCullingHeatmap.pass
Passes/LightCullingParent.pass
Passes/LightCullingRemap.pass
Passes/LightCullingTilePrepare.pass
Passes/LightCullingTilePrepareMSAA.pass
Passes/LookModificationComposite.pass
Passes/LookModificationTransform.pass
@@ -176,7 +174,6 @@ set(FILES
Passes/ReflectionComposite.pass
Passes/ReflectionCopyFrameBuffer.pass
Passes/ReflectionGlobalFullscreen.pass
Passes/ReflectionGlobalFullscreen_nomsaa.pass
Passes/ReflectionProbeBlendWeight.pass
Passes/ReflectionProbeRenderInner.pass
Passes/ReflectionProbeRenderOuter.pass
@@ -190,7 +187,6 @@ set(FILES
Passes/ReflectionScreenSpaceComposite.pass
Passes/ReflectionScreenSpaceMobile.pass
Passes/ReflectionScreenSpaceTrace.pass
Passes/Reflections_nomsaa.pass
Passes/ShadowParent.pass
Passes/Skinning.pass
Passes/SkyBox.pass
@@ -320,16 +316,10 @@ set(FILES
Shaders/Depth/DepthPassTransparentMin.shader
Shaders/DiffuseGlobalIllumination/DiffuseComposite.azsl
Shaders/DiffuseGlobalIllumination/DiffuseComposite.shader
Shaders/DiffuseGlobalIllumination/DiffuseComposite_nomsaa.azsl
Shaders/DiffuseGlobalIllumination/DiffuseComposite_nomsaa.shader
Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen.azsl
Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen.shader
Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen_nomsaa.azsl
Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen_nomsaa.shader
Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample.azsl
Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample.shader
Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample_nomsaa.azsl
Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample_nomsaa.shader
Shaders/ImGui/ImGui.azsl
Shaders/ImGui/ImGui.shader
Shaders/LightCulling/LightCulling.azsl
@@ -442,12 +432,8 @@ set(FILES
Shaders/Reflections/ReflectionCommon.azsli
Shaders/Reflections/ReflectionComposite.azsl
Shaders/Reflections/ReflectionComposite.shader
Shaders/Reflections/ReflectionComposite_nomsaa.azsl
Shaders/Reflections/ReflectionComposite_nomsaa.shader
Shaders/Reflections/ReflectionGlobalFullscreen.azsl
Shaders/Reflections/ReflectionGlobalFullscreen.shader
Shaders/Reflections/ReflectionGlobalFullscreen_nomsaa.azsl
Shaders/Reflections/ReflectionGlobalFullscreen_nomsaa.shader
Shaders/Reflections/ReflectionProbeBlendWeight.azsl
Shaders/Reflections/ReflectionProbeBlendWeight.shader
Shaders/Reflections/ReflectionProbeRenderCommon.azsli
@@ -38,7 +38,7 @@ namespace AZ
static Name GetLightCullingTilePreparePassTemplateName()
{
return AZ::Name("LightCullingTilePrepareTemplate");
return AZ::Name("LightCullingTilePrepareMSAATemplate");
}
private:
@@ -122,11 +122,6 @@ namespace Platform
return reinterpret_cast<RHIMetalView*>([nativeWindow.contentViewController view]);
}
void ApplyTileDimentions(MTLRenderPassDescriptor* mtlRenderPassDescriptor)
{
AZ_UNUSED(mtlRenderPassDescriptor);
}
void SynchronizeBufferOnCPU(id<MTLBuffer> mtlBuffer, size_t bufferOffset, size_t bufferSize)
{
if(mtlBuffer.storageMode == MTLStorageModeManaged)
@@ -88,17 +88,6 @@ namespace Platform
return reinterpret_cast<RHIMetalView*>([nativeWindow.rootViewController view]);
}
void ApplyTileDimentions(MTLRenderPassDescriptor* mtlRenderPassDescriptor)
{
//Metal driver has a bug where if the tile dimensions changes between passes it will
//generate incorrect vertex positions (possible vertex invariance). For example vertex invariance was
//observed between Depth pass and forward pass. Hence for now we are setting global tile dimentions across all passes.
//For performance sake we should eventually remove this once this bug is addressed.
//[GFX_TODO][ATOM-13440] - Remove once driver bug is addressed.
mtlRenderPassDescriptor.tileWidth = 16;
mtlRenderPassDescriptor.tileHeight = 16;
}
void SynchronizeBufferOnCPU(id<MTLBuffer> mtlBuffer, size_t bufferOffset, size_t bufferSize)
{
//No synchronization needed as ios uses shared memory and does not support MTLStorageModeManaged
@@ -17,10 +17,6 @@
#include <RHI/Scope.h>
#include <Atom/RHI/SwapChainFrameAttachment.h>
namespace Platform
{
void ApplyTileDimentions(MTLRenderPassDescriptor* mtlRenderPassDescriptor);
}
namespace AZ
{
@@ -88,7 +84,6 @@ namespace AZ
{
AZ_Assert(m_renderPassDescriptor == nil, "m_renderPassDescriptor should be null");
m_renderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor];
Platform::ApplyTileDimentions(m_renderPassDescriptor);
}
if(GetEstimatedItemCount())
@@ -98,7 +98,7 @@ namespace AZ
{
return RHI::ResultCode::Fail;
}
m_shaderResourceGroup->SetName(srgName);
m_shaderResourceGroup->SetName(m_pool->GetRHIPool()->GetName());
m_data = RHI::ShaderResourceGroupData(m_layout);
m_asset = { &shaderAsset, AZ::Data::AssetLoadBehavior::PreLoad };