diff --git a/CMakeLists.txt b/CMakeLists.txt index 38ca9b7..0a87841 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/Code/CMakeLists.txt b/Code/CMakeLists.txt index b4a0cd0..8785573 100644 --- a/Code/CMakeLists.txt +++ b/Code/CMakeLists.txt @@ -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}") @@ -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() diff --git a/Code/Platform/Linux/PAL_linux.cmake b/Code/Platform/Linux/PAL_linux.cmake index b9a0464..9450c92 100644 --- a/Code/Platform/Linux/PAL_linux.cmake +++ b/Code/Platform/Linux/PAL_linux.cmake @@ -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() diff --git a/Code/Platform/Mac/PAL_mac.cmake b/Code/Platform/Mac/PAL_mac.cmake index 89ef735..60f6ec6 100644 --- a/Code/Platform/Mac/PAL_mac.cmake +++ b/Code/Platform/Mac/PAL_mac.cmake @@ -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}) diff --git a/Code/Platform/Windows/PAL_windows.cmake b/Code/Platform/Windows/PAL_windows.cmake index 9bedbb6..69ea293 100644 --- a/Code/Platform/Windows/PAL_windows.cmake +++ b/Code/Platform/Windows/PAL_windows.cmake @@ -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}) diff --git a/Code/Source/Integration/Managers/RenderManager.cpp b/Code/Source/Integration/Managers/RenderManager.cpp index 82d4e84..7d0de4e 100644 --- a/Code/Source/Integration/Managers/RenderManager.cpp +++ b/Code/Source/Integration/Managers/RenderManager.cpp @@ -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) { @@ -121,7 +124,11 @@ void *CRenderManager::MapBuffer(AZ::RHI::Ptr 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 buffer) @@ -175,7 +182,11 @@ void CRenderManager::CollectFrame(CParticleMediumCollection *mediumCollection) AZ::RHI::Ptr 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 outBuffer = aznew AZ::RHI::Buffer; +#else AZ::RHI::Ptr 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; diff --git a/Code/Source/Integration/Render/AtomIntegration/BillboardBatchDrawer.cpp b/Code/Source/Integration/Render/AtomIntegration/BillboardBatchDrawer.cpp index 5808d13..e4c487b 100644 --- a/Code/Source/Integration/Render/AtomIntegration/BillboardBatchDrawer.cpp +++ b/Code/Source/Integration/Render/AtomIntegration/BillboardBatchDrawer.cpp @@ -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 buff = m_AtlasDefinition->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, m_AtlasSubRectsCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr 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 buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(u32))); +#else AZ::RHI::Ptr 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 buff = viewDependent.m_GenBuffers[CParticleBuffers::GenBuffer_Indices]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(u32))); +#else AZ::RHI::Ptr 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 buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticlePosition]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr 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 buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleRotation]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#else AZ::RHI::Ptr 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 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 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 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 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 buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#else AZ::RHI::Ptr 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 buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_ParticleSize2]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat2))); +#else AZ::RHI::Ptr 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 textureID = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Atlas_TextureID()); if (textureID != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = textureID->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#else AZ::RHI::Ptr buff = textureID->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#endif m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleAtlasID_ShaderRead, buff); } AZ::RHI::Ptr diffuseColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Diffuse_Color()); if (diffuseColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = diffuseColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr buff = diffuseColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#endif m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleDiffuseColor_ShaderRead, buff); } AZ::RHI::Ptr emissiveColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Emissive_EmissiveColor()); if (emissiveColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = emissiveColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); +#else AZ::RHI::Ptr buff = emissiveColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); +#endif m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleEmissiveColor_ShaderRead, buff); } AZ::RHI::Ptr distortionColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Distortion_Color()); if (distortionColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = distortionColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr buff = distortionColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#endif m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::ParticleDistortionColor_ShaderRead, buff); } AZ::RHI::Ptr alphaRemapCursor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_AlphaRemap_Cursor()); if (alphaRemapCursor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = alphaRemapCursor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#else AZ::RHI::Ptr 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 buff = viewIndependent.m_DrawRequests->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, drawRequestsCount, sizeof(Drawers::SBillboardDrawRequest))); +#else AZ::RHI::Ptr buff = viewIndependent.m_DrawRequests->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, drawRequestsCount, sizeof(Drawers::SBillboardDrawRequest))); +#endif m_PipelineCaches[0].SetBillboardingSrgBuffer(BillboardSrg::DrawRequest_ShaderRead, buff); } } diff --git a/Code/Source/Integration/Render/AtomIntegration/MeshBatchDrawer.cpp b/Code/Source/Integration/Render/AtomIntegration/MeshBatchDrawer.cpp index 5e3bf88..6b7b9dd 100644 --- a/Code/Source/Integration/Render/AtomIntegration/MeshBatchDrawer.cpp +++ b/Code/Source/Integration/Render/AtomIntegration/MeshBatchDrawer.cpp @@ -233,7 +233,11 @@ 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 buff = viewIndependent.m_GenBuffers[CParticleBuffers::GenBuffer_Matrices]->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, particleCount, sizeof(CFloat4x4))); +#else AZ::RHI::Ptr 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); } @@ -241,19 +245,31 @@ bool CMeshBatchDrawer::EmitDrawCall(SRenderContext &ctx, const SRendererBatchDra AZ::RHI::Ptr diffuseColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Diffuse_Color()); if (diffuseColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = diffuseColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr buff = diffuseColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(CFloat4))); +#endif m_PipelineCaches[i].SetMeshSrgBuffer(MeshSrg::ParticleDiffuseColor_ShaderRead, buff); } AZ::RHI::Ptr emissiveColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Emissive_EmissiveColor()); if (emissiveColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = emissiveColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset * 3, meshParticleCount * 3, sizeof(float))); +#else AZ::RHI::Ptr 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 alphaRemapCursor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_AlphaRemap_Cursor()); if (alphaRemapCursor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = alphaRemapCursor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(float))); +#else AZ::RHI::Ptr buff = alphaRemapCursor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(particleOffset, meshParticleCount, sizeof(float))); +#endif m_PipelineCaches[i].SetMeshSrgBuffer(MeshSrg::ParticleAlphaCursor_ShaderRead, buff); } diff --git a/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.cpp b/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.cpp index 5a74b42..9cfba7b 100644 --- a/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.cpp +++ b/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.cpp @@ -83,7 +83,7 @@ void CPopcornFXFeatureProcessor::Render(const RenderPacket &packet) if ((view->GetUsageFlags() & AZ::RPI::View::UsageShadow) != 0 && !castShadows) continue; - const AZ::RHI::DrawPacket *drawPacket = BuildDrawPacket(dc, view->GetRHIShaderResourceGroup(), dc.m_GlobalSortOverride); + DrawPacketPtr drawPacket = BuildDrawPacket(dc, view->GetRHIShaderResourceGroup(), dc.m_GlobalSortOverride); m_drawPackets.emplace_back(drawPacket); const CFloat3 &bboxCenter = dc.m_BoundingBox.Center(); @@ -93,7 +93,11 @@ void CPopcornFXFeatureProcessor::Render(const RenderPacket &packet) // Note: sliced draw calls have their bbox center the center of a slice, but the bbox can't be trusted. const float drawCallDepth = (cameraPosition - bboxCenter).Length(); +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + view->AddDrawPacket(drawPacket.get(), drawCallDepth); +#else view->AddDrawPacket(drawPacket, drawCallDepth); +#endif } } } @@ -127,12 +131,16 @@ void CPopcornFXFeatureProcessor::AppendLightParticles() } } -const AZ::RHI::DrawPacket *CPopcornFXFeatureProcessor::BuildDrawPacket( const SAtomRenderContext::SDrawCall &pkfxDrawCall, - const AZ::RHI::ShaderResourceGroup *viewSrg, - AZ::RHI::DrawItemSortKey sortKey) +CPopcornFXFeatureProcessor::DrawPacketPtr CPopcornFXFeatureProcessor::BuildDrawPacket(const SAtomRenderContext::SDrawCall &pkfxDrawCall, + const AZ::RHI::ShaderResourceGroup *viewSrg, + AZ::RHI::DrawItemSortKey sortKey) { AZ_UNUSED(viewSrg); +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::DrawPacketBuilder dpBuilder(AZ::RHI::MultiDevice::DefaultDevice); +#else AZ::RHI::DrawPacketBuilder dpBuilder; +#endif dpBuilder.Begin(null); dpBuilder.SetDrawArguments(pkfxDrawCall.m_DrawIndexed); diff --git a/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.h b/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.h index f76fb14..e91d7af 100644 --- a/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.h +++ b/Code/Source/Integration/Render/AtomIntegration/PopcornFXFeatureProcessor.h @@ -53,11 +53,20 @@ class CPopcornFXFeatureProcessor : public CPopcornFXFeatureProcessorInterface CRenderManager &GetRenderManager() { return m_RenderManager; } private: - const AZ::RHI::DrawPacket *BuildDrawPacket( const SAtomRenderContext::SDrawCall &pkfxDrawCall, - const AZ::RHI::ShaderResourceGroup *viewSrg, - AZ::RHI::DrawItemSortKey sortKey); - AZStd::vector> m_drawPackets; +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + using DrawPacketPtr = AZ::RHI::ConstPtr; + using DrawPackets = AZStd::vector>; +#else + using DrawPacketPtr = const AZ::RHI::DrawPacket*; + using DrawPackets = AZStd::vector>; +#endif + + DrawPacketPtr BuildDrawPacket(const SAtomRenderContext::SDrawCall &pkfxDrawCall, + const AZ::RHI::ShaderResourceGroup *viewSrg, + AZ::RHI::DrawItemSortKey sortKey); + + DrawPackets m_drawPackets; CRenderManager m_RenderManager; const SSceneViews *m_SceneViews = null; CParticleMediumCollection *m_MediumCollection = null; @@ -66,4 +75,4 @@ class CPopcornFXFeatureProcessor : public CPopcornFXFeatureProcessorInterface }; //---------------------------------------------------------------------------- -} \ No newline at end of file +} diff --git a/Code/Source/Integration/Render/AtomIntegration/RibbonBatchDrawer.cpp b/Code/Source/Integration/Render/AtomIntegration/RibbonBatchDrawer.cpp index c0d8888..8f44a8f 100644 --- a/Code/Source/Integration/Render/AtomIntegration/RibbonBatchDrawer.cpp +++ b/Code/Source/Integration/Render/AtomIntegration/RibbonBatchDrawer.cpp @@ -340,25 +340,41 @@ bool CRibbonBatchDrawer::EmitDrawCall(SRenderContext &ctx, const SRendererBatchD AZ::RHI::Ptr diffuseColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Diffuse_Color()); if (diffuseColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = diffuseColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr buff = diffuseColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#endif m_PipelineCaches[0].SetRibbonSrgBuffer(RibbonSrg::ParticleDiffuseColor_ShaderRead, buff); } AZ::RHI::Ptr emissiveColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Emissive_EmissiveColor()); if (emissiveColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = emissiveColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); +#else AZ::RHI::Ptr buff = emissiveColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount * 3, sizeof(float))); +#endif m_PipelineCaches[0].SetRibbonSrgBuffer(RibbonSrg::ParticleEmissiveColor_ShaderRead, buff); } AZ::RHI::Ptr distortionColor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_Distortion_Color()); if (distortionColor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = distortionColor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#else AZ::RHI::Ptr buff = distortionColor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(CFloat4))); +#endif m_PipelineCaches[0].SetRibbonSrgBuffer(RibbonSrg::ParticleDistortionColor_ShaderRead, buff); } AZ::RHI::Ptr alphaRemapCursor = GetCurBuffers().FindAdditionalFieldBuffer(BasicRendererProperties::SID_AlphaRemap_Cursor()); if (alphaRemapCursor != null) { +#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2 + AZ::RHI::Ptr buff = alphaRemapCursor->BuildBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#else AZ::RHI::Ptr buff = alphaRemapCursor->GetBufferView(AZ::RHI::BufferViewDescriptor::CreateStructured(0, particleCount, sizeof(float))); +#endif m_PipelineCaches[0].SetRibbonSrgBuffer(RibbonSrg::ParticleAlphaCursor_ShaderRead, buff); } } diff --git a/Code/popcornfx_autogen_files.cmake b/Code/popcornfx_autogen_files.cmake index a9a70f7..1f0eea8 100644 --- a/Code/popcornfx_autogen_files.cmake +++ b/Code/popcornfx_autogen_files.cmake @@ -12,7 +12,8 @@ set(PK_OPTIONAL_REGISTER_NODEABLE_FILES if(DEFINED O3DE_VERSION_MAJOR) # O3DE 3.x.x and higher no longer need the 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) endif() endif() diff --git a/README.md b/README.md index b84029c..8aac19b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # O3DE PopcornFX Plugin Integrates the **PopcornFX Runtime SDK** into **O3DE** as a Gem. -* **Version:** `v2.19.5` +* **Version:** `v2.19.6` * **O3DE:** `23.05`, `23.10` * **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android` diff --git a/gem.json b/gem.json index e811ba5..9e2434e 100644 --- a/gem.json +++ b/gem.json @@ -1,13 +1,13 @@ { "gem_name": "PopcornFX", - "display_name": "PopcornFX 2.19.5", + "display_name": "PopcornFX 2.19.6", "license": "Community", "license_url": "https://www.popcornfx.com/popcornfx-community-license", "origin": "Persistant Studios - popcornfx.com", "repo_uri": "https://downloads.popcornfx.com/o3de-repo", - "origin_uri": "https://downloads.popcornfx.com/o3de-repo/PopcornFX-2.19/O3DE_PopcornFXGem_v2.19.5_Win64_Linux64_LinuxARM64_Mac64.zip", - "version": "2.19.5", - "last_updated": "2024-06-27", + "origin_uri": "https://downloads.popcornfx.com/o3de-repo/PopcornFX-2.19/O3DE_PopcornFXGem_v2.19.6_Win64_Linux64_LinuxARM64_Mac64.zip", + "version": "2.19.6", + "last_updated": "2024-07-25", "type": "Code", "summary": "The PopcornFX Gem provides real-time FX solution for particle effects.", "canonical_tags": [