[ATOM-15472] Shader Build Pipeline: Remove Deprecated Files And Funct… (#1079)
* [ATOM-15472] Shader Build Pipeline: Remove Deprecated Files And Functions That Predate The Shader Supervariants These are the essential impactful changes as a result of deprecating the ShaderResourceGroupAsset. * Addressed feedback by @moudgils. Better comments in header files. * More updates related with deprecation of ShaderResourceGroupAsset * Deleted the temporary version 2 classes. * Updated version of the shader asset builders. * Updated version of all the shader related classes impacted by the Supervariant concept and deprecation of ShaderResourceGroupAsset * Changes to *.pass and DGI, Reflections and RayTracing. * changes to material related assets * changes to core lights * Changes to auxgeom/dynamic draw. * changes to decals, lyshine, imguipass * changes to RPI Pass classes * Shader for SceneSrg, ViewSrg and ForwardPass Srgs. * changes to mesh, skinned mesh, Morphtarget. * Fixes to RayTracingPass.cpp & now allow empty srg in shaders. * Updated Atom_RPI.Tests * Simplified InstanceDatabase by removing AddHandler ------------------------------------------------------------------------------------ * Updated DiffuseGI precompiled shaders. Added RayTracingSceneSrg and RayTracingMaterialSrg shader asset. Updated ShaderAssetCreator::Clone to handle the supervariant when processing root variants. Co-authored-by: Doug McDiarmid <dmcdiar@amazon.com> ------------------------------------------------------------------------------------ * Changed semantics for some PassSrg to SRG_PerPass_WithFallback. AuxGeom/FixedShapeProcessor.cpp requires SRG_PerDraw on ObjectSrg. Removed names of SceneSrg and ViewSrg from RPISystemDescriptor.cpp * Moved ShaderLib/Atom/Features/DummyEntryFunctions.azsli To Gems/Atom/RPI/Assets/ShaderLib/Atom/RPI/DummyEntryFunctions.azsli Removed redundant checking for finalization in ShaderResourceGroupLayout.cpp * Fixed race condition bug for Shader::FindOrCreate. InstanceDatabase<>::CreateInstance() needs to be atomic for instance creation and initialization. Added optional InstanceHandler::CreateFunctionWithParams to accomodate to the needs of Instances that need more than an asset reference to be able to be created an initialzed. Removed ShaderResourceGroup::FindOrCreate() only ::Create is available now. * Renamed scene_and_view_srgs.* as SceneAndViewSrgs.* Changed GetAzslFileOfOrigin for GetUniqueId * Fixed unit tests. * Reverted the serialization name of m_uniqueId back to "m_azslFileOfOrigin" so precompiled shaders don't fail in layout comparison. * Fixed AtomCore.Tests Removed non-applicable test. InstanceDatabase.AddHandler() is not available anymore. * The Null rhi is re-enabled for shader compilation. Signed-off-by: garrieta <garrieta@amazon.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <Common/RPITestFixture.h>
|
||||
#include <Common/ErrorMessageFinder.h>
|
||||
#include <Common/ShaderAssetTestUtils.h>
|
||||
#include <Material/MaterialAssetTestUtils.h>
|
||||
|
||||
#include <Atom/RPI.Public/ColorManagement/TransformColor.h>
|
||||
@@ -21,7 +22,6 @@
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderOptionGroup.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialAssetCreator.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialTypeAssetCreator.h>
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderResourceGroupAssetCreator.h>
|
||||
#include <Atom/RPI.Reflect/Image/ImageMipChainAssetCreator.h>
|
||||
#include <Atom/RPI.Reflect/Image/StreamingImageAssetCreator.h>
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace UnitTest
|
||||
: public RPITestFixture
|
||||
{
|
||||
protected:
|
||||
Data::Asset<ShaderResourceGroupAsset> m_testMaterialSrgAsset;
|
||||
Data::Asset<ShaderAsset> m_testMaterialShaderAsset;
|
||||
AZ::RHI::Ptr<AZ::RHI::ShaderResourceGroupLayout> m_testMaterialSrgLayout;
|
||||
Data::Asset<MaterialTypeAsset> m_testMaterialTypeAsset;
|
||||
Data::Asset<MaterialAsset> m_testMaterialAsset;
|
||||
Data::Asset<StreamingImageAsset> m_testImageAsset;
|
||||
@@ -67,13 +68,12 @@ namespace UnitTest
|
||||
{
|
||||
RPITestFixture::SetUp();
|
||||
|
||||
m_testMaterialSrgAsset = CreateCommonTestMaterialSrgAsset();
|
||||
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgAsset);
|
||||
m_testMaterialSrgLayout = CreateCommonTestMaterialSrgLayout();
|
||||
m_testMaterialShaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgLayout);
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
materialTypeCreator.AddShader(shaderAsset);
|
||||
materialTypeCreator.AddShader(m_testMaterialShaderAsset);
|
||||
AddCommonTestMaterialProperties(materialTypeCreator);
|
||||
materialTypeCreator.SetPropertyValue(Name{ "MyFloat2" }, Vector2{ 10.1f, 10.2f });
|
||||
materialTypeCreator.SetPropertyValue(Name{ "MyFloat3" }, Vector3{ 11.1f, 11.2f, 11.3f });
|
||||
@@ -105,7 +105,8 @@ namespace UnitTest
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
m_testMaterialSrgAsset.Reset();
|
||||
m_testMaterialShaderAsset.Reset();
|
||||
m_testMaterialSrgLayout = nullptr;
|
||||
m_testMaterialTypeAsset.Reset();
|
||||
m_testMaterialAsset.Reset();
|
||||
m_testImageAsset.Reset();
|
||||
@@ -254,7 +255,7 @@ namespace UnitTest
|
||||
EXPECT_EQ(material->GetPropertyValue<Data::Instance<Image>>(material->FindPropertyIndex(Name{ "MyImage" })), otherTestImage);
|
||||
EXPECT_EQ(material->GetPropertyValue<uint32_t>(material->FindPropertyIndex(Name{ "MyEnum" })), 3u);
|
||||
|
||||
ProcessQueuedSrgCompilations(m_testMaterialSrgAsset);
|
||||
ProcessQueuedSrgCompilations(m_testMaterialShaderAsset, m_testMaterialSrgLayout->GetName());
|
||||
material->Compile();
|
||||
|
||||
// Dig in to the SRG to make sure the values were applied there as well...
|
||||
@@ -280,13 +281,12 @@ namespace UnitTest
|
||||
|
||||
TEST_F(MaterialTests, TestSetPropertyValueToMultipleShaderSettings)
|
||||
{
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgAsset);
|
||||
Data::Asset<MaterialTypeAsset> materialTypeAsset;
|
||||
Data::Asset<MaterialAsset> materialAsset;
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
materialTypeCreator.AddShader(shaderAsset);
|
||||
materialTypeCreator.AddShader(m_testMaterialShaderAsset);
|
||||
materialTypeCreator.BeginMaterialProperty(Name{ "MyInt" }, MaterialPropertyDataType::Int);
|
||||
materialTypeCreator.ConnectMaterialPropertyToShaderInput(Name{ "m_int" });
|
||||
materialTypeCreator.ConnectMaterialPropertyToShaderInput(Name{ "m_uint" });
|
||||
@@ -305,7 +305,7 @@ namespace UnitTest
|
||||
|
||||
EXPECT_EQ(material->GetPropertyValue<int32_t>(material->FindPropertyIndex(Name{ "MyInt" })), 42);
|
||||
|
||||
ProcessQueuedSrgCompilations(m_testMaterialSrgAsset);
|
||||
ProcessQueuedSrgCompilations(m_testMaterialShaderAsset, m_testMaterialSrgLayout->GetName());
|
||||
material->Compile();
|
||||
|
||||
// Dig in to the SRG to make sure the values were applied to both shader constants...
|
||||
@@ -340,7 +340,7 @@ namespace UnitTest
|
||||
Data::Instance<Image> actualImageInstance = material->GetPropertyValue<Data::Instance<Image>>(material->FindPropertyIndex(Name{"MyImage"}));
|
||||
EXPECT_EQ(actualImageInstance, nullImageInstance);
|
||||
|
||||
ProcessQueuedSrgCompilations(m_testMaterialSrgAsset);
|
||||
ProcessQueuedSrgCompilations(m_testMaterialShaderAsset, m_testMaterialSrgLayout->GetName());
|
||||
material->Compile();
|
||||
|
||||
const RHI::ShaderResourceGroupData& srgData = material->GetRHIShaderResourceGroup()->GetData();
|
||||
@@ -403,7 +403,7 @@ namespace UnitTest
|
||||
{
|
||||
Ptr<ShaderOptionGroupLayout> optionsLayout = CreateTestOptionsLayout();
|
||||
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgAsset, optionsLayout);
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgLayout, optionsLayout);
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
@@ -484,7 +484,8 @@ namespace UnitTest
|
||||
{
|
||||
Ptr<ShaderOptionGroupLayout> optionsLayout = CreateTestOptionsLayout();
|
||||
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgAsset, optionsLayout);
|
||||
Data::Asset<ShaderAsset> shaderAsset =
|
||||
CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgLayout, optionsLayout);
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
@@ -551,7 +552,8 @@ namespace UnitTest
|
||||
{
|
||||
Ptr<ShaderOptionGroupLayout> optionsLayout = CreateTestOptionsLayout();
|
||||
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgAsset, optionsLayout);
|
||||
Data::Asset<ShaderAsset> shaderAsset =
|
||||
CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgLayout, optionsLayout);
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
@@ -622,7 +624,7 @@ namespace UnitTest
|
||||
{
|
||||
Ptr<ShaderOptionGroupLayout> optionsLayout = CreateTestOptionsLayout();
|
||||
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgAsset, optionsLayout);
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), m_testMaterialSrgLayout, optionsLayout);
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
@@ -712,7 +714,7 @@ namespace UnitTest
|
||||
|
||||
// Make sure the values have not changed
|
||||
|
||||
ProcessQueuedSrgCompilations(m_testMaterialSrgAsset);
|
||||
ProcessQueuedSrgCompilations(m_testMaterialShaderAsset, m_testMaterialSrgLayout->GetName());
|
||||
material->Compile();
|
||||
|
||||
ValidateInitialValuesFromMaterial(material);
|
||||
@@ -741,19 +743,16 @@ namespace UnitTest
|
||||
|
||||
TEST_F(MaterialTests, ColorPropertyCanMapToFloat3)
|
||||
{
|
||||
Data::Asset<ShaderResourceGroupAsset> srgAsset;
|
||||
Data::Asset<MaterialTypeAsset> materialTypeAsset;
|
||||
Data::Asset<MaterialAsset> materialAsset;
|
||||
|
||||
ShaderResourceGroupAssetCreator srgCreator;
|
||||
srgCreator.Begin(Uuid::CreateRandom(), Name("MaterialSrg"));
|
||||
srgCreator.BeginAPI(RHI::Factory::Get().GetType());
|
||||
srgCreator.SetBindingSlot(SrgBindingSlot::Material);
|
||||
srgCreator.AddShaderInput(RHI::ShaderInputConstantDescriptor{Name{"m_color"}, 0, 12, 0});
|
||||
srgCreator.EndAPI();
|
||||
srgCreator.End(srgAsset);
|
||||
RHI::Ptr<RHI::ShaderResourceGroupLayout> srgLayout = RHI::ShaderResourceGroupLayout::Create();
|
||||
srgLayout->SetName(Name("MaterialSrg"));
|
||||
srgLayout->SetBindingSlot(SrgBindingSlot::Material);
|
||||
srgLayout->AddShaderInput(RHI::ShaderInputConstantDescriptor{Name{"m_color"}, 0, 12, 0});
|
||||
ASSERT_TRUE(srgLayout->Finalize());
|
||||
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), srgAsset);
|
||||
Data::Asset<ShaderAsset> shaderAsset = CreateTestShaderAsset(Uuid::CreateRandom(), srgLayout);
|
||||
|
||||
MaterialTypeAssetCreator materialTypeCreator;
|
||||
materialTypeCreator.Begin(Uuid::CreateRandom());
|
||||
@@ -774,7 +773,7 @@ namespace UnitTest
|
||||
MaterialPropertyIndex colorProperty{0};
|
||||
material->SetPropertyValue(colorProperty, inputColor);
|
||||
|
||||
ProcessQueuedSrgCompilations(srgAsset);
|
||||
ProcessQueuedSrgCompilations(shaderAsset, srgLayout->GetName());
|
||||
material->Compile();
|
||||
|
||||
AZ::Color colorFromMaterial = material->GetPropertyValue<AZ::Color>(colorProperty);
|
||||
|
||||
Reference in New Issue
Block a user