Skip to content

Commit

Permalink
PopcornFX Gem 2.19.6
Browse files Browse the repository at this point in the history
  • Loading branch information
PopcornFX Bot committed Jul 25, 2024
1 parent b38eb23 commit 6601fcb
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 29 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ if(DEFINED O3DE_VERSION_MAJOR)
endif()

# Apply patches here IFN
if(O3DE_VERSION_MAJOR GREATER_EQUAL 4)
if(O3DE_VERSION_MAJOR GREATER_EQUAL 4 OR
(O3DE_VERSION_MAJOR EQUAL 2 AND O3DE_VERSION_MINOR EQUAL 3)) # TempFix: Version was downgraded for 24.09 (https://github.com/PopcornFX/O3DEPopcornFXPlugin/issues/76)
# See: https://github.com/o3de/o3de/commit/c1019253252cf475131151149b8b865815d75fb0
pk_patch_file("PK_O3DE_LIT_MULTI_VIEW 0" "PK_O3DE_LIT_MULTI_VIEW 1" ${gem_path}/Assets/shaders/Common/PopcornOptions.azsli)
endif()
Expand Down
5 changes: 3 additions & 2 deletions Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://www.popcornfx.com/terms-and-conditions/
#----------------------------------------------------------------------------

set(POPCORNFX_VERSION 2.19.5)
set(POPCORNFX_VERSION 2.19.6)
set(POPCORNFX_LICENSE O3DE)

o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_name}")
Expand Down Expand Up @@ -40,7 +40,8 @@ set(PK_OPTIONAL_REGISTER_NODEABLE_DEFINES PK_REGISTER_NODEABLE)

if(DEFINED O3DE_VERSION_MAJOR)
# O3DE 3.x.x and higher no longer need the autogen nodeable registry source files
if(O3DE_VERSION_MAJOR GREATER_EQUAL 3)
if(O3DE_VERSION_MAJOR GREATER_EQUAL 3 OR
(O3DE_VERSION_MAJOR EQUAL 2 AND O3DE_VERSION_MINOR EQUAL 3)) # TempFix: Version was downgraded for 24.09 (https://github.com/PopcornFX/O3DEPopcornFXPlugin/issues/76)
unset(PK_OPTIONAL_REGISTER_NODEABLE_FILES)
unset(PK_OPTIONAL_REGISTER_NODEABLE_DEFINES)
endif()
Expand Down
8 changes: 4 additions & 4 deletions Code/Platform/Linux/PAL_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux)
set(pk_package_hash af69dc1875fe175abe701dfdc3987902432dea835b54727fd4c4e5eea157802b)
set(pk_package_id 8Gml1QREEHSwF1qy)
set(pk_package_hash 2112123d081402998b91b22b8c652126d7012fbaa3720dce85220ab9a410a837)
set(pk_package_id i8MZ5vNtezYGK7CE)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux-aarch64)
set(pk_package_hash af69dc1875fe175abe701dfdc3987902432dea835b54727fd4c4e5eea157802b_ARM64)
set(pk_package_id 8Gml1QREEHSwF1qy_ARM64)
set(pk_package_hash 2112123d081402998b91b22b8c652126d7012fbaa3720dce85220ab9a410a837_ARM64)
set(pk_package_id i8MZ5vNtezYGK7CE_ARM64)
else()
message(FATAL_ERROR "Unsupported linux architecture ${CMAKE_SYSTEM_PROCESSOR}")
endif()
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Mac/PAL_mac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-mac)
set(pk_package_hash 00f390cc28ab6b16113716b86b0c48a3bf00c07ad5482db0d0b214acdc4368bf)
set(pk_package_id vVcLXYRJ9a4tVdgF)
set(pk_package_hash 11024c36ee4f18c9f166acddbc2ceb17c78d700a1eae9a3fb08a3b51d91fa0fa)
set(pk_package_id aAclANkhYKZ0RnQR)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Windows/PAL_windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-windows)
set(pk_package_hash 3a349d0a994a820249c0c475e804d753e1da350a379051e402c1e504422de275)
set(pk_package_id B7z8fTWm3VDGfqRO)
set(pk_package_hash e5cad8a35b8310d08b0064fc3f02326aa1062cf513a649729ef74dd686b11dab)
set(pk_package_id qpAwLC9YjMCnh3XJ)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
17 changes: 14 additions & 3 deletions Code/Source/Integration/Managers/RenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@ void CRenderManager::Activate(CParticleMediumCollection *mediumCollection, const
m_FrameCollector.Initialize(init);
m_FrameCollector.InstallToMediumCollection(mediumCollection);

AZ::RHI::RHISystemInterface *rhiSystem = AZ::RHI::RHISystemInterface::Get();

AZ::RHI::BufferPoolDescriptor dynamicPoolDescriptor;
dynamicPoolDescriptor.m_heapMemoryLevel = AZ::RHI::HeapMemoryLevel::Device;
dynamicPoolDescriptor.m_hostMemoryAccess = AZ::RHI::HostMemoryAccess::Write;
dynamicPoolDescriptor.m_bindFlags = AZ::RHI::BufferBindFlags::InputAssembly | AZ::RHI::BufferBindFlags::ShaderRead;
dynamicPoolDescriptor.m_largestPooledAllocationSizeInBytes = 0x100000;

#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
m_BufferPool = aznew AZ::RHI::BufferPool;
AZ::RHI::ResultCode resultCode = m_BufferPool->Init(AZ::RHI::MultiDevice::DefaultDevice, dynamicPoolDescriptor);
#else
m_BufferPool = AZ::RHI::Factory::Get().CreateBufferPool();
AZ::RHI::ResultCode resultCode = m_BufferPool->Init(*AZ::RHI::RHISystemInterface::Get()->GetDevice(), dynamicPoolDescriptor);
#endif
m_BufferPool->SetName(AZ::Name("PopcornFXParticlesBufferPool"));
AZ::RHI::ResultCode resultCode = m_BufferPool->Init(*rhiSystem->GetDevice(), dynamicPoolDescriptor);

if (resultCode != AZ::RHI::ResultCode::Success)
{
Expand Down Expand Up @@ -121,7 +124,11 @@ void *CRenderManager::MapBuffer(AZ::RHI::Ptr<AZ::RHI::Buffer> buffer, AZ::u64 si
AZ::RHI::BufferMapResponse mapResponse;
m_BufferPool->MapBuffer(mapRequest, mapResponse);

#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
return mapResponse.m_data.begin()->second;
#else
return mapResponse.m_data;
#endif
}

void CRenderManager::UnmapBuffer(AZ::RHI::Ptr<AZ::RHI::Buffer> buffer)
Expand Down Expand Up @@ -175,7 +182,11 @@ void CRenderManager::CollectFrame(CParticleMediumCollection *mediumCollection)
AZ::RHI::Ptr<AZ::RHI::Buffer> CRenderManager::AllocBuffer(AZ::u64 bufferSize, AZ::RHI::BufferBindFlags binding, AZ::u32 alignSizeOn)
{
AZ::u64 alignedBufferSize = Mem::Align(bufferSize, alignSizeOn);
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::Buffer> outBuffer = aznew AZ::RHI::Buffer;
#else
AZ::RHI::Ptr<AZ::RHI::Buffer> outBuffer = AZ::RHI::Factory::Get().CreateBuffer();
#endif
AZ::RHI::BufferInitRequest bufferRequest;
bufferRequest.m_descriptor = AZ::RHI::BufferDescriptor{ binding, alignedBufferSize };
bufferRequest.m_descriptor.m_alignment = 0x10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,88 +354,148 @@ bool CBillboardBatchDrawer::EmitDrawCall(SRenderContext &ctx, const SRendererBat

if (m_AtlasDefinition != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = m_AtlasDefinition->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, m_AtlasSubRectsCount, sizeof(CFloat4)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = m_AtlasDefinition->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, m_AtlasSubRectsCount, sizeof(CFloat4)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::AtlasSubRects_ShaderRead, buff);
m_PipelineCaches[0].SetBillboardingSrgConstantValue(BillboardSrg::AtlasSubRectsCount_ShaderRead, m_AtlasSubRectsCount);
}
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices] != null)
{
// Unsorted indices:
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(u32)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(u32)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleIndices_ShaderRead, buff);
}
else if (viewDependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices] != null)
{
// Sorted indices:
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewDependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(u32)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewDependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(u32)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleIndices_ShaderRead, buff);
}
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticlePosition] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticlePosition]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticlePosition]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticlePositions_ShaderRead, buff);
}
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleRotation] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleRotation]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleRotation]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleRotations_ShaderRead, buff);
}
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleAxis0] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleAxis0]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); // Cannot use a float3 stride
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleAxis0]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); // Cannot use a float3 stride
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleAxis0_ShaderRead, buff);
}
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleAxis1] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleAxis1]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); // Cannot use a float3 stride
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleAxis1]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); // Cannot use a float3 stride
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleAxis1_ShaderRead, buff);
}
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleSizes_ShaderRead, buff);
}
else if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize2] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize2]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat2)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize2]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat2)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleSizes2_ShaderRead, buff);
}
// Additional field buffers:
AZ::RHI::Ptr<AZ::RHI::Buffer> textureID = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Atlas_TextureID());
if (textureID != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = textureID->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = textureID->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleAtlasID_ShaderRead, buff);
}
AZ::RHI::Ptr<AZ::RHI::Buffer> diffuseColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Diffuse_Color());
if (diffuseColor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = diffuseColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = diffuseColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleDiffuseColor_ShaderRead, buff);
}
AZ::RHI::Ptr<AZ::RHI::Buffer> emissiveColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Emissive_EmissiveColor());
if (emissiveColor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = emissiveColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = emissiveColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleEmissiveColor_ShaderRead, buff);
}
AZ::RHI::Ptr<AZ::RHI::Buffer> distortionColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Distortion_Color());
if (distortionColor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = distortionColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = distortionColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleDistortionColor_ShaderRead, buff);
}
AZ::RHI::Ptr<AZ::RHI::Buffer> alphaRemapCursor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_AlphaRemap_Cursor());
if (alphaRemapCursor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = alphaRemapCursor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = alphaRemapCursor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleAlphaCursor_ShaderRead, buff);
}

// Draw requests:
if (viewIndependent.m_DrawRequests != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_DrawRequests->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, drawRequestsCount, sizeof(Drawers::SBillboardDrawRequest)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_DrawRequests->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, drawRequestsCount, sizeof(Drawers::SBillboardDrawRequest)));
#endif
m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::DrawRequest_ShaderRead, buff);
}
}
Expand Down
16 changes: 16 additions & 0 deletions Code/Source/Integration/Render/AtomIntegration/MeshBatchDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,27 +233,43 @@ bool CMeshBatchDrawer::EmitDrawCall(SRenderContext &ctx, const SRendererBatchDra
// Non constant data: matrices
if (viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Matrices] != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Matrices]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, particleCount, sizeof(CFloat4x4)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Matrices]->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, particleCount, sizeof(CFloat4x4)));
#endif
m_PipelineCaches[i].SetMeshSrgBuffer(MeshSrg::Matrices_ShaderRead, buff);
}

// Non constant data: additionnal inputs
AZ::RHI::Ptr<AZ::RHI::Buffer> diffuseColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Diffuse_Color());
if (diffuseColor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = diffuseColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(CFloat4)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = diffuseColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(CFloat4)));
#endif
m_PipelineCaches[i].SetMeshSrgBuffer(MeshSrg::ParticleDiffuseColor_ShaderRead, buff);
}
AZ::RHI::Ptr<AZ::RHI::Buffer> emissiveColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Emissive_EmissiveColor());
if (emissiveColor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = emissiveColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset * 3, meshParticleCount * 3, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = emissiveColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset * 3, meshParticleCount * 3, sizeof(float)));
#endif
m_PipelineCaches[i].SetMeshSrgBuffer(MeshSrg::ParticleEmissiveColor_ShaderRead, buff);
}
AZ::RHI::Ptr<AZ::RHI::Buffer> alphaRemapCursor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_AlphaRemap_Cursor());
if (alphaRemapCursor != null)
{
#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = alphaRemapCursor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(float)));
#else
AZ::RHI::Ptr<AZ::RHI::BufferView> buff = alphaRemapCursor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(float)));
#endif
m_PipelineCaches[i].SetMeshSrgBuffer(MeshSrg::ParticleAlphaCursor_ShaderRead, buff);
}

Expand Down
Loading

0 comments on commit 6601fcb

Please sign in to comment.