From 47ed211bf6aeff944d54bd814710961013d869a0 Mon Sep 17 00:00:00 2001 From: Peng Date: Wed, 21 Apr 2021 13:33:29 -0700 Subject: [PATCH] [ATOM][RHI][Vulkan][Android] -Add different pass for screen space blur for mobile. -Add macro for constant buffer limits for android vulkan. JIRA: https://jira.agscollab.com/browse/ATOM-14947 https://jira.agscollab.com/browse/ATOM-14949 --- .../Platform/Android/Vulkan/AzslcHeader.azsli | 4 + .../ReflectionScreenSpaceBlurMobile.pass | 43 ++++++ .../Passes/ReflectionScreenSpaceMobile.pass | 137 ++++++++++++++++++ .../Assets/Passes/Reflections_nomsaa.pass | 4 +- 4 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceBlurMobile.pass create mode 100644 Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceMobile.pass diff --git a/Gems/Atom/Asset/Shader/Code/AZSL/Platform/Android/Vulkan/AzslcHeader.azsli b/Gems/Atom/Asset/Shader/Code/AZSL/Platform/Android/Vulkan/AzslcHeader.azsli index 12fd787150..91036909c6 100644 --- a/Gems/Atom/Asset/Shader/Code/AZSL/Platform/Android/Vulkan/AzslcHeader.azsli +++ b/Gems/Atom/Asset/Shader/Code/AZSL/Platform/Android/Vulkan/AzslcHeader.azsli @@ -19,3 +19,7 @@ #define AZ_TRAIT_ASTC_COMPRESSION 1 static const float4 s_AzslDebugColor = float4(165.0 / 255.0, 30.0 / 255.0, 36.0 / 255.0, 1); + +// Uniform limitation need to be taken into consideration for mobile devices +// https://jira.agscollab.com/browse/ATOM-14949 +#define AZ_TRAIT_CONSTANT_BUFFER_LIMITATIONS 1 \ No newline at end of file diff --git a/Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceBlurMobile.pass b/Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceBlurMobile.pass new file mode 100644 index 0000000000..e11bcac78d --- /dev/null +++ b/Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceBlurMobile.pass @@ -0,0 +1,43 @@ +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "PassAsset", + "ClassData": { + "PassTemplate": { + "Name": "ReflectionScreenSpaceBlurMobilePassTemplate", + "PassClass": "ReflectionScreenSpaceBlurPass", + "Slots": [ + { + "Name": "PreviousFrameInputOutput", + "SlotType": "InputOutput", + "ScopeAttachmentUsage": "Shader" + } + ], + "ImageAttachments": [ + { + "Name": "PreviousFrameImage", + "SizeSource": { + "Source": { + "Pass": "Parent", + "Attachment": "SpecularInput" + } + }, + "ImageDescriptor": { + "Format": "R8G8B8A8_SINT", + "MipLevels": "8", + "SharedQueueMask": "Graphics" + } + } + ], + "Connections": [ + { + "LocalSlot": "PreviousFrameInputOutput", + "AttachmentRef": { + "Pass": "This", + "Attachment": "PreviousFrameImage" + } + } + ] + } + } +} diff --git a/Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceMobile.pass b/Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceMobile.pass new file mode 100644 index 0000000000..648d643496 --- /dev/null +++ b/Gems/Atom/Feature/Common/Assets/Passes/ReflectionScreenSpaceMobile.pass @@ -0,0 +1,137 @@ +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "PassAsset", + "ClassData": { + "PassTemplate": { + "Name": "ReflectionScreenSpaceMobilePassTemplate", + "PassClass": "ParentPass", + "Slots": [ + { + "Name": "NormalInput", + "SlotType": "Input", + "ScopeAttachmentUsage": "Shader" + }, + { + "Name": "SpecularF0Input", + "SlotType": "Input", + "ScopeAttachmentUsage": "Shader" + }, + { + "Name": "SpecularInput", + "SlotType": "Input", + "ScopeAttachmentUsage": "Shader" + }, + { + "Name": "DepthStencilInput", + "SlotType": "Input", + "ScopeAttachmentUsage": "DepthStencil" + }, + { + "Name": "ReflectionInputOutput", + "SlotType": "InputOutput", + "ScopeAttachmentUsage": "RenderTarget" + } + ], + "PassRequests": [ + { + "Name": "ReflectionScreenSpaceBlurMobilePass", + "TemplateName": "ReflectionScreenSpaceBlurMobilePassTemplate" + }, + { + "Name": "ReflectionScreenSpaceTracePass", + "TemplateName": "ReflectionScreenSpaceTracePassTemplate", + "Connections": [ + { + "LocalSlot": "DepthStencilTextureInput", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "DepthStencilInput" + } + }, + { + "LocalSlot": "NormalInput", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "NormalInput" + } + }, + { + "LocalSlot": "DepthStencilInput", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "DepthStencilInput" + + } + }, + { + "LocalSlot": "SpecularF0Input", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "SpecularF0Input" + } + } + ] + }, + { + "Name": "ReflectionScreenSpaceCompositePass", + "TemplateName": "ReflectionScreenSpaceCompositePassTemplate", + "ExecuteAfter": [ + "ReflectionScreenSpaceBlurPass" + ], + "Connections": [ + { + "LocalSlot": "TraceInput", + "AttachmentRef": { + "Pass": "ReflectionScreenSpaceTracePass", + "Attachment": "Output" + } + }, + { + "LocalSlot": "PreviousFrameBufferInput", + "AttachmentRef": { + "Pass": "ReflectionScreenSpaceBlurPass", + "Attachment": "PreviousFrameInputOutput" + } + }, + { + "LocalSlot": "NormalInput", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "NormalInput" + } + }, + { + "LocalSlot": "SpecularF0Input", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "SpecularF0Input" + } + }, + { + "LocalSlot": "DepthStencilTextureInput", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "DepthStencilInput" + } + }, + { + "LocalSlot": "DepthStencilInput", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "DepthStencilInput" + } + }, + { + "LocalSlot": "Output", + "AttachmentRef": { + "Pass": "Parent", + "Attachment": "ReflectionInputOutput" + } + } + ] + } + ] + } + } +} diff --git a/Gems/Atom/Feature/Common/Assets/Passes/Reflections_nomsaa.pass b/Gems/Atom/Feature/Common/Assets/Passes/Reflections_nomsaa.pass index 1973727719..7c15a419a4 100644 --- a/Gems/Atom/Feature/Common/Assets/Passes/Reflections_nomsaa.pass +++ b/Gems/Atom/Feature/Common/Assets/Passes/Reflections_nomsaa.pass @@ -273,8 +273,8 @@ } }, { - "Name": "ReflectionScreenSpacePass", - "TemplateName": "ReflectionScreenSpacePassTemplate", + "Name": "ReflectionScreenSpaceMobilePass", + "TemplateName": "ReflectionScreenSpaceMobilePassTemplate", "Enabled": false, "Connections": [ {