From 483557f7ba59f8465d82e29ed1701b8f47ec736b Mon Sep 17 00:00:00 2001 From: PopcornFX Bot Date: Thu, 31 Aug 2023 11:40:24 +0200 Subject: [PATCH] PopcornFX Plugin v2.15.13 --- .github/workflows/draft-release.yml | 30 + Content/Materials/MFunc_PK_RemapAlpha.uasset | 4 +- ...PK_Default_Billboard_SixWayLightmap.uasset | 4 +- .../M_PK_Default_Mesh_Additive.uasset | 4 +- .../M_PK_Default_Mesh_Distortion.uasset | 4 +- .../Materials/M_PK_Default_Mesh_Masked.uasset | 4 +- .../M_PK_Default_Mesh_Masked_Lit.uasset | 4 +- .../Materials/M_PK_Default_Mesh_Solid.uasset | 4 +- .../M_PK_Default_Mesh_Solid_Lit.uasset | 4 +- .../M_PK_Default_Mesh_VAT_Masked_Fluid.uasset | 4 +- ...K_Default_Mesh_VAT_Masked_Fluid_Lit.uasset | 4 +- .../M_PK_Default_Mesh_VAT_Masked_Rigid.uasset | 4 +- ...K_Default_Mesh_VAT_Masked_Rigid_Lit.uasset | 4 +- .../M_PK_Default_Mesh_VAT_Masked_Soft.uasset | 4 +- ...PK_Default_Mesh_VAT_Masked_Soft_Lit.uasset | 4 +- .../M_PK_Default_Mesh_VAT_Opaque_Fluid.uasset | 4 +- ...K_Default_Mesh_VAT_Opaque_Fluid_Lit.uasset | 4 +- .../M_PK_Default_Mesh_VAT_Opaque_Rigid.uasset | 4 +- ...K_Default_Mesh_VAT_Opaque_Rigid_Lit.uasset | 4 +- .../M_PK_Default_Mesh_VAT_Opaque_Soft.uasset | 4 +- ...PK_Default_Mesh_VAT_Opaque_Soft_Lit.uasset | 4 +- .../SlateBrushes/AttributeSampler_Curve.png | 3 + .../AttributeSampler_Curve.uasset | 3 + .../SlateBrushes/AttributeSampler_Image.png | 3 + .../AttributeSampler_Image.uasset | 3 + .../SlateBrushes/AttributeSampler_Shape.png | 3 + .../AttributeSampler_Shape.uasset | 3 + .../AttributeSampler_SkeletalMesh.png | 3 + .../AttributeSampler_SkeletalMesh.uasset | 3 + .../SlateBrushes/AttributeSampler_Text.png | 3 + .../SlateBrushes/AttributeSampler_Text.uasset | 3 + .../AttributeSampler_VectorField.png | 3 + .../AttributeSampler_VectorField.uasset | 3 + .../Attributesampler_AnimTrack.png | 3 + .../Attributesampler_AnimTrack.uasset | 3 + Content/SlateBrushes/BadIcon.uasset | 4 +- .../CParticleSamplerAnimTrack.big.png | 3 - .../CParticleSamplerAnimTrack.med.png | 3 - .../CParticleSamplerAnimTrack_med.uasset | 3 - .../CParticleSamplerCurve.med.png | 3 - .../CParticleSamplerCurve_med.uasset | 3 - ...articleSamplerProceduralTurbulence.med.png | 3 - ...icleSamplerProceduralTurbulence_med.uasset | 3 - .../CParticleSamplerShape.med.png | 3 - .../CParticleSamplerShape_med.uasset | 3 - .../CParticleSamplerSkinnedMesh.med.png | 3 - .../CParticleSamplerSkinnedMesh_med.uasset | 3 - .../SlateBrushes/CParticleSamplerText.med.png | 3 - .../CParticleSamplerText_med.uasset | 3 - .../CParticleSamplerTexture.med.png | 3 - .../CParticleSamplerTexture_med.uasset | 3 - .../SlateBrushes/CShapeDescriptor_Box.med.png | 3 - .../CShapeDescriptor_Box_med.uasset | 3 - .../CShapeDescriptor_Capsule.med.png | 3 - .../CShapeDescriptor_Capsule_med.uasset | 3 - .../CShapeDescriptor_Collection.med.png | 3 - .../CShapeDescriptor_Collection_med.uasset | 3 - .../CShapeDescriptor_ComplexEllipsoid.med.png | 3 - ...hapeDescriptor_ComplexEllipsoid_med.uasset | 3 - .../CShapeDescriptor_Cone.med.png | 3 - .../CShapeDescriptor_Cone_med.uasset | 3 - .../CShapeDescriptor_Cylinder.med.png | 3 - .../CShapeDescriptor_Cylinder_med.uasset | 3 - .../CShapeDescriptor_Mesh.med.png | 3 - .../CShapeDescriptor_Mesh_med.uasset | 3 - .../CShapeDescriptor_Sphere.med.png | 3 - .../CShapeDescriptor_Sphere_med.uasset | 3 - Content/SlateBrushes/EffectEditor_Bounds.png | 4 +- Content/SlateBrushes/Resource_AnimTrack.png | 3 + Content/SlateBrushes/Resource_Atlas.png | 3 + Content/SlateBrushes/Resource_Effect.png | 3 + Content/SlateBrushes/Resource_Font.png | 3 + .../icon_PopcornFX_Logo_256x.uasset | 4 +- .../icon_PopcornFX_Logo_Pkan_64x.png | 3 - .../icon_PopcornFX_Logo_Pkfm_16x.png | 3 - .../icon_PopcornFX_Logo_Pkfm_64x.png | 3 - .../icon_PopcornFX_Logo_Pksc_16x.png | 3 - .../icon_PopcornFX_Logo_Pksc_64x.png | 3 - .../icon_PopcornFX_Logo_pkan_16x.png | 3 - .../icon_PopcornFX_Logo_pkat_16x.png | 3 - .../icon_PopcornFX_Logo_pkat_64x.png | 3 - .../icon_PopcornFX_Logo_pkfx_16x.png | 3 - .../icon_PopcornFX_Logo_pkfx_64x.png | 3 - Download_SDK_Desktop.bat | 2 +- Download_SDK_Mobile.bat | 2 +- PopcornFX.uplugin | 4 +- README.md | 2 +- ...ornFXBillboarderBillboardComputeShader.usf | 571 ------------------ .../PopcornFXBillboarderMeshComputeShader.usf | 181 +----- .../PopcornFXCopyStreamComputeShader.usf | 176 ------ Shaders/Private/PopcornFXGPUBillboard.ush | 26 +- Shaders/Private/PopcornFXGPUVertexFactory.ush | 24 + .../Private/PopcornFXMeshVertexFactory.ush | 25 +- .../PopcornFXSkeletalMeshVertexFactory.ush | 22 +- Shaders/Private/PopcornFXVertexFactory.ush | 6 +- Source/PopcornFX/PopcornFX.Build.cs | 43 +- .../Private/Assets/PopcornFXFile.cpp | 10 +- .../Private/Assets/PopcornFXMesh.cpp | 4 +- .../Assets/PopcornFXRendererMaterial.cpp | 30 +- .../Attributes/PopcornFXAttributeList.cpp | 37 -- .../Attributes/PopcornFXAttributeSamplers.cpp | 30 +- .../PopcornFXDetailsAttributeList.cpp | 21 +- .../Private/Editor/PopcornFXStyle.cpp | 81 +-- ...cornFXCustomizationSubRendererMaterial.cpp | 3 + ...opcornFXCustomizationSubRendererMaterial.h | 1 + .../Private/GPUSim/PopcornFXBillboarderCS.cpp | 546 +++-------------- .../Private/GPUSim/PopcornFXBillboarderCS.h | 222 +------ .../Private/GPUSim/PopcornFXGPUSim.cpp | 50 -- .../Private/GPUSim/PopcornFXGPUSim.h | 11 - .../Private/GPUSim/PopcornFXGPUSim_D3D11.cpp | 225 +------ .../Private/GPUSim/PopcornFXGPUSim_D3D11.h | 8 +- .../Private/GPUSim/PopcornFXGPUSim_D3D12.cpp | 75 +-- .../Private/GPUSim/PopcornFXGPUSim_D3D12.h | 6 - .../GPUSim/PopcornFXSortComputeShader.cpp | 132 +++- .../Private/Internal/ParticleScene.cpp | 30 +- .../Internal/ResourceHandlerImage_UE.cpp | 2 +- Source/PopcornFX/Private/PopcornFXHelper.cpp | 14 + Source/PopcornFX/Private/PopcornFXHelper.h | 4 + .../Private/PopcornFXSettingsEditor.cpp | 6 +- .../Render/BatchDrawer_Billboard_CPU.cpp | 4 + .../Render/BatchDrawer_Billboard_GPU.cpp | 95 ++- .../Private/Render/BatchDrawer_Mesh_CPU.cpp | 5 + .../Private/Render/BatchDrawer_Ribbon_CPU.cpp | 4 + .../Render/BatchDrawer_SkeletalMesh_CPU.cpp | 13 +- .../Render/BatchDrawer_Triangle_CPU.cpp | 4 + .../PopcornFX/Private/Render/MaterialDesc.cpp | 4 + .../Private/Render/PopcornFXBuffer.cpp | 68 ++- .../Private/Render/PopcornFXBuffer.h | 12 +- .../Render/PopcornFXGPUVertexFactory.cpp | 25 +- .../Render/PopcornFXGPUVertexFactory.h | 4 + .../Render/PopcornFXMeshVertexFactory.cpp | 8 + .../Render/PopcornFXMeshVertexFactory.h | 4 + .../PopcornFXSkeletalMeshVertexFactory.cpp | 34 ++ .../PopcornFXSkeletalMeshVertexFactory.h | 4 + .../Private/Render/PopcornFXVertexFactory.cpp | 4 + .../Private/Render/PopcornFXVertexFactory.h | 4 + .../Private/Render/RenderBatchManager.cpp | 4 + .../Public/Assets/PopcornFXRendererMaterial.h | 5 +- .../PopcornFX/Public/PopcornFXAttributeList.h | 1 - .../PopcornFXDefaultMaterialsSettings.h | 4 + .../Public/PopcornFXVersionGenerated.h | 2 +- .../Private/PopcornFXEmitterFactory.cpp | 2 +- .../Private/PopcornFXFileReimportFactory.cpp | 2 +- 143 files changed, 917 insertions(+), 2330 deletions(-) create mode 100644 .github/workflows/draft-release.yml create mode 100644 Content/SlateBrushes/AttributeSampler_Curve.png create mode 100644 Content/SlateBrushes/AttributeSampler_Curve.uasset create mode 100644 Content/SlateBrushes/AttributeSampler_Image.png create mode 100644 Content/SlateBrushes/AttributeSampler_Image.uasset create mode 100644 Content/SlateBrushes/AttributeSampler_Shape.png create mode 100644 Content/SlateBrushes/AttributeSampler_Shape.uasset create mode 100644 Content/SlateBrushes/AttributeSampler_SkeletalMesh.png create mode 100644 Content/SlateBrushes/AttributeSampler_SkeletalMesh.uasset create mode 100644 Content/SlateBrushes/AttributeSampler_Text.png create mode 100644 Content/SlateBrushes/AttributeSampler_Text.uasset create mode 100644 Content/SlateBrushes/AttributeSampler_VectorField.png create mode 100644 Content/SlateBrushes/AttributeSampler_VectorField.uasset create mode 100644 Content/SlateBrushes/Attributesampler_AnimTrack.png create mode 100644 Content/SlateBrushes/Attributesampler_AnimTrack.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerAnimTrack.big.png delete mode 100644 Content/SlateBrushes/CParticleSamplerAnimTrack.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerAnimTrack_med.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerCurve.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerCurve_med.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerProceduralTurbulence.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerProceduralTurbulence_med.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerShape.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerShape_med.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerSkinnedMesh.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerSkinnedMesh_med.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerText.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerText_med.uasset delete mode 100644 Content/SlateBrushes/CParticleSamplerTexture.med.png delete mode 100644 Content/SlateBrushes/CParticleSamplerTexture_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Box.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Box_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Capsule.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Capsule_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Collection.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Collection_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Cone.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Cone_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Cylinder.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Cylinder_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Mesh.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Mesh_med.uasset delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Sphere.med.png delete mode 100644 Content/SlateBrushes/CShapeDescriptor_Sphere_med.uasset create mode 100644 Content/SlateBrushes/Resource_AnimTrack.png create mode 100644 Content/SlateBrushes/Resource_Atlas.png create mode 100644 Content/SlateBrushes/Resource_Effect.png create mode 100644 Content/SlateBrushes/Resource_Font.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_Pkan_64x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_16x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_64x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_16x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_64x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_pkan_16x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_pkat_16x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_pkat_64x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_16x.png delete mode 100644 Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_64x.png delete mode 100644 Shaders/Private/PopcornFXBillboarderBillboardComputeShader.usf delete mode 100644 Shaders/Private/PopcornFXCopyStreamComputeShader.usf diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 0000000..b69523a --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,30 @@ +on: + push: + tags: + - v*.*.* + +jobs: + release-on-tag: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + + - uses: jungwinter/split@master + id: split + with: + msg: ${{ github.ref_name }} + separator: "." + + - name: Set environment + run: echo "VERSION=$(echo "${GITHUB_REF_NAME#v}" | sed 's/-LTS//g')" >> $GITHUB_ENV && echo "MINOR_VERSION=${{ steps.split.outputs._0 }}.${{ steps.split.outputs._1 }}" >> $GITHUB_ENV + + - uses: ncipollo/release-action@v1 + with: + draft: true + name: "Unreal Engine Plugin: ${{ github.ref_name }}" + body: "PopcornFX Plugin v${{ github.ref_name }} for Unreal Engine\n + You can download the PopcornFX Editor and find the full changelog here:\n + https://wiki.popcornfx.com/index.php?title=PK-Editor_${{ env.MINOR_VERSION }}#Changelog_${{ env.VERSION }}" \ No newline at end of file diff --git a/Content/Materials/MFunc_PK_RemapAlpha.uasset b/Content/Materials/MFunc_PK_RemapAlpha.uasset index 7e0f4bc..691161f 100644 --- a/Content/Materials/MFunc_PK_RemapAlpha.uasset +++ b/Content/Materials/MFunc_PK_RemapAlpha.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6212002502b2d3050e309541fe57243f62819e4d25e1308c2c615725940e10cb -size 101073 +oid sha256:5ecd67723c91bb3a76b3a3514ed6121f5ef14c630e76bc2777fd7ca697c0ff79 +size 105767 diff --git a/Content/Materials/M_PK_Default_Billboard_SixWayLightmap.uasset b/Content/Materials/M_PK_Default_Billboard_SixWayLightmap.uasset index d152b5a..011b75c 100644 --- a/Content/Materials/M_PK_Default_Billboard_SixWayLightmap.uasset +++ b/Content/Materials/M_PK_Default_Billboard_SixWayLightmap.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57d92d9f55b2fc0d91b5889dd9ba19f495d34ac01cd261360375f00f679ad676 -size 86055 +oid sha256:d8d10cebe201edc450fe5c3cf8f32c67591e0ba541dc00d11eb402129a3acdd0 +size 101139 diff --git a/Content/Materials/M_PK_Default_Mesh_Additive.uasset b/Content/Materials/M_PK_Default_Mesh_Additive.uasset index 6888c5b..ff5b92c 100644 --- a/Content/Materials/M_PK_Default_Mesh_Additive.uasset +++ b/Content/Materials/M_PK_Default_Mesh_Additive.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc0585f3bbcedbf05d2dad469e1e2404ce581f0a8eee1702ceb191b576daaba3 -size 101766 +oid sha256:1a801ac83a9ef6d2dae3aecfd549b61a6e5e88d1eadaa05ee632304b27bc0620 +size 101530 diff --git a/Content/Materials/M_PK_Default_Mesh_Distortion.uasset b/Content/Materials/M_PK_Default_Mesh_Distortion.uasset index c8ada6a..b5969a7 100644 --- a/Content/Materials/M_PK_Default_Mesh_Distortion.uasset +++ b/Content/Materials/M_PK_Default_Mesh_Distortion.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f04389b7677c6efff45ac86cc0f0ca36634f4bcceaa85e08a6e2c12a346c9d26 -size 94331 +oid sha256:e3fd1bf113695d4132b3541e1db4839f7274e06af09571f0f333bceda1da1d61 +size 94493 diff --git a/Content/Materials/M_PK_Default_Mesh_Masked.uasset b/Content/Materials/M_PK_Default_Mesh_Masked.uasset index 3427bbe..1a9a87b 100644 --- a/Content/Materials/M_PK_Default_Mesh_Masked.uasset +++ b/Content/Materials/M_PK_Default_Mesh_Masked.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5485c7f2ad4dc27fcb2bcdcc990a45dd9ca2e7c4e95bc5cbe980396790c0b44 -size 92166 +oid sha256:9a0cff09678f89b759289a8edf6762209b7e22750f3acd9924dfff42deac89c1 +size 121677 diff --git a/Content/Materials/M_PK_Default_Mesh_Masked_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_Masked_Lit.uasset index 73fed2a..218004b 100644 --- a/Content/Materials/M_PK_Default_Mesh_Masked_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_Masked_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:964898b46c1916f78810c5f3c13cb3b9387debf5206f8ecc43658ad4dd000734 -size 126708 +oid sha256:77be8d888cb9b674ceda9ca71dabfc6eb8de8fc5f3d7700cbff5564381fc4727 +size 127204 diff --git a/Content/Materials/M_PK_Default_Mesh_Solid.uasset b/Content/Materials/M_PK_Default_Mesh_Solid.uasset index 0b4d8f2..588ec8f 100644 --- a/Content/Materials/M_PK_Default_Mesh_Solid.uasset +++ b/Content/Materials/M_PK_Default_Mesh_Solid.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fcaa2166c5c45fb08e8ae3e90df5c1b64d357f28ca37493d964014357f9cf087 -size 117047 +oid sha256:80434d110dfb5bc8e4b21b5c3317c295adee46d473cbdbc6f5042f7fba9849b3 +size 116974 diff --git a/Content/Materials/M_PK_Default_Mesh_Solid_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_Solid_Lit.uasset index 536b4a3..36890b4 100644 --- a/Content/Materials/M_PK_Default_Mesh_Solid_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_Solid_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:49ac2964404580444eb0330f9ac0b9b9e723cd6f0eb4fffad8f98b9e28d5f210 -size 122775 +oid sha256:d4426630f2ac6c540428544ca27388daa1ecf7d94fb9218fb0a25414b71b0643 +size 122735 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid.uasset index 554bd6b..9bcbb2f 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ee9edefc338331ebbd73c210524f84d0137fd34deb770a71f0402da4921bcc8 -size 130963 +oid sha256:b88560704bb70bb4162f21c7f8e89f18ac225441da0765db295aa2826d430a5c +size 131268 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid_Lit.uasset index 143e656..2b88179 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Fluid_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1be023076c26ddc6fa7a1a02237a7712ad9e89b5b27a6b77d572677c0583ffe7 -size 136212 +oid sha256:def6921e654813344365eb62a3728d99e96496ce815fb1065ebcf5a5bf7f1485 +size 136030 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid.uasset index 4bc6e4f..3f24cf8 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f21d7620b5948c7fe5aa5b96ecb6ab07a97ac85c74381cc5778f0c1c1bbedfa9 -size 128702 +oid sha256:e2cf40976b283cf644b44867de42410efefbf6fa342f34ef518eceda1ea0c272 +size 128936 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid_Lit.uasset index 0a8c15a..03318fd 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Rigid_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c99d625b1157dfad19bcfb5b99fbd984580ea29601cfa173210e6cbc4d47092 -size 135650 +oid sha256:b20d5bbec2f1b328b05e11457012a4edd4205bd7302be41939763b446ccdf30a +size 135988 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft.uasset index ad891eb..0ee92eb 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6fa3738597ba5385f47374ce81f9ae5406cba2732b34ce65bfc00db5546df274 -size 130879 +oid sha256:84b877698f66ae8df998e5d428f1df2f3ecf69b16f468038474e9aab2a491927 +size 131184 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft_Lit.uasset index bcae2fc..b1a4e43 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Masked_Soft_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e505f1d17c7aa6570b0b6dede5fdcb2e917a3d210cbd9a565c6f25834e24e9d8 -size 138749 +oid sha256:bae87c232a5a74176a212e9d633771ee2f3c7edf34e40962dc79807737c0f2f8 +size 139087 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid.uasset index 47196b5..2aa1ba2 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b783b6eecd61f690f81e32a719f73c465cabc532f0eb8ba4d59463851678a48 -size 126130 +oid sha256:998ec845cc4eec323a1e5ea2efde79b7731bc87adaf0d47ebd9d027904cc1c51 +size 126364 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid_Lit.uasset index 816002e..5849a59 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Fluid_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a1caf439130cde619d10cc61fc7cbcaf0296f90629b45e1cff31aaa8b5762c6 -size 131044 +oid sha256:2e18698ab4d5f22ed341cbc8cf0c2d5b1ab3dc3fbe37f5197288d8700d3092a2 +size 131311 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid.uasset index 059b67e..b7ad62e 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52df9e19f19b312e242d5c3a6a185cbad12490812bffa78113c95fe8a12b3523 -size 123842 +oid sha256:6927d3d7cc73af16edb5a11ef903a4582e358e542f417c6f28d095af0f64dfa2 +size 124076 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid_Lit.uasset index ead81f7..68596e5 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Rigid_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8323119e77232d2579bd5b8c668ab3ad377cdc9b43d32e7a1b09f8b7cd5cb3f2 -size 131164 +oid sha256:a432d4eeb605eac9ddcf42fc5612c019e40be516a67ee00a7e8c63e4b3985adf +size 131053 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft.uasset index f3501dc..50b6491 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3be76e0ccfc7c229728832919389093ec523bce8ef7b08a697c37e8ac2ef80ce -size 125907 +oid sha256:7d7be201f9f1fd99f4ad6b766b78975bafabd757e1a95210d0cf364c757984f5 +size 126212 diff --git a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft_Lit.uasset b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft_Lit.uasset index f0fbb39..6fdefb1 100644 --- a/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft_Lit.uasset +++ b/Content/Materials/M_PK_Default_Mesh_VAT_Opaque_Soft_Lit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3b027a2efe017da0ec61e51172ee96f6d655a3f5a839d17fcdf0027ff1f73136 -size 133469 +oid sha256:77a9f5b4eda2f3e1e4b5aace1ec4780e1027a845a059479527df165eb6965297 +size 133287 diff --git a/Content/SlateBrushes/AttributeSampler_Curve.png b/Content/SlateBrushes/AttributeSampler_Curve.png new file mode 100644 index 0000000..2d5a33d --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Curve.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b0e124d18c4317482a881a1594e3c64a0bb32ae0763e747dcea657e2043e367 +size 642 diff --git a/Content/SlateBrushes/AttributeSampler_Curve.uasset b/Content/SlateBrushes/AttributeSampler_Curve.uasset new file mode 100644 index 0000000..32c7591 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Curve.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b065706062712b2ab7c8698c38447800ddcded7d86624ff9422b5b02b858d07e +size 5708 diff --git a/Content/SlateBrushes/AttributeSampler_Image.png b/Content/SlateBrushes/AttributeSampler_Image.png new file mode 100644 index 0000000..cf21377 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Image.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96f4f9696bb22fdce3846abe3f976e0ebe82e1b718c3873455241a80ef4856cf +size 475 diff --git a/Content/SlateBrushes/AttributeSampler_Image.uasset b/Content/SlateBrushes/AttributeSampler_Image.uasset new file mode 100644 index 0000000..24378a5 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Image.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6db554d5173cd4a46756070137b13cf6e3c189a4629389bffa2ba217398fc64f +size 5060 diff --git a/Content/SlateBrushes/AttributeSampler_Shape.png b/Content/SlateBrushes/AttributeSampler_Shape.png new file mode 100644 index 0000000..3df8339 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Shape.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e4e7046242d0d8d4449b0f5ea3ae807a18e02eabf4ca872b490beb1e8de1e60 +size 634 diff --git a/Content/SlateBrushes/AttributeSampler_Shape.uasset b/Content/SlateBrushes/AttributeSampler_Shape.uasset new file mode 100644 index 0000000..613c542 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Shape.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e713e97fa3adc1ad888a848689d5d655269e5aff0c913f455b2ca508011433a2 +size 5451 diff --git a/Content/SlateBrushes/AttributeSampler_SkeletalMesh.png b/Content/SlateBrushes/AttributeSampler_SkeletalMesh.png new file mode 100644 index 0000000..57b3ee1 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_SkeletalMesh.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:679ec872f41d4255369ff54cfc447b6264041052fda290bef1bb671fc43bcd95 +size 886 diff --git a/Content/SlateBrushes/AttributeSampler_SkeletalMesh.uasset b/Content/SlateBrushes/AttributeSampler_SkeletalMesh.uasset new file mode 100644 index 0000000..3ba27ac --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_SkeletalMesh.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4183acce50ac2a6669f0f5b56abd1c7b1b3e7546fe669dfce53191d62846a7ce +size 6074 diff --git a/Content/SlateBrushes/AttributeSampler_Text.png b/Content/SlateBrushes/AttributeSampler_Text.png new file mode 100644 index 0000000..ccefc75 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Text.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2a9a95b59ce9f40697362746b162b7b83cd43fa51a7d26bd751827c84b77171 +size 596 diff --git a/Content/SlateBrushes/AttributeSampler_Text.uasset b/Content/SlateBrushes/AttributeSampler_Text.uasset new file mode 100644 index 0000000..aaa0f6e --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_Text.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:beb1cfa0967d828e19b16f9823016c0b71fc3044d681694e4f6e6199a6f8c154 +size 5468 diff --git a/Content/SlateBrushes/AttributeSampler_VectorField.png b/Content/SlateBrushes/AttributeSampler_VectorField.png new file mode 100644 index 0000000..15f5888 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_VectorField.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:349908e790c1bd3a137219f90e70ed87ae0615516195b42ef02763c7901ca693 +size 2303 diff --git a/Content/SlateBrushes/AttributeSampler_VectorField.uasset b/Content/SlateBrushes/AttributeSampler_VectorField.uasset new file mode 100644 index 0000000..a24e7b7 --- /dev/null +++ b/Content/SlateBrushes/AttributeSampler_VectorField.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8f6d27da893397b402fcd04e430789b82fe850f0325981956dcc024f7ab23d2 +size 11620 diff --git a/Content/SlateBrushes/Attributesampler_AnimTrack.png b/Content/SlateBrushes/Attributesampler_AnimTrack.png new file mode 100644 index 0000000..1f8ef58 --- /dev/null +++ b/Content/SlateBrushes/Attributesampler_AnimTrack.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fd07bba360442fc93d0966e6774ea08e0726ad74106d1f4de26e86340df0df5 +size 798 diff --git a/Content/SlateBrushes/Attributesampler_AnimTrack.uasset b/Content/SlateBrushes/Attributesampler_AnimTrack.uasset new file mode 100644 index 0000000..3a82b3a --- /dev/null +++ b/Content/SlateBrushes/Attributesampler_AnimTrack.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74b79dc3b574583fc92783eb752ee2d9a03855f322a8ca51073b0fc8015c60df +size 5722 diff --git a/Content/SlateBrushes/BadIcon.uasset b/Content/SlateBrushes/BadIcon.uasset index 5c8915d..2bca65d 100644 --- a/Content/SlateBrushes/BadIcon.uasset +++ b/Content/SlateBrushes/BadIcon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aeaeacfc46340a6a8630c0f72f91a22ecc8d61f6d59e045cc9f9a2b278dba17b -size 14104 +oid sha256:711f5c76bb6752ca2ba28503e0b83e3a2c53a8b7914f1039af2920cd5562daf7 +size 14820 diff --git a/Content/SlateBrushes/CParticleSamplerAnimTrack.big.png b/Content/SlateBrushes/CParticleSamplerAnimTrack.big.png deleted file mode 100644 index 60e1cc0..0000000 --- a/Content/SlateBrushes/CParticleSamplerAnimTrack.big.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:251a1763570d036427f20ec7244ce7dfb9093da0424c563009c683afba8609cb -size 5050 diff --git a/Content/SlateBrushes/CParticleSamplerAnimTrack.med.png b/Content/SlateBrushes/CParticleSamplerAnimTrack.med.png deleted file mode 100644 index 06afc0e..0000000 --- a/Content/SlateBrushes/CParticleSamplerAnimTrack.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5b35fc74ef91d4cca0d7c888ca6ddcccfa302c10266c621a7643a68b45398358 -size 2076 diff --git a/Content/SlateBrushes/CParticleSamplerAnimTrack_med.uasset b/Content/SlateBrushes/CParticleSamplerAnimTrack_med.uasset deleted file mode 100644 index 449e4e9..0000000 --- a/Content/SlateBrushes/CParticleSamplerAnimTrack_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a9490e5c505b824957dceace9298e8c4c10800ca2b7c88b3acc36ed5034fd258 -size 6668 diff --git a/Content/SlateBrushes/CParticleSamplerCurve.med.png b/Content/SlateBrushes/CParticleSamplerCurve.med.png deleted file mode 100644 index 8faa9c7..0000000 --- a/Content/SlateBrushes/CParticleSamplerCurve.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a52288b9d4a7f08c0610e5458faea359be912f0f9a6c890968d742f6de67f123 -size 1437 diff --git a/Content/SlateBrushes/CParticleSamplerCurve_med.uasset b/Content/SlateBrushes/CParticleSamplerCurve_med.uasset deleted file mode 100644 index 0341909..0000000 --- a/Content/SlateBrushes/CParticleSamplerCurve_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f145623c980aebfeb30e24a9c913c510b0a76953399b89aa025c5c9863428cd8 -size 5444 diff --git a/Content/SlateBrushes/CParticleSamplerProceduralTurbulence.med.png b/Content/SlateBrushes/CParticleSamplerProceduralTurbulence.med.png deleted file mode 100644 index f193191..0000000 --- a/Content/SlateBrushes/CParticleSamplerProceduralTurbulence.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d373c10a51648cc71aa20250c05b418154d7716617583219f72fd8514e822dfb -size 2331 diff --git a/Content/SlateBrushes/CParticleSamplerProceduralTurbulence_med.uasset b/Content/SlateBrushes/CParticleSamplerProceduralTurbulence_med.uasset deleted file mode 100644 index faafd35..0000000 --- a/Content/SlateBrushes/CParticleSamplerProceduralTurbulence_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3897441d5a19fee10e1806d278628a93761b150c1a1fcfc5643e48ce79ee28d9 -size 6425 diff --git a/Content/SlateBrushes/CParticleSamplerShape.med.png b/Content/SlateBrushes/CParticleSamplerShape.med.png deleted file mode 100644 index d0665c4..0000000 --- a/Content/SlateBrushes/CParticleSamplerShape.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:040827e93c9418c7bba09456c9e08169e712703f77f140e566717609eca7efef -size 2184 diff --git a/Content/SlateBrushes/CParticleSamplerShape_med.uasset b/Content/SlateBrushes/CParticleSamplerShape_med.uasset deleted file mode 100644 index 8066e14..0000000 --- a/Content/SlateBrushes/CParticleSamplerShape_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fa97d8f2e5945a03d5c3e96f25b98a72063d0e2928cae5627b7a5ff1c3c5dd40 -size 5989 diff --git a/Content/SlateBrushes/CParticleSamplerSkinnedMesh.med.png b/Content/SlateBrushes/CParticleSamplerSkinnedMesh.med.png deleted file mode 100644 index 4d20f11..0000000 --- a/Content/SlateBrushes/CParticleSamplerSkinnedMesh.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3e2ea3ed0d666aee2179cbd9f9b4c80c123ce3c3fb04dd9f22accc4392650449 -size 4508 diff --git a/Content/SlateBrushes/CParticleSamplerSkinnedMesh_med.uasset b/Content/SlateBrushes/CParticleSamplerSkinnedMesh_med.uasset deleted file mode 100644 index da0f626..0000000 --- a/Content/SlateBrushes/CParticleSamplerSkinnedMesh_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:65bb585cace5809131bbe20cbd03cb0fb08a60dfafc2ee6c759c4e81c90db1f0 -size 5112 diff --git a/Content/SlateBrushes/CParticleSamplerText.med.png b/Content/SlateBrushes/CParticleSamplerText.med.png deleted file mode 100644 index 0028178..0000000 --- a/Content/SlateBrushes/CParticleSamplerText.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e67705d5bf44d4ebca0d43cd69c2f4087803bf568a3b8e8f47e8377fe8338158 -size 1437 diff --git a/Content/SlateBrushes/CParticleSamplerText_med.uasset b/Content/SlateBrushes/CParticleSamplerText_med.uasset deleted file mode 100644 index 9244870..0000000 --- a/Content/SlateBrushes/CParticleSamplerText_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a545cb0632feb7720fb984b850e409a7275768be241768153ad6f62f1669d27c -size 5292 diff --git a/Content/SlateBrushes/CParticleSamplerTexture.med.png b/Content/SlateBrushes/CParticleSamplerTexture.med.png deleted file mode 100644 index f1904bb..0000000 --- a/Content/SlateBrushes/CParticleSamplerTexture.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:310eb92decb53516b8d4122eba032d8a54a735f7635a1ded450d51fd124550da -size 2072 diff --git a/Content/SlateBrushes/CParticleSamplerTexture_med.uasset b/Content/SlateBrushes/CParticleSamplerTexture_med.uasset deleted file mode 100644 index 73d4e29..0000000 --- a/Content/SlateBrushes/CParticleSamplerTexture_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0eb87d0b7e7d6576bc57a38ff16c6ad79961126c51d06a8988b6adf2c09e5a49 -size 5173 diff --git a/Content/SlateBrushes/CShapeDescriptor_Box.med.png b/Content/SlateBrushes/CShapeDescriptor_Box.med.png deleted file mode 100644 index 02cc716..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Box.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4781181b70e592c4533f77e28e2968f92ebbf90bb7f682ac1186be4fb3e102ec -size 1971 diff --git a/Content/SlateBrushes/CShapeDescriptor_Box_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Box_med.uasset deleted file mode 100644 index eda3000..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Box_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e382046d2aa34fe8039f355012c180665bba1e49fe9fae8fe1616cf5d6cc466a -size 5181 diff --git a/Content/SlateBrushes/CShapeDescriptor_Capsule.med.png b/Content/SlateBrushes/CShapeDescriptor_Capsule.med.png deleted file mode 100644 index 1b59bbc..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Capsule.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:41d0f6b35bcf41652c5f5b1d80ac246e44fa709eef3f33906bdad20110f6f44d -size 1968 diff --git a/Content/SlateBrushes/CShapeDescriptor_Capsule_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Capsule_med.uasset deleted file mode 100644 index 5d1c82e..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Capsule_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c69db3863515cd0b2070bf5e92f260555d12415aa543c3e7228e02e827bbd795 -size 5668 diff --git a/Content/SlateBrushes/CShapeDescriptor_Collection.med.png b/Content/SlateBrushes/CShapeDescriptor_Collection.med.png deleted file mode 100644 index c3abcf4..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Collection.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8b5618e60486a99dd4da6442827cfa2e7d02e8f3e8e6f5267c5dbfa78c41e1f0 -size 2142 diff --git a/Content/SlateBrushes/CShapeDescriptor_Collection_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Collection_med.uasset deleted file mode 100644 index d6193dc..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Collection_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e84df0e58b10e6defebb0e6a3f89be9a0c8fbac422039ee6e116e3c1bbc28be7 -size 5743 diff --git a/Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid.med.png b/Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid.med.png deleted file mode 100644 index 19ad971..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:32e8e37a25386db08a9db26610ee2cba77d1b36281a444ee1b93279204d14cf5 -size 2245 diff --git a/Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid_med.uasset b/Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid_med.uasset deleted file mode 100644 index 9c95e7e..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_ComplexEllipsoid_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:93421d0f9b298edee15fa2df10286a0f1b6caa71fdca9db33fd714d6577080f5 -size 5828 diff --git a/Content/SlateBrushes/CShapeDescriptor_Cone.med.png b/Content/SlateBrushes/CShapeDescriptor_Cone.med.png deleted file mode 100644 index 60faf87..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Cone.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b5494b57b96b1d3c9886abacff998c21d436c98becd8ecec30734636607dccc1 -size 1812 diff --git a/Content/SlateBrushes/CShapeDescriptor_Cone_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Cone_med.uasset deleted file mode 100644 index fba0f2e..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Cone_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:95f9c4f0b6dbc216286494b594cde7ddeb45e052fa6f65aa670f1a8ed20cd1d1 -size 5366 diff --git a/Content/SlateBrushes/CShapeDescriptor_Cylinder.med.png b/Content/SlateBrushes/CShapeDescriptor_Cylinder.med.png deleted file mode 100644 index 89be464..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Cylinder.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ca910883ab40f7349edfa74477702f30c2a170f9e5e96a8841ba8fde05f00cff -size 1447 diff --git a/Content/SlateBrushes/CShapeDescriptor_Cylinder_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Cylinder_med.uasset deleted file mode 100644 index e80ca6b..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Cylinder_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d9d1853ee6ae0558bfd710df3a71ebad722c8f14b39393fe37fb8edb71fadeaf -size 4732 diff --git a/Content/SlateBrushes/CShapeDescriptor_Mesh.med.png b/Content/SlateBrushes/CShapeDescriptor_Mesh.med.png deleted file mode 100644 index c422318..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Mesh.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c7a86781af766f28fd368c140cbd13db680e1d29b7860746a0606ac5eaf504f6 -size 2241 diff --git a/Content/SlateBrushes/CShapeDescriptor_Mesh_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Mesh_med.uasset deleted file mode 100644 index 623427d..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Mesh_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f4fb5dd7d006b85f99c111e6494ef113c8985694bcd65457759ca478a6ba5f28 -size 6491 diff --git a/Content/SlateBrushes/CShapeDescriptor_Sphere.med.png b/Content/SlateBrushes/CShapeDescriptor_Sphere.med.png deleted file mode 100644 index d0665c4..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Sphere.med.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:040827e93c9418c7bba09456c9e08169e712703f77f140e566717609eca7efef -size 2184 diff --git a/Content/SlateBrushes/CShapeDescriptor_Sphere_med.uasset b/Content/SlateBrushes/CShapeDescriptor_Sphere_med.uasset deleted file mode 100644 index 0e9d173..0000000 --- a/Content/SlateBrushes/CShapeDescriptor_Sphere_med.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e0779c90e7f64f6da38c165ff0f16c6ed546debccf66fc22e2bdb9c71c73ff8e -size 6001 diff --git a/Content/SlateBrushes/EffectEditor_Bounds.png b/Content/SlateBrushes/EffectEditor_Bounds.png index 138306f..0935601 100644 --- a/Content/SlateBrushes/EffectEditor_Bounds.png +++ b/Content/SlateBrushes/EffectEditor_Bounds.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fed553a98ab0f257d00b934d61ce2bd11e2cf226ddbee964a532f5ec5843a1c9 -size 815 +oid sha256:dfcfc53037137c3d596ab2719a63cf7585a17ee0abde9ccc72406d5a31caea4e +size 1299 diff --git a/Content/SlateBrushes/Resource_AnimTrack.png b/Content/SlateBrushes/Resource_AnimTrack.png new file mode 100644 index 0000000..1f8ef58 --- /dev/null +++ b/Content/SlateBrushes/Resource_AnimTrack.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fd07bba360442fc93d0966e6774ea08e0726ad74106d1f4de26e86340df0df5 +size 798 diff --git a/Content/SlateBrushes/Resource_Atlas.png b/Content/SlateBrushes/Resource_Atlas.png new file mode 100644 index 0000000..4677c9c --- /dev/null +++ b/Content/SlateBrushes/Resource_Atlas.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba2dff2aeb6c1ab666cccdd98c0774fdef37de1811c3d82dd2d3b7bec210cdeb +size 177 diff --git a/Content/SlateBrushes/Resource_Effect.png b/Content/SlateBrushes/Resource_Effect.png new file mode 100644 index 0000000..6848240 --- /dev/null +++ b/Content/SlateBrushes/Resource_Effect.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0acd14faac95d31b3b94eccaf8983cfcf2fd4338e24c620370925d9bc78127a7 +size 855 diff --git a/Content/SlateBrushes/Resource_Font.png b/Content/SlateBrushes/Resource_Font.png new file mode 100644 index 0000000..5a15a65 --- /dev/null +++ b/Content/SlateBrushes/Resource_Font.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6191c8c2e2294e4b2eac4578f02a8141da007c8e982642383e865fba2e8f3549 +size 736 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_256x.uasset b/Content/SlateBrushes/icon_PopcornFX_Logo_256x.uasset index e196102..cf2327c 100644 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_256x.uasset +++ b/Content/SlateBrushes/icon_PopcornFX_Logo_256x.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be77b4ed91b4825312a4f05572f08fe04cdc8f9a332248fb8a857902157b967d -size 59790 +oid sha256:9f0fa89e18f9dc802c6e40fad595ad0bd432c2ba19ff7cae5c35cad15b750034 +size 35497 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_Pkan_64x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_Pkan_64x.png deleted file mode 100644 index 519d9ee..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_Pkan_64x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:166a9c996f7bc633328fbbe79f7afc955564fc60e81d6da716d2e239526b6b59 -size 7143 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_16x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_16x.png deleted file mode 100644 index 0b57c1f..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_16x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0822b17f572e8ba48670f9f35a94fa090fce95e8d861ff3175158daacb040855 -size 3454 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_64x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_64x.png deleted file mode 100644 index 763f822..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_Pkfm_64x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:10714d5fb9707fb23378f1ba6c791b844f2dfbfa9fe982fc5e554d32db7fa2b0 -size 7143 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_16x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_16x.png deleted file mode 100644 index 91c1f24..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_16x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:913e7c1e80d93908eafafd43bdcdd4025207cb3432e80a50427d8eb63cdc5a67 -size 3493 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_64x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_64x.png deleted file mode 100644 index 49023dd..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_Pksc_64x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ae88b71af378a949556272bc53818e231c03e16e16e495e089ca8fb41f487ccb -size 7248 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_pkan_16x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_pkan_16x.png deleted file mode 100644 index 685aabe..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_pkan_16x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a1015d8f10e897e5dd9269fe68195d6c13362917d7e89e6430ca146355821bed -size 3469 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_pkat_16x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_pkat_16x.png deleted file mode 100644 index f473c84..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_pkat_16x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e780bab310a2b0d711aafa0686f79f047938124bfa87769b53252093142e9d30 -size 3420 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_pkat_64x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_pkat_64x.png deleted file mode 100644 index af28f72..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_pkat_64x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c6b93bd4d22aa6e1ddbff0bec085fa3fd76893f57c8151b25f3eef93714cda1e -size 6943 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_16x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_16x.png deleted file mode 100644 index 82c6c96..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_16x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d7943b01d938524ee9f37adb44269e4b0b06dae931af3fcaf32ee6aa496f1b7 -size 3384 diff --git a/Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_64x.png b/Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_64x.png deleted file mode 100644 index b2098b6..0000000 --- a/Content/SlateBrushes/icon_PopcornFX_Logo_pkfx_64x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1e32e1a474d9336b1d542e651a2d2482fd353acaa5a96ba20a8fb2a4b8024421 -size 6814 diff --git a/Download_SDK_Desktop.bat b/Download_SDK_Desktop.bat index 16cc550..ec5a039 100644 --- a/Download_SDK_Desktop.bat +++ b/Download_SDK_Desktop.bat @@ -6,7 +6,7 @@ setlocal bitsadmin /reset bitsadmin /create third_party_download_desktop -bitsadmin /addfile third_party_download_desktop https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.12_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z" +bitsadmin /addfile third_party_download_desktop https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.13_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z" bitsadmin /setpriority third_party_download_desktop "FOREGROUND" bitsadmin /resume third_party_download_desktop diff --git a/Download_SDK_Mobile.bat b/Download_SDK_Mobile.bat index 6e8c124..cf4450f 100644 --- a/Download_SDK_Mobile.bat +++ b/Download_SDK_Mobile.bat @@ -6,7 +6,7 @@ setlocal bitsadmin /reset bitsadmin /create third_party_download_mobile -bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.12_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z" +bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.13_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z" bitsadmin /setpriority third_party_download_mobile "FOREGROUND" bitsadmin /resume third_party_download_mobile diff --git a/PopcornFX.uplugin b/PopcornFX.uplugin index c050c12..662b66d 100644 --- a/PopcornFX.uplugin +++ b/PopcornFX.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 21512, - "VersionName": "2.15.12", + "Version": 21513, + "VersionName": "2.15.13", "FriendlyName": "PopcornFX", "Description": "PopcornFX Realtime Particle Solution integration into Unreal Engine", "Category": "PopcornFX", diff --git a/README.md b/README.md index ec28f00..bc1c494 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Unreal Engine PopcornFX Plugin Integrates the **PopcornFX Runtime SDK** into **Unreal Engine 4** and **Unreal Engine 5** as a Plugin. -* **Version:** `v2.15.12` +* **Version:** `v2.15.13` * **Unreal Engine:** `4.27`, `5.0`, `5.1` and `5.2` * **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android`, `PS4`, `PS5`, `XboxOne`, `Xbox Series`, `Switch` diff --git a/Shaders/Private/PopcornFXBillboarderBillboardComputeShader.usf b/Shaders/Private/PopcornFXBillboarderBillboardComputeShader.usf deleted file mode 100644 index 6632f65..0000000 --- a/Shaders/Private/PopcornFXBillboarderBillboardComputeShader.usf +++ /dev/null @@ -1,571 +0,0 @@ -//---------------------------------------------------------------------------- -// Copyright Persistant Studios, SARL. All Rights Reserved. -// https://www.popcornfx.com/terms-and-conditions/ -//---------------------------------------------------------------------------- - -/*============================================================================= -PopcornFXBillboarderBillboardComputeShader.usf: Billboard renderer compute shader billboarder -=============================================================================*/ - -#include "/Engine/Public/Platform.ush" - -#if COMPILER_HLSL - -#define NORMALIZER_EPSILON 1.0e-8f - -RWByteAddressBuffer OutIndicesRaw; -RWBuffer OutIndices; - -RWByteAddressBuffer OutPositions; -RWByteAddressBuffer OutTexcoords; -RWByteAddressBuffer OutTexcoord2s; -RWByteAddressBuffer OutAtlasIDs; -RWByteAddressBuffer OutNormals; -RWByteAddressBuffer OutTangents; - -ByteAddressBuffer InIndices; -ByteAddressBuffer InSimData; - -uint InPositionsOffset; -uint InSizesOffset; -uint In2SizesOffset; -uint InRotationsOffset; -uint InAxis0sOffset; -uint InAxis1sOffset; -uint InTextureIdsOffset; - -float4 DefaultInPositions; -float4 DefaultInSizes; -float4 DefaultIn2Sizes; -float4 DefaultInRotations; -float4 DefaultInAxis0s; -float4 DefaultInAxis1s; -float4 DefaultInTextureIds; - -uint BillboarderType; -uint OutputMask; -uint InputMask; -uint InIndicesOffset; -uint InputOffset; -uint OutputVertexOffset; -uint OutputIndexOffset; - -float4x4 BillboardingMatrix; - -uint RendererFlags; -float RendererNormalsBendingFactor; - -uint HasLiveParticleCount; -ByteAddressBuffer LiveParticleCount; - -uint RendererAtlasRectCount; -ByteAddressBuffer RendererAtlasBuffer; -//Buffer RendererAtlasBuffer; - -// RightHanded: -//#define myCross(a, b) cross(a, b) -// LeftHanded: -#define myCross(a, b) cross(b, a) - -#define swapf(x, y) x = asfloat(asuint(x) ^ asuint(y)); y = asfloat(asuint(y) ^ asuint(x)); x = asfloat(asuint(x) ^ asuint(y)); -#define swapi(x, y) x = x ^ y; y = y ^ x; x = x ^ y; - -#define FLOAT2_TO_USHORTUNORM2(__x, __y) (asuint(clamp((int)(__x * 65535.0), 0, 0xFFFF)) | (asuint(clamp((int)(__y * 65535.0), 0, 0xFFFF)) << 16)) -uint Float2ToUshortUnorm2(float2 tc) { return FLOAT2_TO_USHORTUNORM2(tc.x, tc.y); } - -[numthreads(PK_GPU_THREADGROUP_SIZE, 1, 1)] -void Billboard(uint3 DTid : SV_DispatchThreadID) -{ - const uint globali = DTid.x; - const uint inputi = InputOffset + globali; - - if (HasLiveParticleCount != 0) - { - const uint particleCount = asint(LiveParticleCount.Load(0)); - if (inputi < particleCount) - { - const float3 center = asfloat(InSimData.Load3(InPositionsOffset + inputi * 12)); - - float2 radius; - if (InputMask & MASK_InSizes) - radius = (float2)asfloat(InSimData.Load(InSizesOffset + inputi * 4)); - else if (InputMask & MASK_In2Sizes) - radius = asfloat(InSimData.Load2(In2SizesOffset + inputi * 8)); - else - radius = (float2)DefaultInSizes.x; - - float3 xAxis; - float3 yAxis; - float3 capsuleUpVec = float3(0, 0, 1); - - switch (BillboarderType) - { - case BILLBOARD_ScreenAligned: - { - xAxis = BillboardingMatrix[0].xyz * radius.x; - yAxis = BillboardingMatrix[1].xyz * radius.y; - } - break; - case BILLBOARD_ViewposAligned: - { - const float3 viewPos = BillboardingMatrix[3].xyz; - const float3 camToParticle = normalize(center - viewPos); - // Z Up: - const float3 upAxis = float3(0, camToParticle.z * 0.01f, 1); - // Y Up: - //float4 upAxis = float3(0, 1, camToParticle.y * 0.01); - xAxis = normalize(myCross(camToParticle, upAxis)); - yAxis = myCross(xAxis, camToParticle) * radius.y; - xAxis *= radius.x; - } - break; - case BILLBOARD_AxisAligned: - { - const float3 viewPos = BillboardingMatrix[3].xyz; - const float3 camToParticle = center - viewPos; - const float3 axis = asfloat(InSimData.Load3(InAxis0sOffset + inputi * 12)); - - xAxis = myCross(camToParticle, axis); - if (dot(xAxis, xAxis) > NORMALIZER_EPSILON) - xAxis = normalize(xAxis); - else - { - const float3 v = float3(-camToParticle.y, camToParticle.x + 0.01f, 0.0f); - xAxis = normalize(myCross(camToParticle, v)); - } - xAxis *= radius.x; - - yAxis = axis * 0.5f; - } - break; - case BILLBOARD_AxisAlignedCapsule: - { - const float3 viewPos = BillboardingMatrix[3].xyz; - const float3 camToParticle = normalize(center - viewPos); - const float3 axis = asfloat(InSimData.Load3(InAxis0sOffset + inputi * 12)); - - float3 sideVec = myCross(camToParticle, axis); - if (dot(sideVec, sideVec) > NORMALIZER_EPSILON) - sideVec = normalize(sideVec); - else - { - const float3 v = float3(-camToParticle.y, camToParticle.x + 0.01f, 0.0f); - sideVec = normalize(myCross(camToParticle, v)); - } - sideVec *= radius.x; - - const float3 upVec = myCross(sideVec, camToParticle); - xAxis = sideVec; - yAxis = axis * 0.5f; - capsuleUpVec = upVec; - } - break; - case BILLBOARD_AxisAlignedSpheroid: - { - const float3 viewPos = BillboardingMatrix[3].xyz; - const float3 camToParticle = normalize(center - viewPos); - const float3 axis = asfloat(InSimData.Load3(InAxis0sOffset + inputi * 12)); - - float3 sideVec = myCross(camToParticle, axis); - if (dot(sideVec, sideVec) > NORMALIZER_EPSILON) - sideVec = normalize(sideVec); - else - { - const float3 v = float3(-camToParticle.y, camToParticle.x + 0.01f, 0.0f); - sideVec = normalize(myCross(camToParticle, v)); - } - sideVec *= radius.x; - - const float3 upVec = myCross(sideVec, camToParticle); - xAxis = sideVec; - yAxis = axis * 0.5f + upVec; - } - break; - case BILLBOARD_PlaneAligned: - { - const float3 axis_fwd = asfloat(InSimData.Load3(InAxis0sOffset + inputi * 12)); - const float3 axis_nrm = asfloat(InSimData.Load3(InAxis1sOffset + inputi * 12)); - - xAxis = myCross(axis_fwd, axis_nrm); - if (dot(xAxis, xAxis) > NORMALIZER_EPSILON) - xAxis = normalize(xAxis); - else - { - const float3 v = float3(-axis_nrm.y, axis_nrm.x + 0.01f, 0.0f); - xAxis = normalize(myCross(v, axis_nrm)); - } - - yAxis = myCross(axis_nrm, xAxis); - const float2 scale = radius * 0.5f; - xAxis *= scale.x; - yAxis *= scale.y; - } - break; - } - - if (InputMask & MASK_InRotations) - { - const float a = asfloat(InSimData.Load(InRotationsOffset + inputi * 4)); - const float c = cos(a); - const float s = sin(a); - const float3 xa = xAxis; - xAxis = yAxis * s + xAxis * c; - yAxis = yAxis * c - xa * s; - } - - const float3 xpy = xAxis + yAxis; - const float3 xmy = xAxis - yAxis; - const float3 v0 = center - xpy; - const float3 v1 = center + xmy; - const float3 v2 = center + xpy; - const float3 v3 = center - xmy; - - const uint vpp = ((BillboarderType == BILLBOARD_AxisAlignedCapsule) ? 6 : 4); - const bool is6vert = (vpp == 6); - const uint vstart = globali * vpp + OutputVertexOffset; - - - // NOTE: Performance might benefit quite a bit from outputting packed float3 vertices - if (OutputMask & MASK_OutPositions) - { - -#if PK_BILLBOARDER_CS_OUTPUT_PACK_PTN - const uint addr = vstart * 12; - OutPositions.Store3(addr + 0 * 12, asint(v0)); - OutPositions.Store3(addr + 1 * 12, asint(v1)); - OutPositions.Store3(addr + 2 * 12, asint(v2)); - OutPositions.Store3(addr + 3 * 12, asint(v3)); - if (is6vert) - { - const float3 v4 = center + yAxis + capsuleUpVec; - const float3 v5 = center - yAxis - capsuleUpVec; - OutPositions.Store3(addr + 4 * 12, asint(v4)); - OutPositions.Store3(addr + 5 * 12, asint(v5)); - } -#else - const uint addr = vstart * 16; - OutPositions.Store4(addr + 0 * 16, asint(float4(v0, 0))); - OutPositions.Store4(addr + 1 * 16, asint(float4(v1, 0))); - OutPositions.Store4(addr + 2 * 16, asint(float4(v2, 0))); - OutPositions.Store4(addr + 3 * 16, asint(float4(v3, 0))); - if (is6vert) - { - const float3 v4 = center + yAxis + capsuleUpVec; - const float3 v5 = center - yAxis - capsuleUpVec; - OutPositions.Store4(addr + 4 * 16, asint(float4(v4, 0))); - OutPositions.Store4(addr + 5 * 16, asint(float4(v5, 0))); - } -#endif - - } - - // @TODO early out - //if ((OutputMask & ( - // - //)) == 0) - // return - - if (OutputMask & MASK_OutNormals) - { - float3 normal0; - float3 normal1; - float3 normal2; - float3 normal3; - - float3 xAxisNorm; - float3 yAxisNorm; - if (RendererNormalsBendingFactor > 0) - { - xAxisNorm = normalize(xAxis); - yAxisNorm = normalize(yAxis); - - const float3 baseNormal = myCross(xAxisNorm, yAxisNorm); // already ortho - const float3 nw = baseNormal * (1.0f - RendererNormalsBendingFactor); - - const float3 xpy = (xAxisNorm + yAxisNorm) * RendererNormalsBendingFactor; - const float3 xmy = (xAxisNorm - yAxisNorm) * RendererNormalsBendingFactor; - normal0 = nw - xpy; - const float3 rlen = 1.0f / length(normal0); - normal0 *= rlen; - normal1 = (nw + xmy) * rlen; - normal2 = (nw + xpy) * rlen; - normal3 = (nw - xmy) * rlen; - } - else - { - const float3 baseNormal = normalize(myCross(xAxis, yAxis)); - normal0 = baseNormal; - normal1 = baseNormal; - normal2 = baseNormal; - normal3 = baseNormal; - } - -#if PK_BILLBOARDER_CS_OUTPUT_PACK_PTN - // normals - { - const uint addr = vstart * 12; - OutNormals.Store3(addr + 0 * 12, asint(normal0)); - OutNormals.Store3(addr + 1 * 12, asint(normal1)); - OutNormals.Store3(addr + 2 * 12, asint(normal2)); - OutNormals.Store3(addr + 3 * 12, asint(normal3)); - if (is6vert) - { - const float3 normal4 = normal2; // @TODO fixme ? - const float3 normal5 = normal0; - OutNormals.Store3(addr + 4 * 12, asint(normal4)); - OutNormals.Store3(addr + 5 * 12, asint(normal5)); - } - } - // no tangent without normals anyway - if (OutputMask & MASK_OutTangents) - { - const uint addr = vstart * 12; - //const float3 tangent = RendererNormalsBendingFactor > 0 ? xAxisNorm : normalize(xAxis); - const float3 tangent = normalize(xAxis); - - OutTangents.Store3(addr + 0 * 12, asint(tangent)); - OutTangents.Store3(addr + 1 * 12, asint(tangent)); - OutTangents.Store3(addr + 2 * 12, asint(tangent)); - OutTangents.Store3(addr + 3 * 12, asint(tangent)); - if (is6vert) - { - OutTangents.Store3(addr + 4 * 12, asint(tangent)); - OutTangents.Store3(addr + 5 * 12, asint(tangent)); - } - } -#else - // normals - { - const uint addr = vstart * 16; - OutNormals.Store4(addr + 0 * 16, asint(float4(normal0, 0))); - OutNormals.Store4(addr + 1 * 16, asint(float4(normal1, 0))); - OutNormals.Store4(addr + 2 * 16, asint(float4(normal2, 0))); - OutNormals.Store4(addr + 3 * 16, asint(float4(normal3, 0))); - if (is6vert) - { - const float3 normal4 = normal2; // @TODO fixme ? - const float3 normal5 = normal0; - OutNormals.Store4(addr + 4 * 16, asint(float4(normal4, 0))); - OutNormals.Store4(addr + 5 * 16, asint(float4(normal5, 0))); - } - } - // no tangent without normals anyway - if (OutputMask & MASK_OutTangents) - { - const uint addr = vstart * 16; - //const float3 tangent = RendererNormalsBendingFactor > 0 ? xAxisNorm : normalize(xAxis); - const float3 tangent = normalize(xAxis); - - OutTangents.Store4(addr + 0 * 16, asint(float4(tangent, 0))); - OutTangents.Store4(addr + 1 * 16, asint(float4(tangent, 0))); - OutTangents.Store4(addr + 2 * 16, asint(float4(tangent, 0))); - OutTangents.Store4(addr + 3 * 16, asint(float4(tangent, 0))); - if (is6vert) - { - OutTangents.Store4(addr + 4 * 16, asint(float4(tangent, 0))); - OutTangents.Store4(addr + 5 * 16, asint(float4(tangent, 0))); - } - } -#endif - } - - if (OutputMask & MASK_OutTexcoords) - { -#if PK_BILLBOARDER_CS_OUTPUT_PACK_TEXCOORD -# define tc_t uint -# define tc_Store Store -# define tc_Stride 4 -# define tc_swap(a, b) swapi(a, b) -# define TC_PACK(a, b) FLOAT2_TO_USHORTUNORM2(a, b) -# define tc_pack(a) Float2ToUshortUnorm2(a) -#else -# define tc_t float2 -# define tc_Store Store2 -# define tc_Stride 8 -# define tc_swap(a, b) swapf(a, b) -# define TC_PACK(a, b) float2(a, b) -# define tc_pack(a) a -#endif - tc_t uv00; - tc_t uv01; - tc_t uv11; - tc_t uv10; - tc_t uv00_2; - tc_t uv01_2; - tc_t uv11_2; - tc_t uv10_2; - float softAnimBlend = 0; - - if (InputMask & MASK_InTextureIds) - { - const float atlasIdf = asfloat(InSimData.Load(InTextureIdsOffset + inputi * 4)); - const uint atlasId0 = min((uint)abs(atlasIdf), RendererAtlasRectCount - 1); - - const float4 rect0 = asfloat(RendererAtlasBuffer.Load4(atlasId0 * 4 * 4)); - //const float4 rect0 = asfloat(RendererAtlasBuffer[atlasId0 * 4]); - - uv00 = tc_pack(float2(0, 0) * rect0.xy + rect0.zw); - uv01 = tc_pack(float2(0, 1) * rect0.xy + rect0.zw); - uv10 = tc_pack(float2(1, 0) * rect0.xy + rect0.zw); - uv11 = tc_pack(float2(1, 1) * rect0.xy + rect0.zw); - - if (RendererFlags & RENDERERFLAG_SoftAnimationBlending) // should be true too: (OutputMask & MASK_OutTexcoord2s) - { - const uint atlasId1 = min(atlasId0 + 1, RendererAtlasRectCount - 1); - const float4 rect1 = asfloat(RendererAtlasBuffer.Load4(atlasId1 * 4 * 4)); - //const float4 rect1 = asfloat(RendererAtlasBuffer[atlasId1 * 4]); - - uv00_2 = tc_pack(float2(0, 0) * rect1.xy + rect1.zw); - uv01_2 = tc_pack(float2(0, 1) * rect1.xy + rect1.zw); - uv10_2 = tc_pack(float2(1, 0) * rect1.xy + rect1.zw); - uv11_2 = tc_pack(float2(1, 1) * rect1.xy + rect1.zw); - - // MASK_OutAtlasIDs should be active too - softAnimBlend = frac(atlasIdf); - } - } - else - { - uv00 = TC_PACK(0, 0); - uv01 = TC_PACK(0, 1); - uv11 = TC_PACK(1, 1); - uv10 = TC_PACK(1, 0); - uv00_2 = TC_PACK(0, 0); - uv01_2 = TC_PACK(0, 1); - uv11_2 = TC_PACK(1, 1); - uv10_2 = TC_PACK(1, 0); - } - - if (RendererFlags & RENDERERFLAG_FlipV) - { - tc_swap(uv01, uv00); - tc_swap(uv11, uv10); - tc_swap(uv01_2, uv00_2); - tc_swap(uv11_2, uv10_2); - } - - // Texcoord - { - const uint addr = vstart * tc_Stride; - if (!is6vert) - { - OutTexcoords.tc_Store(addr + 0 * tc_Stride, asint(uv01)); - OutTexcoords.tc_Store(addr + 1 * tc_Stride, asint(uv11)); - OutTexcoords.tc_Store(addr + 2 * tc_Stride, asint(uv10)); - OutTexcoords.tc_Store(addr + 3 * tc_Stride, asint(uv00)); - } - else - { - OutTexcoords.tc_Store(addr + 0 * tc_Stride, asint(uv00)); - OutTexcoords.tc_Store(addr + 1 * tc_Stride, asint(uv11)); - OutTexcoords.tc_Store(addr + 2 * tc_Stride, asint(uv11)); - OutTexcoords.tc_Store(addr + 3 * tc_Stride, asint(uv00)); - OutTexcoords.tc_Store(addr + 4 * tc_Stride, asint(uv01)); - OutTexcoords.tc_Store(addr + 5 * tc_Stride, asint(uv10)); - } - } - - if (OutputMask & MASK_OutTexcoord2s) - { - const uint addr = vstart * tc_Stride; - if (!is6vert) - { - OutTexcoord2s.tc_Store(addr + 0 * tc_Stride, asint(uv01_2)); - OutTexcoord2s.tc_Store(addr + 1 * tc_Stride, asint(uv11_2)); - OutTexcoord2s.tc_Store(addr + 2 * tc_Stride, asint(uv10_2)); - OutTexcoord2s.tc_Store(addr + 3 * tc_Stride, asint(uv00_2)); - } - else - { - const uint addr = vstart * tc_Stride; - OutTexcoord2s.tc_Store(addr + 0 * tc_Stride, asint(uv00_2)); - OutTexcoord2s.tc_Store(addr + 1 * tc_Stride, asint(uv11_2)); - OutTexcoord2s.tc_Store(addr + 2 * tc_Stride, asint(uv11_2)); - OutTexcoord2s.tc_Store(addr + 3 * tc_Stride, asint(uv00_2)); - OutTexcoord2s.tc_Store(addr + 4 * tc_Stride, asint(uv01_2)); - OutTexcoord2s.tc_Store(addr + 5 * tc_Stride, asint(uv10_2)); - } - } - - if (OutputMask & MASK_OutAtlasIDs) - { - //// 0-4 - //OutAtlasIDs.Store4(vstart * 4 + 0 * 4, asint((float4)softAnimBlend)); - //if (!is6vert) - //{ - // // 4-6 - // OutAtlasIDs.Store2(vstart * 4 + 4 * 4, asint((float2)softAnimBlend)); - //} - //else - //{ - // // 4-8 - // OutAtlasIDs.Store4(vstart * 4 + 4 * 4, asint((float4)softAnimBlend)); - // // 8-12 - // OutAtlasIDs.Store4(vstart * 4 + 8 * 4, asint((float4)softAnimBlend)); - //} - - const uint dynStride = 4; - OutAtlasIDs.Store(vstart * dynStride + 0 * dynStride, asint(softAnimBlend)); - OutAtlasIDs.Store(vstart * dynStride + 1 * dynStride, asint(softAnimBlend)); - OutAtlasIDs.Store(vstart * dynStride + 2 * dynStride, asint(softAnimBlend)); - OutAtlasIDs.Store(vstart * dynStride + 3 * dynStride, asint(softAnimBlend)); - if (is6vert) - { - OutAtlasIDs.Store(vstart * dynStride + 4 * dynStride, asint(softAnimBlend)); - OutAtlasIDs.Store(vstart * dynStride + 5 * dynStride, asint(softAnimBlend)); - } - } - } - - const uint istart = OutputIndexOffset + globali * (is6vert ? 12 : 6); - uint vertexi; - if (InputMask & MASK_InIndices) - vertexi = InIndices.Load((InIndicesOffset + globali) * 4); - else - vertexi = vstart; - - if (OutputMask & MASK_OutIndicesRaw) - { - OutIndicesRaw.Store(istart * 4 + 0 * 4, vertexi + 0); - OutIndicesRaw.Store(istart * 4 + 1 * 4, vertexi + 1); - OutIndicesRaw.Store(istart * 4 + 2 * 4, vertexi + 3); - OutIndicesRaw.Store(istart * 4 + 3 * 4, vertexi + 1); - OutIndicesRaw.Store(istart * 4 + 4 * 4, vertexi + 2); - OutIndicesRaw.Store(istart * 4 + 5 * 4, vertexi + 3); - if (is6vert) - { - OutIndicesRaw.Store(istart * 4 + 6 * 4, vertexi + 4); - OutIndicesRaw.Store(istart * 4 + 7 * 4, vertexi + 3); - OutIndicesRaw.Store(istart * 4 + 8 * 4, vertexi + 2); - OutIndicesRaw.Store(istart * 4 + 9 * 4, vertexi + 1); - OutIndicesRaw.Store(istart * 4 + 10 * 4, vertexi + 0); - OutIndicesRaw.Store(istart * 4 + 11 * 4, vertexi + 5); - } - } - if (OutputMask & MASK_OutIndices) - { - OutIndices[istart + 0] = vertexi + 0; - OutIndices[istart + 1] = vertexi + 1; - OutIndices[istart + 2] = vertexi + 3; - OutIndices[istart + 3] = vertexi + 1; - OutIndices[istart + 4] = vertexi + 2; - OutIndices[istart + 5] = vertexi + 3; - if (is6vert) - { - OutIndices[istart + 6 ] = vertexi + 4; - OutIndices[istart + 7 ] = vertexi + 3; - OutIndices[istart + 8 ] = vertexi + 2; - OutIndices[istart + 9 ] = vertexi + 1; - OutIndices[istart + 10 ] = vertexi + 0; - OutIndices[istart + 11 ] = vertexi + 5; - } - } - } - else - { - // Store nothing - } - } -} - -#endif // COMPILER_HLSL \ No newline at end of file diff --git a/Shaders/Private/PopcornFXBillboarderMeshComputeShader.usf b/Shaders/Private/PopcornFXBillboarderMeshComputeShader.usf index b5e7f49..5f3f599 100644 --- a/Shaders/Private/PopcornFXBillboarderMeshComputeShader.usf +++ b/Shaders/Private/PopcornFXBillboarderMeshComputeShader.usf @@ -12,42 +12,16 @@ PopcornFXBillboarderBillboardComputeShader.usf: Billboard renderer compute shade #if COMPILER_HLSL RWByteAddressBuffer OutMatrices; -RWByteAddressBuffer OutColors; -RWByteAddressBuffer OutVATCursors; -RWByteAddressBuffer OutDynamicParameter0s; -RWByteAddressBuffer OutDynamicParameter1s; -RWByteAddressBuffer OutDynamicParameter2s; -//RWByteAddressBuffer OutDynamicParameter3s; - ByteAddressBuffer InSimData; uint InPositionsOffset; uint InOrientationsOffset; uint InScalesOffset; -uint InColorsOffset; -uint InVATCursorsOffset; -uint InDynamicParameter0sOffset; -uint InDynamicParameter1sOffset; -uint InDynamicParameter2sOffset; -//uint InDynamicParameter3sOffset; - -float4 DefaultInPositions; -float4 DefaultInOrientations; -float4 DefaultInScales; -float4 DefaultInColors; -float4 DefaultInVATCursors; -float4 DefaultInDynamicParameter0s; -float4 DefaultInDynamicParameter1s; -float4 DefaultInDynamicParameter2s; -//float4 DefaultInDynamicParameter3s; - -float PositionsScale; -uint OutputMask; -uint InputMask; +float PositionsScale; -uint InputOffset; -uint OutputVertexOffset; +uint InputOffset; +uint OutputVertexOffset; uint HasLiveParticleCount; ByteAddressBuffer LiveParticleCount; @@ -69,131 +43,42 @@ void Billboard(uint3 DTid : SV_DispatchThreadID) } } - if (OutputMask & MASK_OutMatrices) - { - const float3 center = asfloat(InSimData.Load3(InPositionsOffset + inputi * 12)); + const float3 center = asfloat(InSimData.Load3(InPositionsOffset + inputi * 12)); - float3 r0 = float3(1, 0, 0); - float3 r1 = float3(0, 1, 0); - float3 r2 = float3(0, 0, 1); - - float4 q; - if (InputMask & MASK_InOrientations) - { - q = asfloat(InSimData.Load4(InOrientationsOffset + inputi * 16)); - - // Construct from quaternion - r0 = float3(1 - 2 * (q.y * q.y + q.z * q.z), - 2 * (q.y * q.x + q.z * q.w), - 2 * (q.z * q.x - q.y * q.w)); - - r1 = float3( 2 * (q.x * q.y - q.z * q.w), - 1 - 2 * (q.z * q.z + q.x * q.x), - 2 * (q.z * q.y + q.x * q.w)); - - r2 = float3( 2 * (q.x * q.z + q.y * q.w), - 2 * (q.y * q.z - q.x * q.w), - 1 - 2 * (q.y * q.y + q.x * q.x)); - } - //else - // q = DefaultInOrientations; - - float3 scale; - if (InputMask & MASK_InScales) - scale = asfloat(InSimData.Load(InScalesOffset + inputi * 4)); - else - scale = DefaultInScales.x; + float3 r0 = float3(1, 0, 0); + float3 r1 = float3(0, 1, 0); + float3 r2 = float3(0, 0, 1); - float4 m0 = float4(r0 * scale, 0) * uniformScale; - float4 m1 = float4(r1 * scale, 0) * uniformScale; - float4 m2 = float4(r2 * scale, 0) * uniformScale; - float4 m3 = float4(center * PositionsScale, 1) * uniformScale; + float4 q; + { + q = asfloat(InSimData.Load4(InOrientationsOffset + inputi * 16)); - const uint addr = vstart * 64; - OutMatrices.Store4(addr + 0 * 16, asint(m0)); - OutMatrices.Store4(addr + 1 * 16, asint(m1)); - OutMatrices.Store4(addr + 2 * 16, asint(m2)); - OutMatrices.Store4(addr + 3 * 16, asint(m3)); + // Construct from quaternion + r0 = float3(1 - 2 * (q.y * q.y + q.z * q.z), + 2 * (q.y * q.x + q.z * q.w), + 2 * (q.z * q.x - q.y * q.w)); + + r1 = float3( 2 * (q.x * q.y - q.z * q.w), + 1 - 2 * (q.z * q.z + q.x * q.x), + 2 * (q.z * q.y + q.x * q.w)); + + r2 = float3( 2 * (q.x * q.z + q.y * q.w), + 2 * (q.y * q.z - q.x * q.w), + 1 - 2 * (q.y * q.y + q.x * q.x)); } - if (OutputMask & MASK_OutColors) - { - float4 color; - if (InputMask & MASK_InColors) - color = asfloat(InSimData.Load4(InColorsOffset + globali * 16)); - else - color = DefaultInColors; - color *= uniformScale; - -#if PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16 - const uint addr = vstart * 8; - uint4 colori4 = f32tof16(color); - uint2 colorPacked = uint2( - colori4.x | (colori4.y << 16), - colori4.z | (colori4.w << 16) - ); - OutColors.Store2(addr + 0 * 8, asint(colorPacked)); -#else - const uint addr = vstart * 16; - OutColors.Store4(addr + 0 * 16, asint(color)); -#endif - } + float3 scale = asfloat(InSimData.Load(InScalesOffset + inputi * 4)); - if (OutputMask & MASK_OutVATCursors) - { - float param; - if (InputMask & MASK_InVATCursors) - param = asfloat(InSimData.Load(InVATCursorsOffset + globali * 4)); - else - param = DefaultInVATCursors; - - const uint addr = vstart * 4; - OutVATCursors.Store4(addr + 0 * 4, asint(param)); - } - if (OutputMask & MASK_OutDynamicParameter0s) - { - float4 param; - if (InputMask & MASK_InDynamicParameter0s) - param = asfloat(InSimData.Load4(InDynamicParameter0sOffset + globali * 16)); - else - param = DefaultInDynamicParameter0s; - - const uint addr = vstart * 16; - OutDynamicParameter0s.Store4(addr + 0 * 16, asint(param)); - } - if (OutputMask & MASK_OutDynamicParameter1s) - { - float4 param; - if (InputMask & MASK_InDynamicParameter1s) - param = asfloat(InSimData.Load4(InDynamicParameter1sOffset + globali * 16)); - else - param = DefaultInDynamicParameter1s; - - const uint addr = vstart * 16; - OutDynamicParameter1s.Store4(addr + 0 * 16, asint(param)); - } - if (OutputMask & MASK_OutDynamicParameter2s) - { - float4 param; - if (InputMask & MASK_InDynamicParameter2s) - param = asfloat(InSimData.Load4(InDynamicParameter2sOffset + globali * 16)); - else - param = DefaultInDynamicParameter2s; - - const uint addr = vstart * 16; - OutDynamicParameter2s.Store4(addr + 0 * 16, asint(param)); - } - //if (OutputMask & MASK_OutDynamicParameter3s) - //{ - // float4 param; - // if (InputMask & MASK_InDynamicParameter3s) - // param = asfloat(InSimData.Load4(InDynamicParameter3sOffset + globali * 16)); - // else - // param = DefaultInDynamicParameter3s; - // - // const uint addr = vstart * 16; - // OutDynamicParameter3s.Store4(addr + 0 * 16, asint(param)); - //} + float4 m0 = float4(r0 * scale, 0) * uniformScale; + float4 m1 = float4(r1 * scale, 0) * uniformScale; + float4 m2 = float4(r2 * scale, 0) * uniformScale; + float4 m3 = float4(center * PositionsScale, 1) * uniformScale; + + const uint addr = vstart * 64; + OutMatrices.Store4(addr + 0 * 16, asint(m0)); + OutMatrices.Store4(addr + 1 * 16, asint(m1)); + OutMatrices.Store4(addr + 2 * 16, asint(m2)); + OutMatrices.Store4(addr + 3 * 16, asint(m3)); } #endif // COMPILER_HLSL diff --git a/Shaders/Private/PopcornFXCopyStreamComputeShader.usf b/Shaders/Private/PopcornFXCopyStreamComputeShader.usf deleted file mode 100644 index dcb7152..0000000 --- a/Shaders/Private/PopcornFXCopyStreamComputeShader.usf +++ /dev/null @@ -1,176 +0,0 @@ -//---------------------------------------------------------------------------- -// Copyright Persistant Studios, SARL. All Rights Reserved. -// https://www.popcornfx.com/terms-and-conditions/ -//---------------------------------------------------------------------------- - -#include "/Engine/Public/Platform.ush" - -/*============================================================================= -PopcornFXCopyStreamComputeShader.usf: Copies various streams (assumes billboard renderer, 4 or 6 vertices per particle) -=============================================================================*/ - -#if COMPILER_HLSL - -RWByteAddressBuffer OutColors; -RWByteAddressBuffer OutAlphaCursors; -RWByteAddressBuffer OutDynamicParameter1s; -RWByteAddressBuffer OutDynamicParameter2s; -RWByteAddressBuffer OutDynamicParameter3s; - -ByteAddressBuffer InSimData; - -uint InColorsOffset; -uint InAlphaCursorsOffset; -uint InDynamicParameter1sOffset; -uint InDynamicParameter2sOffset; -uint InDynamicParameter3sOffset; - -float4 DefaultInColors; -float4 DefaultInAlphaCursors; -float4 DefaultInDynamicParameter1s; -float4 DefaultInDynamicParameter2s; -float4 DefaultInDynamicParameter3s; - -uint InputMask; -uint OutputMask; -uint InputOffset; -uint OutputVertexOffset; -int IsCapsule; - -uint HasLiveParticleCount; -ByteAddressBuffer LiveParticleCount; - -[numthreads(PK_GPU_THREADGROUP_SIZE, 1, 1)] -void Copy(uint3 DTid : SV_DispatchThreadID) -{ - const uint globali = DTid.x; - const uint inputi = InputOffset + globali; - - if (HasLiveParticleCount != 0) - { - const uint particleCount = asint(LiveParticleCount.Load(0)); - if (inputi < particleCount) - { - const uint vpp = (IsCapsule ? 6 : 4); - const uint vstart = globali * vpp + OutputVertexOffset; - - if (OutputMask & MASK_OutAlphaCursors) - { - float cursor; - if (InputMask & MASK_InAlphaCursors) - cursor = asfloat(InSimData.Load(InAlphaCursorsOffset + inputi * 4)); - else - cursor = DefaultInAlphaCursors.x; - - const uint addr = vstart * 4; - OutAlphaCursors.Store(addr + 0 * 4, asint(cursor)); - OutAlphaCursors.Store(addr + 1 * 4, asint(cursor)); - OutAlphaCursors.Store(addr + 2 * 4, asint(cursor)); - OutAlphaCursors.Store(addr + 3 * 4, asint(cursor)); - if (IsCapsule) - { - OutAlphaCursors.Store(addr + 4 * 4, asint(cursor)); - OutAlphaCursors.Store(addr + 4 * 4, asint(cursor)); - } - } - - if (OutputMask & MASK_OutColors) - { - float4 color; - if (InputMask & MASK_InColors) - color = asfloat(InSimData.Load4(InColorsOffset + globali * 16)); - else - color = DefaultInColors; - -#if PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16 - const uint addr = vstart * 8; - uint4 colori4 = f32tof16(color); - uint2 colorPacked = uint2( - colori4.x | (colori4.y << 16), - colori4.z | (colori4.w << 16) - ); - OutColors.Store2(addr + 0 * 8, asint(colorPacked)); - OutColors.Store2(addr + 1 * 8, asint(colorPacked)); - OutColors.Store2(addr + 2 * 8, asint(colorPacked)); - OutColors.Store2(addr + 3 * 8, asint(colorPacked)); - if (IsCapsule) - { - OutColors.Store2(addr + 4 * 8, asint(colorPacked)); - OutColors.Store2(addr + 5 * 8, asint(colorPacked)); - } -#else - const uint addr = vstart * 16; - OutColors.Store4(addr + 0 * 16, asint(color)); - OutColors.Store4(addr + 1 * 16, asint(color)); - OutColors.Store4(addr + 2 * 16, asint(color)); - OutColors.Store4(addr + 3 * 16, asint(color)); - if (IsCapsule) - { - OutColors.Store4(addr + 4 * 16, asint(color)); - OutColors.Store4(addr + 5 * 16, asint(color)); - } -#endif - } - - if (OutputMask & MASK_OutDynamicParameter1s) - { - float4 param; - if (InputMask & MASK_InDynamicParameter1s) - param = asfloat(InSimData.Load4(InDynamicParameter1sOffset + globali * 16)); - else - param = DefaultInDynamicParameter1s; - - const uint addr = vstart * 16; - OutDynamicParameter1s.Store4(addr + 0 * 16, asint(param)); - OutDynamicParameter1s.Store4(addr + 1 * 16, asint(param)); - OutDynamicParameter1s.Store4(addr + 2 * 16, asint(param)); - OutDynamicParameter1s.Store4(addr + 3 * 16, asint(param)); - if (IsCapsule) - { - OutDynamicParameter1s.Store4(addr + 4 * 16, asint(param)); - OutDynamicParameter1s.Store4(addr + 5 * 16, asint(param)); - } - } - if (OutputMask & MASK_OutDynamicParameter2s) - { - float4 param; - if (InputMask & MASK_InDynamicParameter2s) - param = asfloat(InSimData.Load4(InDynamicParameter2sOffset + globali * 16)); - else - param = DefaultInDynamicParameter2s; - - const uint addr = vstart * 16; - OutDynamicParameter2s.Store4(addr + 0 * 16, asint(param)); - OutDynamicParameter2s.Store4(addr + 1 * 16, asint(param)); - OutDynamicParameter2s.Store4(addr + 2 * 16, asint(param)); - OutDynamicParameter2s.Store4(addr + 3 * 16, asint(param)); - if (IsCapsule) - { - OutDynamicParameter2s.Store4(addr + 4 * 16, asint(param)); - OutDynamicParameter2s.Store4(addr + 5 * 16, asint(param)); - } - } - if (OutputMask & MASK_OutDynamicParameter3s) - { - float4 param; - if (InputMask & MASK_InDynamicParameter3s) - param = asfloat(InSimData.Load4(InDynamicParameter3sOffset + globali * 16)); - else - param = DefaultInDynamicParameter3s; - - const uint addr = vstart * 16; - OutDynamicParameter3s.Store4(addr + 0 * 16, asint(param)); - OutDynamicParameter3s.Store4(addr + 1 * 16, asint(param)); - OutDynamicParameter3s.Store4(addr + 2 * 16, asint(param)); - OutDynamicParameter3s.Store4(addr + 3 * 16, asint(param)); - if (IsCapsule) - { - OutDynamicParameter3s.Store4(addr + 4 * 16, asint(param)); - OutDynamicParameter3s.Store4(addr + 5 * 16, asint(param)); - } - } - } - } -} - -#endif // COMPILER_HLSL \ No newline at end of file diff --git a/Shaders/Private/PopcornFXGPUBillboard.ush b/Shaders/Private/PopcornFXGPUBillboard.ush index 1a3f8e0..6cd7c6c 100644 --- a/Shaders/Private/PopcornFXGPUBillboard.ush +++ b/Shaders/Private/PopcornFXGPUBillboard.ush @@ -14,6 +14,7 @@ PopcornFXGPUBillboard.ush: GPU billboarder code #define USE_PARTICLE_TIME (NEEDS_PARTICLE_TIME) #define USE_PARTICLE_SIZE (NEEDS_PARTICLE_SIZE) #define USE_PARTICLE_RANDOM (NEEDS_PARTICLE_RANDOM) +#define USE_PARTICLE_SPRITE_ROTATION (NEEDS_PARTICLE_SPRITE_ROTATION) #if (COMPUTESHADER || RAYHITGROUPSHADER) && !MATERIAL_TWOSIDED # define FLIP_BILLBOARDING_AXIS 0 @@ -44,6 +45,11 @@ struct FVertexFactoryIntermediates #if USE_PARTICLE_SIZE float2 ParticleSize; // UE units #endif + +#if USE_PARTICLE_SPRITE_ROTATION + float ParticleRotation; // rads +#endif + float4 ParticleColor; float3 ParticleEmissiveColor; @@ -112,9 +118,8 @@ float3 PopcornFXSideAxisFromNrmUp(float3 nrm, float3 upAxis) //---------------------------------------------------------------------------- -void RotateTangents(uint particleID, inout float3 xAxis, inout float3 yAxis) +void RotateTangents(uint particleID, float rotation, inout float3 xAxis, inout float3 yAxis) { - const float rotation = PKSimData_Loadf(particleID, PopcornFXGPUBillboardVSUniforms.InRotationsOffset); float rotCos; float rotSin; @@ -162,6 +167,8 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory else radius = PKSimData_Load2f(particleID, PopcornFXGPUBillboardVSUniforms.InSize2sOffset); + float rotation = 0.0f; + float3 xAxis = float3(0.0f, 0.0f, 0.0f); float3 yAxis = float3(0.0f, 0.0f, 0.0f); float3 planeNormal = float3(0.0f, 0.0f, 0.0f); @@ -183,11 +190,13 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory { case BILLBOARD_ScreenAligned: { + rotation = PKSimData_Loadf(particleID, PopcornFXGPUBillboardVSUniforms.InRotationsOffset); // rad + xAxis = ResolvedView.ViewRight; yAxis = ResolvedView.ViewUp; planeNormal = -ResolvedView.ViewForward; - RotateTangents(particleID, xAxis, yAxis); + RotateTangents(particleID, rotation, xAxis, yAxis); // Apply radius after rotation, otherwise float2 sizes are incorrect xAxis *= radius.x; @@ -196,6 +205,8 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory } case BILLBOARD_ViewposAligned: { + rotation = PKSimData_Loadf(particleID, PopcornFXGPUBillboardVSUniforms.InRotationsOffset); // rad + const float3 camToParticle = normalize(worldPos - worldCameraOrigin); const float3 upAxis = float3(0.0f, camToParticle.z * 0.01f, 1.0f); @@ -203,7 +214,7 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory yAxis = myCross(xAxis, camToParticle); planeNormal = -camToParticle; - RotateTangents(particleID, xAxis, yAxis); + RotateTangents(particleID, rotation, xAxis, yAxis); // Apply radius after rotation, otherwise float2 sizes are incorrect xAxis *= radius.x; @@ -248,6 +259,8 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory } case BILLBOARD_PlaneAligned: { + rotation = PKSimData_Loadf(particleID, PopcornFXGPUBillboardVSUniforms.InRotationsOffset); // rad + const float3 axisUp = PKSimData_Load3f(particleID, PopcornFXGPUBillboardVSUniforms.InAxis0sOffset); const float3 axisNrm = PKSimData_Load3f(particleID, PopcornFXGPUBillboardVSUniforms.InAxis1sOffset); @@ -255,7 +268,7 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory yAxis = myCross(xAxis, axisNrm); planeNormal = axisNrm; - RotateTangents(particleID, xAxis, yAxis); + RotateTangents(particleID, rotation, xAxis, yAxis); // Apply radius after rotation, otherwise float2 sizes are incorrect xAxis *= radius.x; @@ -292,6 +305,9 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory #if USE_PARTICLE_SIZE intermediates.ParticleSize = radius * 2.0f * GLOBAL_SCALE; #endif +#if USE_PARTICLE_SPRITE_ROTATION + intermediates.ParticleRotation = rotation; +#endif BRANCH if (PopcornFXGPUBillboardVSUniforms.CapsulesDC) diff --git a/Shaders/Private/PopcornFXGPUVertexFactory.ush b/Shaders/Private/PopcornFXGPUVertexFactory.ush index fdf2089..63a68df 100644 --- a/Shaders/Private/PopcornFXGPUVertexFactory.ush +++ b/Shaders/Private/PopcornFXGPUVertexFactory.ush @@ -110,6 +110,10 @@ struct FVertexFactoryInterpolantsVSToPS nointerpolation float2 ParticleSize : PARTICLE_SIZE; #endif +#if USE_PARTICLE_SPRITE_ROTATION + nointerpolation float ParticleRotation : PARTICLE_SPRITE_ROTATION; +#endif + #if INSTANCED_STEREO nointerpolation uint EyeIndex : PACKED_EYE_INDEX; #endif // (INSTANCED_STEREO) @@ -140,7 +144,11 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput I FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal) { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FMaterialVertexParameters VertexParameters = MakeInitializedMaterialVertexParameters(); +#else FMaterialVertexParameters VertexParameters = (FMaterialVertexParameters)0; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) #if NUM_MATERIAL_TEXCOORDS_VERTEX # if NUM_MATERIAL_TEXCOORDS_VERTEX >= 1 @@ -222,6 +230,10 @@ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, VertexParameters.Particle.Size = Intermediates.ParticleSize; #endif +#if USE_PARTICLE_SPRITE_ROTATION + VertexParameters.Particle.SpriteRotation = Intermediates.ParticleRotation; +#endif + return VertexParameters; } @@ -273,6 +285,10 @@ FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(FVertexFacto Interpolants.ParticleSize = Intermediates.ParticleSize; #endif +#if USE_PARTICLE_SPRITE_ROTATION + Interpolants.ParticleRotation = Intermediates.ParticleRotation; +#endif + //Interpolants.LightingPositionOffset = Interpolants.LightingPositionOffset; TODO //Interpolants.LightmapUVs = Interpolants.LightMapUVs; TODO @@ -346,6 +362,10 @@ FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVS PixelParameters.Particle.Size = Interpolants.ParticleSize; #endif +#if USE_PARTICLE_SPRITE_ROTATION + PixelParameters.Particle.SpriteRotation = Interpolants.ParticleRotation; +#endif + #if USE_PARTICLE_RANDOM PixelParameters.Particle.Random = 0.0f; #endif @@ -506,6 +526,10 @@ FVertexFactoryInterpolantsVSToDS VertexFactoryInterpolate(FVertexFactoryInterpol TESSELLATION_INTERPOLATE_MEMBER(InterpolantsVSToPS.ParticleSize); #endif +#if USE_PARTICLE_SPRITE_ROTATION + TESSELLATION_INTERPOLATE_MEMBER(InterpolantsVSToPS.ParticleRotation); +#endif + #if USE_PARTICLE_RANDOM //TESSELLATION_INTERPOLATE_MEMBER(InterpolantsVSToPS.ParticleRandom); #endif diff --git a/Shaders/Private/PopcornFXMeshVertexFactory.ush b/Shaders/Private/PopcornFXMeshVertexFactory.ush index dab1787..8ba9a14 100644 --- a/Shaders/Private/PopcornFXMeshVertexFactory.ush +++ b/Shaders/Private/PopcornFXMeshVertexFactory.ush @@ -67,7 +67,7 @@ struct FVertexFactoryInterpolantsVSToPS #endif nointerpolation float4 EmissiveColor : COLOR6; - nointerpolation float VATCursor : PARTICLE_TIME; + nointerpolation float Cursor : PARTICLE_TIME; #if (DYNAMIC_PARAMETERS_MASK & 1) nointerpolation float4 DynamicParameter0 : COLOR2; @@ -118,7 +118,8 @@ struct FVertexFactoryIntermediates float4 EmissiveColor; - float VATCursor; + /** VAT or AlphaRemap cursor */ + float Cursor; #if (DYNAMIC_PARAMETERS_MASK & 1) float4 DynamicParameter0; @@ -198,7 +199,7 @@ FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVS Result.Particle.SubUVLerp = Interpolants.AtlasRect.y; Result.Particle.Size = Interpolants.AtlasRect.zw; #endif - Result.Particle.RelativeTime = Interpolants.VATCursor; + Result.Particle.RelativeTime = Interpolants.Cursor; #if (DYNAMIC_PARAMETERS_MASK != 0) Result.Particle.DynamicParameterValidMask = PopcornFXUniforms.DynamicParameterMask; @@ -300,7 +301,12 @@ float4x4 InverseTransform(float4x4 InTransform) /** Converts from vertex factory specific input to a FMaterialVertexParameters, which is used by vertex shader material inputs. */ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal) { - FMaterialVertexParameters Result = (FMaterialVertexParameters)0; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FMaterialVertexParameters Result = MakeInitializedMaterialVertexParameters(); +#else + FMaterialVertexParameters Result = (FMaterialVertexParameters)0; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + #if (ENGINE_MAJOR_VERSION == 5) Result.SceneData = Intermediates.SceneData; #endif // (ENGINE_MAJOR_VERSION == 5) @@ -316,7 +322,7 @@ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, Result.Particle.SubUVLerp = Intermediates.AtlasRect.y; Result.Particle.Size = Intermediates.AtlasRect.zw; #endif - Result.Particle.RelativeTime = Intermediates.VATCursor; + Result.Particle.RelativeTime = Intermediates.Cursor; #if (DYNAMIC_PARAMETERS_MASK != 0) Result.Particle.DynamicParameterValidMask = PopcornFXUniforms.DynamicParameterMask; @@ -422,9 +428,14 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In BRANCH if (PopcornFXMeshVSUniforms.InEmissiveColorsOffset != -1) Intermediates.EmissiveColor = PKSimData_Load4f(particleID, PopcornFXMeshVSUniforms.InEmissiveColorsOffset); + + // Cursor sent through RelativeTime (either one) BRANCH if (PopcornFXMeshVSUniforms.InVATCursorsOffset != -1) - Intermediates.VATCursor = PKSimData_Loadf(particleID, PopcornFXMeshVSUniforms.InVATCursorsOffset); + Intermediates.Cursor = PKSimData_Loadf(particleID, PopcornFXMeshVSUniforms.InVATCursorsOffset); + BRANCH + if (PopcornFXMeshVSUniforms.InAlphaCursorsOffset != -1) + Intermediates.Cursor = PKSimData_Loadf(particleID, PopcornFXMeshVSUniforms.InAlphaCursorsOffset); #if (DYNAMIC_PARAMETERS_MASK & 1) BRANCH @@ -577,7 +588,7 @@ FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(FVertexFacto Interpolants.ParticleColor = Intermediates.ParticleColor; #endif Interpolants.EmissiveColor = Intermediates.EmissiveColor; - Interpolants.VATCursor = Intermediates.VATCursor; + Interpolants.Cursor = Intermediates.Cursor; #if (DYNAMIC_PARAMETERS_MASK & 1) Interpolants.DynamicParameter0 = Intermediates.DynamicParameter0; diff --git a/Shaders/Private/PopcornFXSkeletalMeshVertexFactory.ush b/Shaders/Private/PopcornFXSkeletalMeshVertexFactory.ush index 9a61a46..29cb666 100644 --- a/Shaders/Private/PopcornFXSkeletalMeshVertexFactory.ush +++ b/Shaders/Private/PopcornFXSkeletalMeshVertexFactory.ush @@ -74,7 +74,7 @@ struct FVertexFactoryInterpolantsVSToPS #endif nointerpolation float3 EmissiveColor : COLOR6; - nointerpolation float VATCursor : PARTICLE_TIME; + nointerpolation float Cursor : PARTICLE_TIME; #if (DYNAMIC_PARAMETERS_MASK & 1) nointerpolation float4 DynamicParameter0 : COLOR2; @@ -125,7 +125,8 @@ struct FVertexFactoryIntermediates float3 EmissiveColor; - half VATCursor; + /** AlphaRemap cursor */ + float Cursor; #if (DYNAMIC_PARAMETERS_MASK & 1) float4 DynamicParameter0; @@ -215,7 +216,7 @@ FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVS Result.Particle.SubUVLerp = Interpolants.AtlasRect.y; Result.Particle.Size = Interpolants.AtlasRect.zw; #endif - Result.Particle.RelativeTime = Interpolants.VATCursor; + Result.Particle.RelativeTime = Interpolants.Cursor; #if (DYNAMIC_PARAMETERS_MASK != 0) Result.Particle.DynamicParameterValidMask = PopcornFXUniforms.DynamicParameterMask; @@ -319,7 +320,12 @@ float4x4 InverseTransform(float4x4 InTransform) /** Converts from vertex factory specific input to a FMaterialVertexParameters, which is used by vertex shader material inputs. */ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal) { - FMaterialVertexParameters Result = (FMaterialVertexParameters)0; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FMaterialVertexParameters Result = MakeInitializedMaterialVertexParameters(); +#else + FMaterialVertexParameters Result = (FMaterialVertexParameters)0; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + #if (ENGINE_MAJOR_VERSION == 5) Result.SceneData = Intermediates.SceneData; #endif // (ENGINE_MAJOR_VERSION == 5) @@ -335,7 +341,7 @@ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, Result.Particle.SubUVLerp = Intermediates.AtlasRect.y; Result.Particle.Size = Intermediates.AtlasRect.zw; #endif - Result.Particle.RelativeTime = Intermediates.VATCursor; + Result.Particle.RelativeTime = Intermediates.Cursor; #if (DYNAMIC_PARAMETERS_MASK != 0) Result.Particle.DynamicParameterValidMask = PopcornFXUniforms.DynamicParameterMask; @@ -613,6 +619,10 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In if (PopcornFXSkelMeshUniforms.InEmissiveColorsOffset != -1) Intermediates.EmissiveColor = PKSimData_Load3f(particleID, PopcornFXSkelMeshUniforms.InEmissiveColorsOffset); + BRANCH + if (PopcornFXSkelMeshUniforms.InAlphaCursorsOffset != -1) + Intermediates.Cursor = PKSimData_Loadf(particleID, PopcornFXSkelMeshUniforms.InAlphaCursorsOffset); + #if (DYNAMIC_PARAMETERS_MASK & 1) BRANCH if (PopcornFXSkelMeshUniforms.InDynamicParameter0sOffset != -1) @@ -755,7 +765,7 @@ FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(FVertexFacto Interpolants.ParticleColor = Intermediates.ParticleColor; #endif Interpolants.EmissiveColor = Intermediates.EmissiveColor; - Interpolants.VATCursor = Intermediates.VATCursor; + Interpolants.Cursor = Intermediates.Cursor; #if (DYNAMIC_PARAMETERS_MASK & 1) Interpolants.DynamicParameter0 = Intermediates.DynamicParameter0; diff --git a/Shaders/Private/PopcornFXVertexFactory.ush b/Shaders/Private/PopcornFXVertexFactory.ush index 4fa24af..878fe9b 100644 --- a/Shaders/Private/PopcornFXVertexFactory.ush +++ b/Shaders/Private/PopcornFXVertexFactory.ush @@ -194,7 +194,11 @@ FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVS /** Converts from vertex factory specific input to a FMaterialVertexParameters, which is used by vertex shader material inputs. */ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal) { - FMaterialVertexParameters VertexParameters = (FMaterialVertexParameters)0; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FMaterialVertexParameters VertexParameters = MakeInitializedMaterialVertexParameters(); +#else + FMaterialVertexParameters VertexParameters = (FMaterialVertexParameters)0; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) #if NUM_MATERIAL_TEXCOORDS_VERTEX #if NUM_MATERIAL_TEXCOORDS_VERTEX >= 1 diff --git a/Source/PopcornFX/PopcornFX.Build.cs b/Source/PopcornFX/PopcornFX.Build.cs index 63bf126..059309b 100644 --- a/Source/PopcornFX/PopcornFX.Build.cs +++ b/Source/PopcornFX/PopcornFX.Build.cs @@ -226,7 +226,6 @@ private bool SetupPopcornFX(TargetInfo Target) string libPrefix = ""; string libExt = ""; - bool processLibs = true; #if !UE_5_0_OR_LATER // Support dropped with UE5 if (Target.Platform == UnrealTargetPlatform.Win32) { @@ -282,28 +281,11 @@ private bool SetupPopcornFX(TargetInfo Target) libPrefix = clientLibDir + "gmake_ios64/lib"; libExt = ".a"; } -#if !UE_5_0_OR_LATER // Support dropped with UE5 - else if (Target.Platform == UnrealTargetPlatform.Lumin) + else if (Target.Platform == UnrealTargetPlatform.Android) { libPrefix = clientLibDir + "gmake_android64/lib"; libExt = ".a"; } -#endif // !UE_5_0_OR_LATER - else if (Target.Platform == UnrealTargetPlatform.Android) - { - processLibs = false; - foreach (string lib in PkLibs) - { -#if !UE_5_0_OR_LATER // armv7 dropped with UE5 - // Multiple Architectures ! (armeabi, arm64) - // Using PublicLibraryPaths so ld will "skipping incompatible" libraries - PublicAdditionalLibraries.Add(clientLibDir + "gmake_android/lib" + lib + "_" + configShort + ".a"); // armv7 (armeabi) -#endif - PublicAdditionalLibraries.Add(clientLibDir + "gmake_android64/lib" + lib + "_" + configShort + ".a"); // armv8 (arm64) - } - libPrefix = ""; - libExt = ""; - } else if (Target.Platform == UnrealTargetPlatform.Linux) { libPrefix = clientLibDir + "gmake_linux_x64/lib"; @@ -323,12 +305,9 @@ private bool SetupPopcornFX(TargetInfo Target) } Log("SDK " + CurrentSDK + " - " + String.Join(", ", PublicAdditionalLibraries) + "" + libPrefix + " ... _" + configShort + libExt); - if (processLibs) + foreach (string lib in PkLibs) { - foreach (string lib in PkLibs) - { - PublicAdditionalLibraries.Add(libPrefix + lib + "_" + configShort + libExt); - } + PublicAdditionalLibraries.Add(libPrefix + lib + "_" + configShort + libExt); } if (Target.bBuildEditor == true) @@ -443,9 +422,20 @@ private bool SetupPopcornFX(TargetInfo Target) Target.Platform == UnrealTargetPlatform.Win32 || #endif // !UE_5_0_OR_LATER // Support dropped with UE5 Target.Platform == UnrealTargetPlatform.Win64 || isWinUNKNOWN) + { AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAftermath"); +#if UE_5_3_OR_LATER + AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAPI"); + AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelExtensionsFramework"); +#endif // UE_5_3_OR_LATER + } else + { AddDefinition("NV_AFTERMATH=0"); +#if UE_5_3_OR_LATER + AddDefinition("WITH_NVAPI=0"); +#endif // UE_5_3_OR_LATER + } #if UE_5_2_OR_LATER // D3D12RHIPrivate.h @@ -557,15 +547,10 @@ private bool SetupPlugin(TargetInfo Target) #else bool compileWithPhysX = false; #endif // !UE_5_1_OR_LATER -#if !UE_5_0_OR_LATER // Support dropped with UE5 - if (Target.Platform == UnrealTargetPlatform.Lumin) - compileWithPhysX = false; -#endif // UE_5_0_OR_LATER if (compileWithPhysX) PrivateDependencyModuleNames.Add("PhysX"); if (Target.bBuildEditor) { - //AddDefinition("MY_WITH_EDITOR=1"); PrivateDependencyModuleNames.AddRange( new string[] { diff --git a/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp b/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp index faa5999..04bfff4 100644 --- a/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp +++ b/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp @@ -50,13 +50,15 @@ namespace const PopcornFX::CString &packPath = pack->Path(); if (!rawFilePath.StartsWith(packPath.Data())) { +#if WITH_EDITOR if (!IsRunningCommandlet()) // We don't want this error to fail the packaging { FText title = LOCTEXT("import_outside_mountpoint_title", "PopcornFX: Invalid file location"); FText finalText = FText::FromString(FString::Printf(TEXT("The PopcornFX file '%s' is outside the mount point of the PopcornFX pack '%s'"), ANSI_TO_TCHAR(rawFilePath.Data()), ANSI_TO_TCHAR(packPath.Data()))); - FMessageDialog::Open(EAppMsgType::Ok, finalText, &title); + OpenMessageBox(EAppMsgType::Ok, finalText, title); } +#endif // WITH_EDITOR return null; } @@ -113,9 +115,7 @@ bool UPopcornFXFile::ImportFile(const FString &inFilePath) bool UPopcornFXFile::_ImportFile(const FString &inFilePath) { -#if WITH_EDITOR Modify(); -#endif const FString filePath = inFilePath; @@ -159,7 +159,7 @@ bool UPopcornFXFile::_ImportFile(const FString &inFilePath) LOCTEXT("PopcornFXCannotImportBakedText", "Please import the original source file of:\n\n{0}\n\nThen, PopcornFX Plugin and UE will take care of properly baking it.\n"), FText::FromString(filePath)); - FMessageDialog::Open(EAppMsgType::Ok, msg, &title); + OpenMessageBox(EAppMsgType::Ok, msg, title); FPopcornFXPlugin::Get().UnloadPkFile(this); // unload via this method (SetInternalUserData(null)) return false; } @@ -384,7 +384,7 @@ void UPopcornFXFile::AskImportAssetDependenciesIFN() doImport = true; else { - EAppReturnType::Type response = FMessageDialog::Open(EAppMsgType::YesNoYesAll, FText::FromString(msg), &title); + const EAppReturnType::Type response = OpenMessageBox(EAppMsgType::YesNoYesAll, FText::FromString(msg), title); if (response == EAppReturnType::YesAll) { FPopcornFXPlugin::SetAskImportAssetDependencies_YesAll(true); diff --git a/Source/PopcornFX/Private/Assets/PopcornFXMesh.cpp b/Source/PopcornFX/Private/Assets/PopcornFXMesh.cpp index 113d35c..4f0ab09 100644 --- a/Source/PopcornFX/Private/Assets/PopcornFXMesh.cpp +++ b/Source/PopcornFX/Private/Assets/PopcornFXMesh.cpp @@ -201,7 +201,7 @@ PopcornFX::PResourceMesh UPopcornFXMesh::LoadResourceMeshIFN(bool editorBuildIFN FText title = LOCTEXT("PopcornFX: Build Mesh data", "PopcornFX: Build Mesh data"); FString msg; msg += "Do you want to (re)generate PopcornFX mesh data for \"" + SourceMeshObject()->GetPathName() + "\" ?\nThis mesh is used by an effect for static/skeletal mesh sampling. \nIf yes, make sure to save the mesh afterwards."; - EAppReturnType::Type response = FMessageDialog::Open(EAppMsgType::YesNoYesAll, FText::FromString(msg), &title); + const EAppReturnType::Type response = OpenMessageBox(EAppMsgType::YesNoYesAll, FText::FromString(msg), title); if (response == EAppReturnType::YesAll) { reload = true; @@ -949,7 +949,7 @@ void UPopcornFXMesh::WriteMesh() FText title = LOCTEXT("mesh_write_fail", "PopcornFX: Failed to serialize PopcornFX mesh"); FText finalText = FText::FromString(FString::Printf(TEXT("Couldn't store PopcornFX mesh in '%s'"), *GetPathName())); - FMessageDialog::Open(EAppMsgType::Ok, finalText, &title); + OpenMessageBox(EAppMsgType::Ok, finalText, title); } } } diff --git a/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp b/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp index d1fd320..fc2dfd1 100644 --- a/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp +++ b/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp @@ -233,7 +233,7 @@ namespace "Texture \"{0}\" is used for distortion but has incompatible compression settings. Do you want to import it using NormalMap compression settings instead?"), FText::FromString(mat.TextureDiffuse->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.TextureDiffuse->Modify(); mat.TextureDiffuse->CompressionSettings = TextureCompressionSettings::TC_Normalmap; @@ -437,7 +437,7 @@ namespace "Texture \"{0}\" is used for distortion but has incompatible compression settings. Do you want to import it using NormalMap compression settings instead?"), FText::FromString(mat.TextureDiffuse->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.TextureDiffuse->Modify(); mat.TextureDiffuse->CompressionSettings = TextureCompressionSettings::TC_Normalmap; @@ -617,7 +617,7 @@ namespace !_IsVATTextureConfigured(mat.VATTexturePosition)) { const FText message = FText::Format(LOCTEXT("import_VAT_asset_message", "Texture \"{0}\" is used for vertex animation. Do you want to import it using VAT compatible settings?"), FText::FromString(mat.VATTexturePosition->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.VATTexturePosition->Modify(); mat.VATTexturePosition->Filter = TF_Nearest; @@ -627,7 +627,7 @@ namespace !_IsVATTextureConfigured(mat.VATTextureNormal)) { const FText message = FText::Format(LOCTEXT("import_VAT_asset_message", "Texture \"{0}\" is used for vertex animation. Do you want to import it using VAT compatible settings?"), FText::FromString(mat.VATTextureNormal->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.VATTextureNormal->Modify(); mat.VATTextureNormal->Filter = TF_Nearest; @@ -637,7 +637,7 @@ namespace !_IsVATTextureConfigured(mat.VATTextureColor)) { const FText message = FText::Format(LOCTEXT("import_VAT_asset_message", "Texture \"{0}\" is used for vertex animation. Do you want to import it using VAT compatible settings?"), FText::FromString(mat.VATTextureColor->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.VATTextureColor->Modify(); mat.VATTextureColor->Filter = TF_Nearest; @@ -647,7 +647,7 @@ namespace !_IsVATTextureConfigured(mat.VATTextureRotation)) { const FText message = FText::Format(LOCTEXT("import_VAT_asset_message", "Texture \"{0}\" is used for vertex animation. Do you want to import it using VAT compatible settings?"), FText::FromString(mat.VATTextureRotation->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.VATTextureRotation->Modify(); mat.VATTextureRotation->Filter = TF_Nearest; @@ -668,7 +668,7 @@ namespace !_IsVATMeshConfigured(mat.StaticMesh)) { const FText message = FText::Format(LOCTEXT("import_VAT_asset_message", "Mesh \"{0}\" is used for vertex animation. Do you want to import it using VAT compatible settings settings?"), FText::FromString(mat.StaticMesh->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.StaticMesh->Modify(); mat.StaticMesh->GetSourceModel(0).BuildSettings.bUseFullPrecisionUVs = true; @@ -678,6 +678,12 @@ namespace } } } + else + { + // Alpha remap only supported for non VAT materials. + if (decl.IsFeatureEnabled(PopcornFX::BasicRendererProperties::SID_AlphaRemap())) + mat.TextureAlphaRemapper = LoadTexturePk(decl.GetPropertyValue_Path(PopcornFX::BasicRendererProperties::SID_AlphaRemap_AlphaMap(), PopcornFX::CString::EmptyString)); + } if (skelMesh && mat.SkeletalMesh != null) { mat.TextureSkeletalAnimation = LoadTexturePk(decl.GetPropertyValue_Path(PopcornFX::SkeletalAnimationTexture::SID_SkeletalAnimation_AnimationTexture(), PopcornFX::CString::EmptyString)); @@ -713,7 +719,13 @@ namespace if (fluidVAT || softVAT || rigidVAT) return false; // unsupported else - mat.MaterialType = EPopcornFXMaterialType::Mesh_Additive; + { + // For now, only support unlit alpha blended & additive meshes. + if (decl.GetPropertyValue_Enum(PopcornFX::BasicRendererProperties::SID_Transparent_Type(), PopcornFX::BasicRendererProperties::Additive) == PopcornFX::BasicRendererProperties::AlphaBlend) + mat.MaterialType = EPopcornFXMaterialType::Mesh_AlphaBlend; + else + mat.MaterialType = EPopcornFXMaterialType::Mesh_Additive; + } mat.DrawOrder = decl.GetPropertyValue_I1(PopcornFX::BasicRendererProperties::SID_Transparent_GlobalSortOverride(), 0); mat.Lit = false; @@ -866,7 +878,7 @@ namespace "Texture \"{0}\" is used for distortion but has incompatible compression settings. Do you want to import it using NormalMap compression settings instead?"), FText::FromString(mat.TextureDiffuse->GetPathName())); - if (FMessageDialog::Open(EAppMsgType::YesNo, message, &title) == EAppReturnType::Yes) + if (OpenMessageBox(EAppMsgType::YesNo, message, title) == EAppReturnType::Yes) { mat.TextureDiffuse->Modify(); mat.TextureDiffuse->CompressionSettings = TextureCompressionSettings::TC_Normalmap; diff --git a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp index b93c4b5..9642083 100644 --- a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp +++ b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp @@ -65,36 +65,6 @@ uint32 ToPkShapeType(EPopcornFXAttribSamplerShapeType::Type ueShapeType) return static_cast(ueShapeType); } -namespace -{ - const char *_ResolveAttribSamplerShapeNodeName(CShapeDescriptor::EShapeType shapeType) - { - switch (shapeType) - { - case PopcornFX::CShapeDescriptor::ShapeBox: - return "CShapeDescriptor_Box"; - case PopcornFX::CShapeDescriptor::ShapeSphere: - return "CShapeDescriptor_Sphere"; - case PopcornFX::CShapeDescriptor::ShapeEllipsoid: - return "CShapeDescriptor_Ellipsoid"; - case PopcornFX::CShapeDescriptor::ShapeCylinder: - return "CShapeDescriptor_Cylinder"; - case PopcornFX::CShapeDescriptor::ShapeCapsule: - return "CShapeDescriptor_Capsule"; - case PopcornFX::CShapeDescriptor::ShapeCone: - return "CShapeDescriptor_Cone"; - case PopcornFX::CShapeDescriptor::ShapeMesh: - return "CShapeDescriptor_Mesh"; - case PopcornFX::CShapeDescriptor::ShapeMeshCollection: - return "CShapeDescriptor_MeshCollection"; - default: - break; - } - PK_ASSERT_NOT_REACHED(); - return "CParticleSamplerShape"; - } -} - //---------------------------------------------------------------------------- // // @@ -128,13 +98,6 @@ EPopcornFXAttributeSamplerType::Type ResolveAttribSamplerType(const PopcornFX::C return EPopcornFXAttributeSamplerType::None; } -//---------------------------------------------------------------------------- - -const char *ResolveAttribSamplerShapeNodeName(EPopcornFXAttribSamplerShapeType::Type shapeType) -{ - return _ResolveAttribSamplerShapeNodeName((CShapeDescriptor::EShapeType)ToPkShapeType(shapeType)); -} - //---------------------------------------------------------------------------- // // diff --git a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplers.cpp b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplers.cpp index 7d43111..ffa64ee 100644 --- a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplers.cpp +++ b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplers.cpp @@ -189,41 +189,35 @@ void APopcornFXAttributeSamplerActor::ReloadSprite() FString spritePath; if (m_IsValidSpecializedActor) { - FString spriteName; + FString spriteName; switch (m_SamplerComponentType) { case EPopcornFXAttributeSamplerComponentType::Shape: - { - const UPopcornFXAttributeSamplerShape *shape = Cast(Sampler); - if (shape != null) - spriteName = ResolveAttribSamplerShapeNodeName(shape->ShapeType); - else - spriteName = "CParticleSamplerShape"; + spriteName = "AttributeSampler_Shape"; break; - } case EPopcornFXAttributeSamplerComponentType::SkinnedMesh: - spriteName = "CParticleSamplerSkinnedMesh"; + spriteName = "AttributeSampler_SkeletalMesh"; break; case EPopcornFXAttributeSamplerComponentType::Image: - spriteName = "CParticleSamplerTexture"; + spriteName = "AttributeSampler_Image"; break; case EPopcornFXAttributeSamplerComponentType::AnimTrack: - spriteName = "CParticleSamplerAnimTrack"; + spriteName = "Attributesampler_AnimTrack"; break; case EPopcornFXAttributeSamplerComponentType::Curve: - spriteName = "CParticleSamplerCurve"; + spriteName = "AttributeSampler_Curve"; break; case EPopcornFXAttributeSamplerComponentType::Text: - spriteName = "CParticleSamplerText"; + spriteName = "AttributeSampler_Text"; break; case EPopcornFXAttributeSamplerComponentType::Turbulence: - spriteName = "CParticleSamplerProceduralTurbulence"; + spriteName = "AttributeSampler_VectorField"; break; default: - spriteName = "CParticleSamplerShape"; + spriteName = "AttributeSampler_Shape"; break; } - spritePath = "/PopcornFX/SlateBrushes/" + spriteName + "_med." + spriteName + "_med"; + spritePath = "/PopcornFX/SlateBrushes/" + spriteName + "." + spriteName; } else { @@ -2265,7 +2259,11 @@ bool UPopcornFXAttributeSamplerImage::_RebuildImageSampler() m_Data->m_Desc->SetupD3D12Resources(imageResource, m_Data->m_TextureResource_D3D12->Dimensions(), +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + UE::DXGIUtilities::FindShaderResourceFormat(imageResource->GetDesc().Format, sRGB), +#else FindShaderResourceDXGIFormat(imageResource->GetDesc().Format, sRGB), +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) imageAtlasResource, atlasRectCount); } diff --git a/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp b/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp index 4880773..9588789 100644 --- a/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp +++ b/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp @@ -84,26 +84,17 @@ namespace switch (samplerType) { case EPopcornFXAttributeSamplerType::Shape: - { - const PopcornFX::CParticleSamplerDescriptor *desc = sampler->GetSamplerDefaultDescriptor().Get(); - if (desc == null || !PK_VERIFY(desc->SamplerTypeID() == PopcornFX::CParticleSamplerDescriptor_Shape::SamplerTypeID())) - return "CParticleSamplerShape"; - - const PopcornFX::CParticleSamplerDescriptor_Shape_Default *shapeDesc = PopcornFX::checked_cast(desc); - if (!PK_VERIFY(shapeDesc->m_Shape != null)) - return "CParticleSamplerShape"; - return ResolveAttribSamplerShapeNodeName(ToUEShapeType(shapeDesc->m_Shape->ShapeType())); - } + return "AttributeSampler_Shape"; case EPopcornFXAttributeSamplerType::Curve: - return "CParticleSamplerCurve"; + return "AttributeSampler_Curve"; case EPopcornFXAttributeSamplerType::Image: - return "CParticleSamplerTexture"; + return "AttributeSampler_Image"; case EPopcornFXAttributeSamplerType::AnimTrack: - return "CParticleSamplerAnimTrack"; + return "Attributesampler_AnimTrack"; case EPopcornFXAttributeSamplerType::Text: - return "CParticleSamplerText"; + return "AttributeSampler_Text"; case EPopcornFXAttributeSamplerType::Turbulence: - return "CParticleSamplerProceduralTurbulence"; + return "AttributeSampler_VectorField"; default: PK_ASSERT_NOT_REACHED(); return null; diff --git a/Source/PopcornFX/Private/Editor/PopcornFXStyle.cpp b/Source/PopcornFX/Private/Editor/PopcornFXStyle.cpp index 1466a83..c0ab734 100644 --- a/Source/PopcornFX/Private/Editor/PopcornFXStyle.cpp +++ b/Source/PopcornFX/Private/Editor/PopcornFXStyle.cpp @@ -10,7 +10,8 @@ #include "Styling/SlateStyleRegistry.h" -#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( m_StyleSet->RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__ ) +#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush(m_StyleSet->RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__ ) +#define CORE_IMAGE_BRUSH_SVG( RelativePath, ... ) FSlateVectorImageBrush(m_StyleSet->RootToCoreContentDir(RelativePath, TEXT(".svg")), __VA_ARGS__) #define IMAGE_PLUGIN_BRUSH( RelativePath, ... ) FSlateImageBrush( FPopcornFXStyle::InContent(RelativePath, ".png"), __VA_ARGS__ ) //---------------------------------------------------------------------------- @@ -43,20 +44,17 @@ void FPopcornFXStyle::Initialize() m_StyleSet->Set("ClassIcon.PopcornFXFile", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_16x"), Icon16x16)); m_StyleSet->Set("ClassThumbnail.PopcornFXFile", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_64x"), Icon64x64)); - m_StyleSet->Set("ClassIcon.PopcornFXEffect", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_pkfx_16x"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXEffect", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_pkfx_64x"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXEffect", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_Effect"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXEffect", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_Effect"), Icon64x64)); - m_StyleSet->Set("ClassIcon.PopcornFXTextureAtlas", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_pkat_16x"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXTextureAtlas", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_pkat_64x"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXTextureAtlas", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_Atlas"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXTextureAtlas", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_Atlas"), Icon64x64)); - m_StyleSet->Set("ClassIcon.PopcornFXAnimTrack", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_Pkan_16x"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXAnimTrack", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_Pkan_64x"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXAnimTrack", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_AnimTrack"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXAnimTrack", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_AnimTrack"), Icon64x64)); - m_StyleSet->Set("ClassIcon.PopcornFXSimulationCache", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_Pksc_16x"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXSimulationCache", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_Pksc_64x"), Icon64x64)); - - m_StyleSet->Set("ClassIcon.PopcornFXFont", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_Pkfm_16x"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXFont", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_Pkfm_64x"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXFont", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_Font"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXFont", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/Resource_Font"), Icon64x64)); m_StyleSet->Set("ClassIcon.PopcornFXEmitter", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_16x"), Icon16x16)); m_StyleSet->Set("ClassThumbnail.PopcornFXEmitter", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_64x"), Icon64x64)); @@ -73,11 +71,11 @@ void FPopcornFXStyle::Initialize() m_StyleSet->Set("ClassIcon.PopcornFXEmitterComponent", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_16x"), Icon16x16)); m_StyleSet->Set("ClassThumbnail.PopcornFXEmitterComponent", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/icon_PopcornFX_Logo_64x"), Icon64x64)); - m_StyleSet->Set("ClassIcon.PopcornFXAttributeSampler", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/CParticleSamplerShape.med"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSampler", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/CParticleSamplerShape.med"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXAttributeSampler", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeSampler_Shape"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSampler", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeSampler_Shape"), Icon64x64)); - m_StyleSet->Set("ClassIcon.PopcornFXAttributeSamplerActor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/CParticleSamplerShape.med"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSamplerActor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/CParticleSamplerShape.med"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXAttributeSamplerActor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeSampler_Shape"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSamplerActor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeSampler_Shape"), Icon64x64)); m_StyleSet->Set("PopcornFX.BadIcon32", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/BadIcon"), Icon32x32)); @@ -87,25 +85,26 @@ void FPopcornFXStyle::Initialize() m_StyleSet->Set("ClassIcon.PopcornFXAttributeSamplerActor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/BadIcon"), Icon16x16)); m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSamplerActor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/BadIcon"), Icon64x64)); -#define ATTRIBSAMPLER_STYLE(__name, __image) \ - m_StyleSet->Set("ClassIcon." __name "", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/") TEXT(__image) TEXT(".med"), Icon16x16)); \ - m_StyleSet->Set("ClassThumbnail." __name "", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/") TEXT(__image) TEXT(".med"), Icon64x64)); \ - m_StyleSet->Set("ClassIcon." __name "Actor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/") TEXT(__image) TEXT(".med"), Icon16x16)); \ - m_StyleSet->Set("ClassThumbnail." __name "Actor", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/") TEXT(__image) TEXT(".med"), Icon64x64)); - - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerShape", "CParticleSamplerShape"); - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerImage", "CParticleSamplerTexture"); - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerAnimTrack", "CParticleSamplerAnimTrack"); - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerCurve", "CParticleSamplerCurve"); - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerText", "CParticleSamplerText"); - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerVectorField", "CParticleSamplerProceduralTurbulence"); - ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerSkinnedMesh", "CParticleSamplerSkinnedMesh"); +#define ATTRIBSAMPLER_STYLE(__name, __iconName, __imagePath) \ + m_StyleSet->Set("ClassIcon." __name "", new IMAGE_PLUGIN_BRUSH(TEXT(__imagePath), Icon16x16)); \ + m_StyleSet->Set("ClassThumbnail." __name "", new IMAGE_PLUGIN_BRUSH(TEXT(__imagePath), Icon64x64)); \ + m_StyleSet->Set("ClassIcon." __name "Actor", new IMAGE_PLUGIN_BRUSH(TEXT(__imagePath), Icon16x16)); \ + m_StyleSet->Set("ClassThumbnail." __name "Actor", new IMAGE_PLUGIN_BRUSH(TEXT(__imagePath), Icon64x64)); \ + m_StyleSet->Set("PopcornFX.Node." __iconName, new IMAGE_PLUGIN_BRUSH(TEXT(__imagePath), Icon32x32)) + + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerShape", "AttributeSampler_Shape", "SlateBrushes/AttributeSampler_Shape"); + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerSkinnedMesh", "AttributeSampler_SkeletalMesh", "SlateBrushes/AttributeSampler_SkeletalMesh"); + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerImage", "AttributeSampler_Image", "SlateBrushes/AttributeSampler_Image"); + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerAnimTrack", "Attributesampler_AnimTrack", "SlateBrushes/Attributesampler_AnimTrack"); + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerCurve", "AttributeSampler_Curve", "SlateBrushes/AttributeSampler_Curve"); + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerText", "AttributeSampler_Text", "SlateBrushes/AttributeSampler_Text"); + ATTRIBSAMPLER_STYLE("PopcornFXAttributeSamplerVectorField", "AttributeSampler_VectorField", "SlateBrushes/AttributeSampler_VectorField"); #undef ATTRIBSAMPLER_STYPE // No actor, is a component only - m_StyleSet->Set("ClassIcon.PopcornFXAttributeSamplerCurveDynamic", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/CParticleSamplerCurve.med"), Icon16x16)); - m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSamplerCurveDynamic", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/CParticleSamplerCurve.med"), Icon64x64)); + m_StyleSet->Set("ClassIcon.PopcornFXAttributeSamplerCurveDynamic", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeSampler_Curve"), Icon16x16)); + m_StyleSet->Set("ClassThumbnail.PopcornFXAttributeSamplerCurveDynamic", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeSampler_Curve"), Icon64x64)); m_StyleSet->Set("PopcornFX.Attribute.F1", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeF1"), Icon32x32)); m_StyleSet->Set("PopcornFX.Attribute.F2", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/AttributeF2"), Icon32x32)); @@ -143,26 +142,6 @@ void FPopcornFXStyle::Initialize() m_StyleSet->Set("PopcornFXLevelEditor.OpenSourcePack", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/LevelEditor_OpenSourcePack_40x"), Icon40x40)); m_StyleSet->Set("PopcornFXLevelEditor.OpenSourcePack.Small", new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/LevelEditor_OpenSourcePack_20x"), Icon20x20)); -#define STYLE_PKFX_NODE(__node) \ - m_StyleSet->Set("PopcornFX.Node." __node, new IMAGE_PLUGIN_BRUSH(TEXT("SlateBrushes/") TEXT(__node) TEXT(".med"), Icon32x32)) - - STYLE_PKFX_NODE("CParticleSamplerCurve"); - STYLE_PKFX_NODE("CParticleSamplerProceduralTurbulence"); - STYLE_PKFX_NODE("CParticleSamplerShape"); - STYLE_PKFX_NODE("CParticleSamplerTexture"); - STYLE_PKFX_NODE("CParticleSamplerAnimTrack"); - STYLE_PKFX_NODE("CParticleSamplerText"); - STYLE_PKFX_NODE("CShapeDescriptor_Box"); - STYLE_PKFX_NODE("CShapeDescriptor_Capsule"); - STYLE_PKFX_NODE("CShapeDescriptor_MeshCollection"); - STYLE_PKFX_NODE("CShapeDescriptor_Ellipsoid"); - STYLE_PKFX_NODE("CShapeDescriptor_Cone"); - STYLE_PKFX_NODE("CShapeDescriptor_Cylinder"); - STYLE_PKFX_NODE("CShapeDescriptor_Mesh"); - STYLE_PKFX_NODE("CShapeDescriptor_Sphere"); - -#undef STYLE_PKFX_NODE - FSlateStyleRegistry::RegisterSlateStyle(*m_StyleSet.Get()); } } diff --git a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp index 2ecf4e2..4ce667c 100644 --- a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp +++ b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp @@ -88,6 +88,9 @@ void FPopcornFXCustomizationSubRendererMaterial::CustomizeHeader( m_Thumbs[Thumb_Emissive].m_Pty = PropertyHandle->GetChildHandle(GET_MEMBER_NAME_STRING_CHECKED(FPopcornFXSubRendererMaterial, TextureEmissive)).ToSharedRef(); m_Thumbs[Thumb_Emissive].m_Tumbnail = MakeShareable(new FAssetThumbnail(self->TextureEmissive, 64, 64, CustomizationUtils.GetThumbnailPool())); + m_Thumbs[Thumb_AlphaRemap].m_Pty = PropertyHandle->GetChildHandle(GET_MEMBER_NAME_STRING_CHECKED(FPopcornFXSubRendererMaterial, TextureAlphaRemapper)).ToSharedRef(); + m_Thumbs[Thumb_AlphaRemap].m_Tumbnail = MakeShareable(new FAssetThumbnail(self->TextureAlphaRemapper, 64, 64, CustomizationUtils.GetThumbnailPool())); + m_Thumbs[Thumb_MotionVectors].m_Pty = PropertyHandle->GetChildHandle(GET_MEMBER_NAME_STRING_CHECKED(FPopcornFXSubRendererMaterial, TextureMotionVectors)).ToSharedRef(); m_Thumbs[Thumb_MotionVectors].m_Tumbnail = MakeShareable(new FAssetThumbnail(self->TextureMotionVectors, 64, 64, CustomizationUtils.GetThumbnailPool())); diff --git a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.h b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.h index 745edea..d61bf60 100644 --- a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.h +++ b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.h @@ -41,6 +41,7 @@ class FPopcornFXCustomizationSubRendererMaterial : public IPropertyTypeCustomiza Thumb_Diffuse = 0, Thumb_DiffuseRamp, Thumb_Emissive, + Thumb_AlphaRemap, Thumb_MotionVectors, Thumb_SixWay_RLTS, Thumb_SixWay_BBF, diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.cpp index fa55eaf..56cc8f9 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.cpp @@ -38,424 +38,6 @@ namespace PopcornFXBillboarder { //---------------------------------------------------------------------------- - EBillboarder::Type BillboarderModeToType(PopcornFX::EBillboardMode mode) - { - EBillboarder::Type bbType = (EBillboarder::Type)~0; - switch (mode) - { - case PopcornFX::BillboardMode_ScreenAligned: - bbType = EBillboarder::ScreenAligned; - break; - case PopcornFX::BillboardMode_ViewposAligned: - bbType = EBillboarder::ViewposAligned; - break; - case PopcornFX::BillboardMode_AxisAligned: - bbType = EBillboarder::AxisAligned; - break; - case PopcornFX::BillboardMode_AxisAlignedSpheroid: - bbType = EBillboarder::AxisAlignedSpheroid; - break; - case PopcornFX::BillboardMode_AxisAlignedCapsule: - bbType = EBillboarder::AxisAlignedCapsule; - break; - case PopcornFX::BillboardMode_PlaneAligned: - bbType = EBillboarder::PlaneAligned; - break; - default: - PK_ASSERT_NOT_REACHED(); - break; - } - return bbType; - } - - //---------------------------------------------------------------------------- - - u32 BillboarderTypeMaskMustHaveInputMask(u32 typeMask) - { - PK_STATIC_ASSERT(EBillboarder::_Count < sizeof(typeMask) * 8); - PK_STATIC_ASSERT(EInput::_Count < sizeof(typeMask) * 8); - - u32 inputMask = 0; - inputMask |= (1 << EInput::InPositions); - if (typeMask & (1 << EBillboarder::ScreenAligned)) - { - } - if (typeMask & (1 << EBillboarder::ViewposAligned)) - { - } - if (typeMask & (1 << EBillboarder::AxisAligned)) - { - inputMask |= (1 << EInput::InAxis0s); - } - if (typeMask & (1 << EBillboarder::AxisAlignedCapsule)) - { - inputMask |= (1 << EInput::InAxis0s); - } - if (typeMask & (1 << EBillboarder::AxisAlignedSpheroid)) - { - inputMask |= (1 << EInput::InAxis0s); - } - if (typeMask & (1 << EBillboarder::PlaneAligned)) - { - inputMask |= (1 << EInput::InAxis0s); - inputMask |= (1 << EInput::InAxis1s); - } - PK_STATIC_ASSERT(EBillboarder::_Count == 6); // check above - return inputMask; - } - - //---------------------------------------------------------------------------- - - void AddDefinesEnumTypeAndMasks(FShaderCompilerEnvironment& OutEnvironment) - { -#define X_PK_BILLBOARDER_TYPE(__type) \ - PK_ASSERT(!OutEnvironment.GetDefinitions().Contains(TEXT("BILLBOARD_") TEXT(#__type))); \ - OutEnvironment.SetDefine(TEXT("BILLBOARD_") TEXT(#__type), uint32(EBillboarder::__type)); - EXEC_X_PK_BILLBOARDER_TYPE() -#undef X_PK_BILLBOARDER_TYPE - -#define X_PK_BILLBOARDER_TYPE(__type) \ - PK_ASSERT(!OutEnvironment.GetDefinitions().Contains(TEXT("BBMASK_") TEXT(#__type))); \ - OutEnvironment.SetDefine(TEXT("BBMASK_") TEXT(#__type), 1 << uint32(EBillboarder::__type)); - EXEC_X_PK_BILLBOARDER_TYPE() -#undef X_PK_BILLBOARDER_TYPE - -#define X_PK_BILLBOARDER_OUTPUT(__output) \ - PK_ASSERT(!OutEnvironment.GetDefinitions().Contains(TEXT("MASK_") TEXT(#__output))); \ - OutEnvironment.SetDefine(TEXT("MASK_") TEXT(#__output), uint32(1 << (EOutput:: __output))); - EXEC_X_PK_BILLBOARDER_OUTPUT() -#undef X_PK_BILLBOARDER_OUTPUT - -#define X_PK_BILLBOARDER_INPUT(__input) \ - PK_ASSERT(!OutEnvironment.GetDefinitions().Contains(TEXT("MASK_") TEXT(#__input))); \ - OutEnvironment.SetDefine(TEXT("MASK_") TEXT(#__input), uint32(1 << (EInput:: __input))); - EXEC_X_PK_BILLBOARDER_INPUT() -#undef X_PK_BILLBOARDER_INPUT - } - - - //---------------------------------------------------------------------------- - // - // - // - //---------------------------------------------------------------------------- - - // static - template - bool FBillboarderBillboardCS<_Build>::ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters) - { - return _IsGpuSupportedOnPlatform(Parameters.Platform); - } - - //---------------------------------------------------------------------------- - - //static - template - void FBillboarderBillboardCS<_Build>::ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment) - { - Super::ModifyCompilationEnvironment(Parameters, OutEnvironment); - - OutEnvironment.SetDefine(TEXT("PK_GPU_THREADGROUP_SIZE"), CS_BB_THREADGROUP_SIZE); - - AddDefinesEnumTypeAndMasks(OutEnvironment); - - OutEnvironment.SetDefine(TEXT("RENDERERFLAG_FlipV"), 1 << ERendererFlag::FlipV); - OutEnvironment.SetDefine(TEXT("RENDERERFLAG_SoftAnimationBlending"), 1 << ERendererFlag::SoftAnimationBlending); - - OutEnvironment.SetDefine(TEXT("PK_BILLBOARDER_CS_OUTPUT_PACK_PTN"), uint32(PK_BILLBOARDER_CS_OUTPUT_PACK_PTN)); - OutEnvironment.SetDefine(TEXT("PK_BILLBOARDER_CS_OUTPUT_PACK_TEXCOORD"), uint32(PK_BILLBOARDER_CS_OUTPUT_PACK_TEXCOORD)); - - switch (_Build) - { - case EBillboarderCSBuild::Std: - break; - case EBillboarderCSBuild::VertexPP: - OutEnvironment.SetDefine(TEXT("VERTEX_PER_PARTICLE"), 1); - break; - } - - //OutEnvironment.CompilerFlags.Add(CFLAG_StandardOptimization); - - } - - //---------------------------------------------------------------------------- - - template - FBillboarderBillboardCS<_Build>::FBillboarderBillboardCS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) - : FGlobalShader(Initializer) - { - BillboarderType.Bind(Initializer.ParameterMap, TEXT("BillboarderType")); - OutputMask.Bind(Initializer.ParameterMap, TEXT("OutputMask")); - InputMask.Bind(Initializer.ParameterMap, TEXT("InputMask")); - InIndicesOffset.Bind(Initializer.ParameterMap, TEXT("InIndicesOffset")); - InputOffset.Bind(Initializer.ParameterMap, TEXT("InputOffset")); - OutputVertexOffset.Bind(Initializer.ParameterMap, TEXT("OutputVertexOffset")); - OutputIndexOffset.Bind(Initializer.ParameterMap, TEXT("OutputIndexOffset")); - BillboardingMatrix.Bind(Initializer.ParameterMap, TEXT("BillboardingMatrix")); - RendererFlags.Bind(Initializer.ParameterMap, TEXT("RendererFlags")); - RendererNormalsBendingFactor.Bind(Initializer.ParameterMap, TEXT("RendererNormalsBendingFactor")); - - RendererAtlasRectCount.Bind(Initializer.ParameterMap, TEXT("RendererAtlasRectCount")); - RendererAtlasBuffer.Bind(Initializer.ParameterMap, TEXT("RendererAtlasBuffer")); - -#define X_PK_BILLBOARDER_OUTPUT(__output) Outputs[EOutput :: __output].Bind(Initializer.ParameterMap, TEXT(#__output)); - EXEC_X_PK_BILLBOARDER_OUTPUT() -#undef X_PK_BILLBOARDER_OUTPUT - - InIndices.Bind(Initializer.ParameterMap, TEXT("InIndices")); - InSimData.Bind(Initializer.ParameterMap, TEXT("InSimData")); - -#define X_PK_BILLBOARDER_INPUT(__input) \ - InputsOffsets[EInput::__input].Bind(Initializer.ParameterMap, TEXT(#__input "Offset")); \ - InputsDefault[EInput::__input].Bind(Initializer.ParameterMap, TEXT("Default") TEXT(#__input)); - EXEC_X_PK_BILLBOARDER_INPUT() -#undef X_PK_BILLBOARDER_INPUT - - HasLiveParticleCount.Bind(Initializer.ParameterMap, TEXT("HasLiveParticleCount")); - LiveParticleCount.Bind(Initializer.ParameterMap, TEXT("LiveParticleCount")); - } - - //---------------------------------------------------------------------------- - - template - FBillboarderBillboardCS<_Build>::FBillboarderBillboardCS() - { - } - - //---------------------------------------------------------------------------- - - template - void FBillboarderBillboardCS<_Build>::Dispatch(FRHICommandList& RHICmdList, const FBillboarderBillboardCS_Params ¶ms) - { - const bool isVPP = (_Build == EBillboarderCSBuild::VertexPP); - - FCSRHIParamRef shader = RHICmdList.GetBoundComputeShader(); - - uint32 outputMask = 0; - uint32 inputMask = 0; - - if (isVPP) - { - PK_ASSERT(!IsValidRef(params.m_Outputs[EOutput::OutTexcoords])); - PK_ASSERT(!IsValidRef(params.m_Outputs[EOutput::OutTexcoord2s])); - PK_ASSERT(!IsValidRef(params.m_Outputs[EOutput::OutTangents])); - } - - for (u32 i = 0; i < EOutput::_Count; ++i) - { - if (IsValidRef(params.m_Outputs[i])) - { - outputMask |= (1 << i); // if buffer is provided, always set the mask, even if not used (not bound) - if (Outputs[i].IsBound()) - { - // D3D12: Force ERWBarrier right now - // TODO: Investigate into output vertex offset to aligned stride (cache lines ?) - // if (params.m_OutputVertexOffset == 0) - { - RHICmdList.Transition(FRHITransitionInfo(params.m_Outputs[i], ERHIAccess::VertexOrIndexBuffer, ERHIAccess::UAVCompute)); - RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), params.m_Outputs[i]); - } - } - } - else if (Outputs[i].IsBound()) - RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), null); // avoids D3D11 warnings !? - } - - RHICmdList.SetShaderResourceViewParameter(shader, InIndices.GetBaseIndex(), IsValidRef(params.m_InIndices) ? params.m_InIndices : null); - RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), IsValidRef(params.m_InSimData) ? params.m_InSimData : null); - for (u32 i = 0; i < EInput::_Count; ++i) - { - if (params.m_ValidInputs[i]) - inputMask |= (1 << i); // if buffer is provided, always set the mask, even if not used (not bound) - - SetShaderValue(RHICmdList, shader, InputsOffsets[i], params.m_InputsOffsets[i]); - SetShaderValue(RHICmdList, shader, InputsDefault[i], _Reinterpret(params.m_InputsDefault[i])); - } - - PK_ONLY_IF_ASSERTS(const u32 mustHaveInputMask = BillboarderTypeMaskMustHaveInputMask(1 << params.m_BillboarderType)); - PK_ASSERT((inputMask & mustHaveInputMask) == mustHaveInputMask); - - SetShaderValue(RHICmdList, shader, OutputMask, outputMask); - SetShaderValue(RHICmdList, shader, InputMask, inputMask); - SetShaderValue(RHICmdList, shader, BillboarderType, params.m_BillboarderType); - SetShaderValue(RHICmdList, shader, InIndicesOffset, params.m_InIndicesOffset); - SetShaderValue(RHICmdList, shader, InputOffset, params.m_InputOffset); - SetShaderValue(RHICmdList, shader, OutputVertexOffset, params.m_OutputVertexOffset); - SetShaderValue(RHICmdList, shader, OutputIndexOffset, params.m_OutputIndexOffset); - SetShaderValue(RHICmdList, shader, BillboardingMatrix, ToUE(params.m_BillboardingMatrix)); - SetShaderValue(RHICmdList, shader, RendererFlags, params.m_RendererFlags); - SetShaderValue(RHICmdList, shader, RendererNormalsBendingFactor, params.m_RendererNormalsBendingFactor); - - if (IsValidRef(params.m_RendererAtlasBuffer) && - RendererAtlasBuffer.IsBound()) - { - RHICmdList.SetShaderResourceViewParameter(shader, RendererAtlasBuffer.GetBaseIndex(), params.m_RendererAtlasBuffer); - SetShaderValue(RHICmdList, shader, RendererAtlasRectCount, params.m_RendererAtlasRectCount); - } - else - { - if (RendererAtlasBuffer.IsBound()) - RHICmdList.SetShaderResourceViewParameter(shader, RendererAtlasBuffer.GetBaseIndex(), null); // avoids D3D11 warnings !? - SetShaderValue(RHICmdList, shader, RendererAtlasRectCount, u32(0)); - } - - uint32 hasLiveParticleCount = 0; - if (IsValidRef(params.m_LiveParticleCount)) - hasLiveParticleCount = 1; - SetShaderValue(RHICmdList, shader, HasLiveParticleCount, hasLiveParticleCount); - if (IsValidRef(params.m_LiveParticleCount) && LiveParticleCount.IsBound()) - RHICmdList.SetShaderResourceViewParameter(shader, LiveParticleCount.GetBaseIndex(), params.m_LiveParticleCount); - - { - PK_NAMEDSCOPEDPROFILE("FBillboarderBillboardCS::Dispatch"); - const uint32 threadGroupCount = PopcornFX::Mem::Align(params.m_ParticleCount, CS_BB_THREADGROUP_SIZE) / CS_BB_THREADGROUP_SIZE; - RHICmdList.DispatchComputeShader(threadGroupCount, 1, 1); - } - - FUAVRHIParamRef nullUAV = FUAVRHIParamRef(); - FSRVRHIParamRef nullSRV = FSRVRHIParamRef(); - for (u32 i = 0; i < EOutput::_Count; ++i) - { - if (IsValidRef(params.m_Outputs[i]) && Outputs[i].IsBound()) - { - RHICmdList.Transition(FRHITransitionInfo(params.m_Outputs[i], ERHIAccess::UAVCompute, ERHIAccess::VertexOrIndexBuffer)); - RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), nullUAV); - } - } - RHICmdList.SetShaderResourceViewParameter(shader, InIndices.GetBaseIndex(), nullSRV); - RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), nullSRV); - } - - //---------------------------------------------------------------------------- - - template class FBillboarderBillboardCS; - template class FBillboarderBillboardCS; - - //---------------------------------------------------------------------------- - - // static - bool FCopyStreamCS::ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters) - { - return _IsGpuSupportedOnPlatform(Parameters.Platform); - } - - //---------------------------------------------------------------------------- - - //static - void FCopyStreamCS::ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment) - { - Super::ModifyCompilationEnvironment(Parameters, OutEnvironment); - - OutEnvironment.SetDefine(TEXT("PK_GPU_THREADGROUP_SIZE"), CS_BB_THREADGROUP_SIZE); - AddDefinesEnumTypeAndMasks(OutEnvironment); - OutEnvironment.SetDefine(TEXT("PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16"), uint32(PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16)); - } - - //---------------------------------------------------------------------------- - - FCopyStreamCS::FCopyStreamCS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) - : FGlobalShader(Initializer) - { - OutputMask.Bind(Initializer.ParameterMap, TEXT("OutputMask")); - InputMask.Bind(Initializer.ParameterMap, TEXT("InputMask")); - InputOffset.Bind(Initializer.ParameterMap, TEXT("InputOffset")); - OutputVertexOffset.Bind(Initializer.ParameterMap, TEXT("OutputVertexOffset")); - IsCapsule.Bind(Initializer.ParameterMap, TEXT("IsCapsule")); - -#define X_PK_BILLBOARDER_OUTPUT(__output) Outputs[EOutput :: __output].Bind(Initializer.ParameterMap, TEXT(#__output)); - EXEC_X_PK_BILLBOARDER_OUTPUT() -#undef X_PK_BILLBOARDER_OUTPUT - InSimData.Bind(Initializer.ParameterMap, TEXT("InSimData")); -#define X_PK_BILLBOARDER_INPUT(__input) \ - InputsOffsets[EInput::__input].Bind(Initializer.ParameterMap, TEXT(#__input "Offset")); \ - InputsDefault[EInput::__input].Bind(Initializer.ParameterMap, TEXT("Default") TEXT(#__input)); - EXEC_X_PK_BILLBOARDER_INPUT() -#undef X_PK_BILLBOARDER_INPUT - - HasLiveParticleCount.Bind(Initializer.ParameterMap, TEXT("HasLiveParticleCount")); - LiveParticleCount.Bind(Initializer.ParameterMap, TEXT("LiveParticleCount")); - } - - //---------------------------------------------------------------------------- - - FCopyStreamCS::FCopyStreamCS() - { - } - - //---------------------------------------------------------------------------- - - void FCopyStreamCS::Dispatch(FRHICommandList& RHICmdList, const FBillboardCS_Params ¶ms) - { - FCSRHIParamRef shader = RHICmdList.GetBoundComputeShader(); - - uint32 outputMask = 0; - uint32 inputMask = 0; - - for (u32 i = 0; i < EOutput::_Count; ++i) - { - if (IsValidRef(params.m_Outputs[i])) - { - outputMask |= (1 << i); // if buffer is provided, always set the mask, even if not used (not bound) - if (Outputs[i].IsBound()) - { - // D3D12: Force ERWBarrier right now - // TODO: Investigate into output vertex offset to aligned stride (cache lines ?) - // if (params.m_OutputVertexOffset == 0) - { - RHICmdList.Transition(FRHITransitionInfo(params.m_Outputs[i], ERHIAccess::VertexOrIndexBuffer, ERHIAccess::UAVCompute)); - RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), params.m_Outputs[i]); - } - } - } - else if (Outputs[i].IsBound()) - RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), null); // avoids D3D11 warnings !? - } - - RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), IsValidRef(params.m_InSimData) ? params.m_InSimData : null); - for (u32 i = 0; i < EInput::_Count; ++i) - { - if (params.m_ValidInputs[i]) - inputMask |= (1 << i); // if buffer is provided, always set the mask, even if not used (not bound) - - SetShaderValue(RHICmdList, shader, InputsOffsets[i], params.m_InputsOffsets[i]); - SetShaderValue(RHICmdList, shader, InputsDefault[i], _Reinterpret(params.m_InputsDefault[i])); - } - - const bool isCapsule = params.m_BillboarderType == EBillboarder::AxisAlignedCapsule; - SetShaderValue(RHICmdList, shader, OutputMask, outputMask); - SetShaderValue(RHICmdList, shader, InputMask, inputMask); - SetShaderValue(RHICmdList, shader, InputOffset, params.m_InputOffset); - SetShaderValue(RHICmdList, shader, OutputVertexOffset, params.m_OutputVertexOffset); - SetShaderValue(RHICmdList, shader, IsCapsule, isCapsule ? 1 : 0); - - uint32 hasLiveParticleCount = 0; - if (IsValidRef(params.m_LiveParticleCount)) - hasLiveParticleCount = 1; - SetShaderValue(RHICmdList, shader, HasLiveParticleCount, hasLiveParticleCount); - if (IsValidRef(params.m_LiveParticleCount) && LiveParticleCount.IsBound()) - RHICmdList.SetShaderResourceViewParameter(shader, LiveParticleCount.GetBaseIndex(), params.m_LiveParticleCount); - - { - PK_NAMEDSCOPEDPROFILE("FCopyStreamCS::Dispatch"); - const uint32 threadGroupCount = PopcornFX::Mem::Align(params.m_ParticleCount, CS_BB_THREADGROUP_SIZE) / CS_BB_THREADGROUP_SIZE; - RHICmdList.DispatchComputeShader(threadGroupCount, 1, 1); - } - - FUAVRHIParamRef nullUAV = FUAVRHIParamRef(); - FSRVRHIParamRef nullSRV = FSRVRHIParamRef(); - for (u32 i = 0; i < EOutput::_Count; ++i) - { - if (IsValidRef(params.m_Outputs[i]) && Outputs[i].IsBound()) - { - RHICmdList.Transition(FRHITransitionInfo(params.m_Outputs[i], ERHIAccess::UAVCompute, ERHIAccess::VertexOrIndexBuffer)); - RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), nullUAV); - } - } - RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), nullSRV); - } - - //---------------------------------------------------------------------------- - #if (PK_GPU_D3D11 != 0) || (PK_GPU_D3D12 != 0) // static bool FUAVsClearCS::ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters) @@ -465,18 +47,8 @@ namespace PopcornFXBillboarder //---------------------------------------------------------------------------- - //static - void FUAVsClearCS::ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment) - { - Super::ModifyCompilationEnvironment(Parameters, OutEnvironment); - - AddDefinesEnumTypeAndMasks(OutEnvironment); - } - - //---------------------------------------------------------------------------- - FUAVsClearCS::FUAVsClearCS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) - : FGlobalShader(Initializer) + : FGlobalShader(Initializer) { ClearBufferCSParams.Bind(Initializer.ParameterMap, TEXT("ClearBufferCSParams"), SPF_Mandatory); UAVRaw.Bind(Initializer.ParameterMap, TEXT("UAVRaw")); @@ -486,14 +58,12 @@ namespace PopcornFXBillboarder //---------------------------------------------------------------------------- - FUAVsClearCS::FUAVsClearCS() - { - } - - //---------------------------------------------------------------------------- - void FUAVsClearCS::Dispatch(const SUERenderContext &renderContext, FRHICommandList& RHICmdList, const FClearCS_Params ¶ms) { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); +#endif + // Right now, one dispatch per UAV to clear // But we could do a two dispatchs for all UAVs -- Vertex declaration doesn't change // -- We know the max UAV count @@ -513,34 +83,55 @@ namespace PopcornFXBillboarder view->View->GetDesc(&desc); byteSize = desc.Buffer.NumElements * 4; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, UAV, params.m_UAVs[i]); + SetUAVParameter(batchedParameters, UAVRaw, null); + SetShaderValue(batchedParameters, RawUAV, 0); +#else RHICmdList.SetUAVParameter(shader, UAV.GetBaseIndex(), params.m_UAVs[i]); RHICmdList.SetUAVParameter(shader, UAVRaw.GetBaseIndex(), null); SetShaderValue(RHICmdList, shader, RawUAV, 0); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } #endif // (PK_GPU_D3D11 != 0) #if (PK_GPU_D3D12 != 0) if (renderContext.m_API == SUERenderContext::D3D12) { const FD3D12UnorderedAccessView *view = (FD3D12UnorderedAccessView*)params.m_UAVs[i].GetReference(); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + const D3D12_UNORDERED_ACCESS_VIEW_DESC &desc = view->GetD3DDesc(); +#else const D3D12_UNORDERED_ACCESS_VIEW_DESC &desc = view->GetDesc(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) byteSize = desc.Buffer.NumElements * 4; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, UAV, null); + SetUAVParameter(batchedParameters, UAVRaw, params.m_UAVs[i]); + SetShaderValue(batchedParameters, RawUAV, 1); +#else RHICmdList.SetUAVParameter(shader, UAV.GetBaseIndex(), null); RHICmdList.SetUAVParameter(shader, UAVRaw.GetBaseIndex(), params.m_UAVs[i]); SetShaderValue(RHICmdList, shader, RawUAV, 1); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } #endif // (PK_GPU_D3D12 != 0) const u32 numDWordsToClear = (byteSize + 3) / 4; const u32 numThreadGroupsX = (numDWordsToClear + 63) / 64; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, ClearBufferCSParams, FUintVector4(0/*Clear value*/, numDWordsToClear, 0, 0)); + RHICmdList.SetBatchedShaderParameters(shader, batchedParameters); +#else SetShaderValue(RHICmdList, shader, ClearBufferCSParams, FUintVector4(0/*Clear value*/, numDWordsToClear, 0, 0)); - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EGfxToCompute, params.m_UAVs[i]); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) RHICmdList.DispatchComputeShader(numThreadGroupsX, 1, 1); - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, params.m_UAVs[i]); +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) SetUAVParameter(RHICmdList, shader, UAVRaw, FUnorderedAccessViewRHIRef()); SetUAVParameter(RHICmdList, shader, UAV, FUnorderedAccessViewRHIRef()); +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) } } } @@ -562,14 +153,13 @@ namespace PopcornFXBillboarder Super::ModifyCompilationEnvironment(Parameters, OutEnvironment); OutEnvironment.SetDefine(TEXT("PK_GPU_THREADGROUP_SIZE"), CS_BB_THREADGROUP_SIZE); - AddDefinesEnumTypeAndMasks(OutEnvironment); OutEnvironment.SetDefine(TEXT("PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16"), uint32(PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16)); } //---------------------------------------------------------------------------- FBillboarderMeshCS::FBillboarderMeshCS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) - : FGlobalShader(Initializer) + : FGlobalShader(Initializer) { OutputMask.Bind(Initializer.ParameterMap, TEXT("OutputMask")); InputMask.Bind(Initializer.ParameterMap, TEXT("InputMask")); @@ -605,6 +195,10 @@ namespace PopcornFXBillboarder FCSRHIParamRef shader = RHICmdList.GetBoundComputeShader(); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + uint32 outputMask = 0; uint32 inputMask = 0; @@ -614,34 +208,77 @@ namespace PopcornFXBillboarder { outputMask |= (1 << i); // if buffer is provided, always set the mask, even if not used (not bound) if (Outputs[i].IsBound()) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, Outputs[i], params.m_Outputs[i]); +#else RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), params.m_Outputs[i]); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } } else if (Outputs[i].IsBound()) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, Outputs[i], null); // avoids D3D11 warnings !? +#else RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), null); // avoids D3D11 warnings !? +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } } - RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), IsValidRef(params.m_InSimData) ? params.m_InSimData : null); for (u32 i = 0; i < EInput::_Count; ++i) { if (params.m_ValidInputs[i]) inputMask |= (1 << i); // if buffer is provided, always set the mask, even if not used (not bound) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, InputsOffsets[i], params.m_InputsOffsets[i]); + SetShaderValue(batchedParameters, InputsDefault[i], _Reinterpret(params.m_InputsDefault[i])); +#else SetShaderValue(RHICmdList, shader, InputsOffsets[i], params.m_InputsOffsets[i]); SetShaderValue(RHICmdList, shader, InputsDefault[i], _Reinterpret(params.m_InputsDefault[i])); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, InSimData, IsValidRef(params.m_InSimData) ? params.m_InSimData : null); + + SetShaderValue(batchedParameters, OutputMask, outputMask); + SetShaderValue(batchedParameters, InputMask, inputMask); + SetShaderValue(batchedParameters, InputOffset, params.m_InputOffset); + SetShaderValue(batchedParameters, OutputVertexOffset, params.m_OutputVertexOffset); + SetShaderValue(batchedParameters, PositionsScale, params.m_PositionsScale); +#else + RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), IsValidRef(params.m_InSimData) ? params.m_InSimData : null); + SetShaderValue(RHICmdList, shader, OutputMask, outputMask); SetShaderValue(RHICmdList, shader, InputMask, inputMask); SetShaderValue(RHICmdList, shader, InputOffset, params.m_InputOffset); SetShaderValue(RHICmdList, shader, OutputVertexOffset, params.m_OutputVertexOffset); SetShaderValue(RHICmdList, shader, PositionsScale, params.m_PositionsScale); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) uint32 hasLiveParticleCount = 0; if (IsValidRef(params.m_LiveParticleCount)) hasLiveParticleCount = 1; + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, HasLiveParticleCount, hasLiveParticleCount); +#else SetShaderValue(RHICmdList, shader, HasLiveParticleCount, hasLiveParticleCount); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) if (IsValidRef(params.m_LiveParticleCount) && LiveParticleCount.IsBound()) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, LiveParticleCount, params.m_LiveParticleCount); +#else RHICmdList.SetShaderResourceViewParameter(shader, LiveParticleCount.GetBaseIndex(), params.m_LiveParticleCount); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.SetBatchedShaderParameters(shader, batchedParameters); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { PK_NAMEDSCOPEDPROFILE("FBillboarderMeshCS::Dispatch"); @@ -649,6 +286,7 @@ namespace PopcornFXBillboarder RHICmdList.DispatchComputeShader(threadGroupCount, 1, 1); } +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) FUAVRHIParamRef nullUAV = FUAVRHIParamRef(); FSRVRHIParamRef nullSRV = FSRVRHIParamRef(); for (u32 i = 0; i < EOutput::_Count; ++i) @@ -657,6 +295,7 @@ namespace PopcornFXBillboarder RHICmdList.SetUAVParameter(shader, Outputs[i].GetBaseIndex(), nullUAV); } RHICmdList.SetShaderResourceViewParameter(shader, InSimData.GetBaseIndex(), nullSRV); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } //---------------------------------------------------------------------------- @@ -669,14 +308,6 @@ namespace PopcornFXBillboarder //---------------------------------------------------------------------------- - //static - void FCopySizeBufferCS::ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment) - { - Super::ModifyCompilationEnvironment(Parameters, OutEnvironment); - } - - //---------------------------------------------------------------------------- - FCopySizeBufferCS::FCopySizeBufferCS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) : FGlobalShader(Initializer) { @@ -699,32 +330,43 @@ namespace PopcornFXBillboarder { FCSRHIParamRef shader = RHICmdList.GetBoundComputeShader(); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); + + SetShaderValue(batchedParameters, InDrawIndirectArgsBufferOffset, params.m_DrawIndirectArgsOffset); + SetShaderValue(batchedParameters, IndexCountPerInstance, params.m_IsCapsule ? 12 : 6); + + SetSRVParameter(batchedParameters, LiveParticleCount, params.m_LiveParticleCount); + SetUAVParameter(batchedParameters, DrawIndirectArgsBuffer, params.m_DrawIndirectArgsBuffer); + + RHICmdList.SetBatchedShaderParameters(shader, batchedParameters); +#else SetShaderValue(RHICmdList, shader, InDrawIndirectArgsBufferOffset, params.m_DrawIndirectArgsOffset); SetShaderValue(RHICmdList, shader, IndexCountPerInstance, params.m_IsCapsule ? 12 : 6); RHICmdList.SetShaderResourceViewParameter(shader, LiveParticleCount.GetBaseIndex(), params.m_LiveParticleCount); RHICmdList.SetUAVParameter(shader, DrawIndirectArgsBuffer.GetBaseIndex(), params.m_DrawIndirectArgsBuffer); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + { PK_NAMEDSCOPEDPROFILE("FCopySizeBufferCS::Dispatch"); RHICmdList.DispatchComputeShader(1, 1, 1); } +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) FSRVRHIParamRef nullSRV = FSRVRHIParamRef(); FUAVRHIParamRef nullUAV = FUAVRHIParamRef(); RHICmdList.SetUAVParameter(shader, DrawIndirectArgsBuffer.GetBaseIndex(), nullUAV); RHICmdList.SetShaderResourceViewParameter(shader, LiveParticleCount.GetBaseIndex(), nullSRV); +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) } } // namespace PopcornFXBillboarder //---------------------------------------------------------------------------- -IMPLEMENT_SHADER_TYPE(template<>, PopcornFXBillboarder::FBillboarderBillboardCS, TEXT(PKUE_GLOBAL_SHADER_PATH("PopcornFXBillboarderBillboardComputeShader")), TEXT("Billboard"), SF_Compute); -IMPLEMENT_SHADER_TYPE(template<>, PopcornFXBillboarder::FBillboarderBillboardCS, TEXT(PKUE_GLOBAL_SHADER_PATH("PopcornFXBillboarderBillboardComputeShader")), TEXT("Billboard"), SF_Compute); - IMPLEMENT_SHADER_TYPE(, PopcornFXBillboarder::FCopySizeBufferCS, TEXT(PKUE_GLOBAL_SHADER_PATH("PopcornFXCopySizeBufferComputeShader")), TEXT("Copy"), SF_Compute); -IMPLEMENT_SHADER_TYPE(, PopcornFXBillboarder::FCopyStreamCS, TEXT(PKUE_GLOBAL_SHADER_PATH("PopcornFXCopyStreamComputeShader")), TEXT("Copy"), SF_Compute); IMPLEMENT_SHADER_TYPE(, PopcornFXBillboarder::FBillboarderMeshCS, TEXT(PKUE_GLOBAL_SHADER_PATH("PopcornFXBillboarderMeshComputeShader")), TEXT("Billboard"), SF_Compute); IMPLEMENT_SHADER_TYPE(, PopcornFXBillboarder::FUAVsClearCS, TEXT(PKUE_GLOBAL_SHADER_PATH("PopcornFXUAVsClearComputeShader")), TEXT("Clear"), SF_Compute); diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.h b/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.h index 4ffb4a2..91b14b6 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.h +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXBillboarderCS.h @@ -23,15 +23,6 @@ #define PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16 1 #define PK_BILLBOARDER_CS_OUTPUT_PACK_TEXCOORD 1 -#define PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(__output, __stride) do { \ - if (__output == PopcornFXBillboarder::EOutput::OutPositions || __output == PopcornFXBillboarder::EOutput::OutNormals || __output == PopcornFXBillboarder::EOutput::OutTangents) \ - PK_ASSERT(__stride == (PK_BILLBOARDER_CS_OUTPUT_PACK_PTN ? 12 : 16)); \ - else if (__output == PopcornFXBillboarder::EOutput::OutColors) \ - PK_ASSERT(__stride == (PK_BILLBOARDER_CS_OUTPUT_PACK_COLOR_F16 ? 8 : 16)); \ - else if (__output == PopcornFXBillboarder::EOutput::OutTexcoords || __output == PopcornFXBillboarder::EOutput::OutTexcoord2s) \ - PK_ASSERT(__stride == (PK_BILLBOARDER_CS_OUTPUT_PACK_TEXCOORD ? 4 : 8)); \ - } while (0) - //---------------------------------------------------------------------------- #if (PK_HAS_GPU != 0) @@ -39,52 +30,13 @@ //---------------------------------------------------------------------------- namespace PopcornFXBillboarder { - -#define EXEC_X_PK_BILLBOARDER_TYPE() \ - X_PK_BILLBOARDER_TYPE(ScreenAligned) \ - X_PK_BILLBOARDER_TYPE(ViewposAligned) \ - X_PK_BILLBOARDER_TYPE(AxisAligned) \ - X_PK_BILLBOARDER_TYPE(AxisAlignedSpheroid) \ - X_PK_BILLBOARDER_TYPE(AxisAlignedCapsule) \ - X_PK_BILLBOARDER_TYPE(PlaneAligned) - - namespace EBillboarder - { - enum Type - { -#define X_PK_BILLBOARDER_TYPE(__type) __type, - EXEC_X_PK_BILLBOARDER_TYPE() -#undef X_PK_BILLBOARDER_TYPE - }; -#define X_PK_BILLBOARDER_TYPE(__type) 1 + - enum { _Count = EXEC_X_PK_BILLBOARDER_TYPE() + 0 }; -#undef X_PK_BILLBOARDER_TYPE - } - - //---------------------------------------------------------------------------- - - EBillboarder::Type BillboarderModeToType(PopcornFX::EBillboardMode mode); - //---------------------------------------------------------------------------- #define EXEC_X_PK_BILLBOARDER_INPUT() \ X_PK_BILLBOARDER_INPUT(InIndices) \ X_PK_BILLBOARDER_INPUT(InPositions) \ - X_PK_BILLBOARDER_INPUT(InColors) \ - X_PK_BILLBOARDER_INPUT(InSizes) \ - X_PK_BILLBOARDER_INPUT(In2Sizes) \ - X_PK_BILLBOARDER_INPUT(InRotations) \ - X_PK_BILLBOARDER_INPUT(InAxis0s) \ - X_PK_BILLBOARDER_INPUT(InAxis1s) \ - X_PK_BILLBOARDER_INPUT(InTextureIds) \ - X_PK_BILLBOARDER_INPUT(InAlphaCursors) \ X_PK_BILLBOARDER_INPUT(InOrientations) \ - X_PK_BILLBOARDER_INPUT(InScales) \ - X_PK_BILLBOARDER_INPUT(InVATCursors) \ - X_PK_BILLBOARDER_INPUT(InDynamicParameter0s) \ - X_PK_BILLBOARDER_INPUT(InDynamicParameter1s) \ - X_PK_BILLBOARDER_INPUT(InDynamicParameter2s) \ - X_PK_BILLBOARDER_INPUT(InDynamicParameter3s) + X_PK_BILLBOARDER_INPUT(InScales) namespace EInput { @@ -99,27 +51,10 @@ namespace PopcornFXBillboarder #undef X_PK_BILLBOARDER_INPUT } - u32 BillboarderTypeMaskMustHaveInputMask(u32 typeMask); - //---------------------------------------------------------------------------- #define EXEC_X_PK_BILLBOARDER_OUTPUT() \ - X_PK_BILLBOARDER_OUTPUT(OutIndicesRaw) \ - X_PK_BILLBOARDER_OUTPUT(OutIndices) \ - X_PK_BILLBOARDER_OUTPUT(OutPositions) \ - X_PK_BILLBOARDER_OUTPUT(OutColors) \ - X_PK_BILLBOARDER_OUTPUT(OutTexcoords) \ - X_PK_BILLBOARDER_OUTPUT(OutTexcoord2s) \ - X_PK_BILLBOARDER_OUTPUT(OutNormals) \ - X_PK_BILLBOARDER_OUTPUT(OutTangents) \ - X_PK_BILLBOARDER_OUTPUT(OutAtlasIDs) \ - X_PK_BILLBOARDER_OUTPUT(OutAlphaCursors) \ - X_PK_BILLBOARDER_OUTPUT(OutMatrices) \ - X_PK_BILLBOARDER_OUTPUT(OutVATCursors) \ - X_PK_BILLBOARDER_OUTPUT(OutDynamicParameter0s) \ - X_PK_BILLBOARDER_OUTPUT(OutDynamicParameter1s) \ - X_PK_BILLBOARDER_OUTPUT(OutDynamicParameter2s) \ - X_PK_BILLBOARDER_OUTPUT(OutDynamicParameter3s) + X_PK_BILLBOARDER_OUTPUT(OutMatrices) namespace EOutput { @@ -136,17 +71,6 @@ namespace PopcornFXBillboarder //---------------------------------------------------------------------------- - namespace ERendererFlag - { - enum - { - FlipV, - SoftAnimationBlending, - }; - } - - //---------------------------------------------------------------------------- - void AddDefinesEnumTypeAndMasks(FShaderCompilerEnvironment& OutEnvironment); //---------------------------------------------------------------------------- @@ -164,10 +88,7 @@ namespace PopcornFXBillboarder void SetUAV(EOutput::Type output, CPooledVertexBuffer &buffer) { if (buffer.Valid()) - { - PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(output, buffer->AllocatedStride()); m_UAVs[output] = buffer->UAV(); - } else m_UAVs[output] = null; } @@ -175,10 +96,7 @@ namespace PopcornFXBillboarder void SetUAV(EOutput::Type output, CPooledIndexBuffer &buffer) { if (buffer.Valid()) - { - PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(output, buffer->AllocatedStride()); m_UAVs[output] = buffer->UAV(); - } else m_UAVs[output] = null; } @@ -220,10 +138,7 @@ namespace PopcornFXBillboarder void SetOutput(EOutput::Type output, bool condition, CPooledVertexBuffer &buffer) { if (condition && PK_VERIFY(buffer.Valid())) - { - PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(output, buffer->AllocatedStride()); m_Outputs[output] = buffer->UAV(); - } else m_Outputs[output] = null; } @@ -231,10 +146,7 @@ namespace PopcornFXBillboarder void SetOutput(EOutput::Type output, bool condition, CPooledIndexBuffer &buffer) { if (condition && PK_VERIFY(buffer.Valid())) - { - PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(output, buffer->AllocatedStride()); m_Outputs[output] = buffer->UAV(); - } else m_Outputs[output] = null; } @@ -242,10 +154,7 @@ namespace PopcornFXBillboarder void SetOutput(EOutput::Type output, CPooledVertexBuffer &buffer) { if (buffer.Valid()) - { - PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(output, buffer->AllocatedStride()); m_Outputs[output] = buffer->UAV(); - } else m_Outputs[output] = null; } @@ -253,10 +162,7 @@ namespace PopcornFXBillboarder void SetOutput(EOutput::Type output, CPooledIndexBuffer &buffer) { if (buffer.Valid()) - { - PK_BILLBOARDER_CS_ASSERT_OUTPUT_STRIDE(output, buffer->AllocatedStride()); m_Outputs[output] = buffer->UAV(); - } else m_Outputs[output] = null; } @@ -320,10 +226,9 @@ namespace PopcornFXBillboarder typedef FGlobalShader Super; static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters); - static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment); FUAVsClearCS(const ShaderMetaType::CompiledShaderInitializerType &Initializer); - FUAVsClearCS(); + FUAVsClearCS() { } void Dispatch(const SUERenderContext &renderContext, FRHICommandList &RHICmdList, const FClearCS_Params ¶ms); public: @@ -334,124 +239,6 @@ namespace PopcornFXBillboarder }; #endif // (PK_GPU_D3D11 != 0) || (PK_GPU_D3D12 != 0) - //---------------------------------------------------------------------------- - // - // Billboard renderer billboarder compute shader - // - //---------------------------------------------------------------------------- - - namespace EBillboarderCSBuild - { - enum Type - { - Std, - VertexPP, - }; - } - - struct FBillboardCS_Params : public FCS_Params - { - uint32 m_BillboarderType = 0; - }; - - struct FBillboarderBillboardCS_Params : public FBillboardCS_Params - { - uint32 m_InIndicesOffset = 0; - uint32 m_OutputIndexOffset = 0; - - CFloat4x4 m_BillboardingMatrix; - - u32 m_RendererFlags = 0; - float m_RendererNormalsBendingFactor = 0.f; - - u32 m_RendererAtlasRectCount = 0; - FShaderResourceViewRHIRef m_RendererAtlasBuffer; - - FBillboarderBillboardCS_Params() - { - m_BillboardingMatrix = CFloat4x4::IDENTITY; - } - }; - - template - class FBillboarderBillboardCS : public FGlobalShader - { - DECLARE_SHADER_TYPE(FBillboarderBillboardCS, Global) - - public: - typedef FGlobalShader Super; - - static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters); - static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment); - - FBillboarderBillboardCS(const ShaderMetaType::CompiledShaderInitializerType &Initializer); - FBillboarderBillboardCS(); - - void Dispatch(FRHICommandList &RHICmdList, const FBillboarderBillboardCS_Params ¶ms); - - public: - LAYOUT_FIELD(FShaderParameter, BillboarderType); - LAYOUT_FIELD(FShaderParameter, OutputMask); - LAYOUT_FIELD(FShaderParameter, InputMask); - LAYOUT_FIELD(FShaderParameter, InIndicesOffset); - LAYOUT_FIELD(FShaderParameter, InputOffset); - LAYOUT_FIELD(FShaderParameter, OutputVertexOffset); - LAYOUT_FIELD(FShaderParameter, OutputIndexOffset); - LAYOUT_FIELD(FShaderParameter, BillboardingMatrix); - LAYOUT_FIELD(FShaderParameter, RendererFlags); - LAYOUT_FIELD(FShaderParameter, RendererNormalsBendingFactor); - LAYOUT_FIELD(FShaderParameter, RendererAtlasRectCount); - LAYOUT_FIELD(FShaderResourceParameter, RendererAtlasBuffer); - LAYOUT_ARRAY(FShaderResourceParameter, Outputs, EOutput::_Count); - LAYOUT_FIELD(FShaderResourceParameter, InIndices); - LAYOUT_FIELD(FShaderResourceParameter, InSimData); - LAYOUT_ARRAY(FShaderParameter, InputsOffsets, EInput::_Count); - LAYOUT_ARRAY(FShaderParameter, InputsDefault, EInput::_Count); - LAYOUT_FIELD(FShaderParameter, HasLiveParticleCount); - LAYOUT_FIELD(FShaderResourceParameter, LiveParticleCount); - }; - - extern template class FBillboarderBillboardCS; - extern template class FBillboarderBillboardCS; - - typedef FBillboarderBillboardCS FBillboarderBillboardCS_Std; - typedef FBillboarderBillboardCS FBillboarderBillboardCS_VPP; - - //---------------------------------------------------------------------------- - // - // Billboard renderer copy streams compute shader - // - //---------------------------------------------------------------------------- - - class FCopyStreamCS : public FGlobalShader - { - DECLARE_SHADER_TYPE(FCopyStreamCS, Global); - - public: - typedef FGlobalShader Super; - - static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters); - static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment); - - FCopyStreamCS(const ShaderMetaType::CompiledShaderInitializerType &Initializer); - FCopyStreamCS(); - - void Dispatch(FRHICommandList &RHICmdList, const FBillboardCS_Params ¶ms); - - public: - LAYOUT_FIELD(FShaderParameter, OutputMask); - LAYOUT_FIELD(FShaderParameter, InputMask); - LAYOUT_FIELD(FShaderParameter, InputOffset); - LAYOUT_FIELD(FShaderParameter, OutputVertexOffset); - LAYOUT_FIELD(FShaderParameter, IsCapsule); - LAYOUT_ARRAY(FShaderResourceParameter, Outputs, EOutput::_Count); - LAYOUT_FIELD(FShaderResourceParameter, InSimData); - LAYOUT_ARRAY(FShaderParameter, InputsOffsets, EInput::_Count); - LAYOUT_ARRAY(FShaderParameter, InputsDefault, EInput::_Count); - LAYOUT_FIELD(FShaderParameter, HasLiveParticleCount); - LAYOUT_FIELD(FShaderResourceParameter, LiveParticleCount); - }; - //---------------------------------------------------------------------------- // // Mesh renderer billboarding compute shader (Build transforms) @@ -493,7 +280,7 @@ namespace PopcornFXBillboarder //---------------------------------------------------------------------------- // - // Billboard renderer copy size buffer + // GPU renderer copy size buffer // //---------------------------------------------------------------------------- @@ -505,7 +292,6 @@ namespace PopcornFXBillboarder typedef FGlobalShader Super; static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters); - static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment); FCopySizeBufferCS(const ShaderMetaType::CompiledShaderInitializerType &Initializer); FCopySizeBufferCS(); diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.cpp index 6d0284c..d377cf8 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.cpp @@ -79,56 +79,6 @@ bool _IsGpuSupportedOnPlatform(const EShaderPlatform &platform) //---------------------------------------------------------------------------- -FShaderResourceViewRHIRef My_RHICreateShaderResourceView(FVBRHIParamRef VertexBufferRHI, uint32 Stride, uint8 Format) -{ -#if (PK_GPU_D3D11 == 1) - if (g_PopcornFXRHIAPI == SUERenderContext::D3D11) - return My_RHICreateShaderResourceView_D3D11(VertexBufferRHI, Stride, Format); -#endif // (PK_GPU_D3D11 == 1) -#if (PK_GPU_D3D12 == 1) - if (g_PopcornFXRHIAPI == SUERenderContext::D3D12) - return RHICreateShaderResourceView(VertexBufferRHI, Stride, Format); -#endif // (PK_GPU_D3D12 == 1) - PK_ASSERT_NOT_REACHED(); - return null; -} - -//---------------------------------------------------------------------------- - -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView(FVBRHIParamRef BufferRHI, uint8 Format) -{ -#if (PK_GPU_D3D11 == 1) - if (g_PopcornFXRHIAPI == SUERenderContext::D3D11) - return My_RHICreateUnorderedAccessView_D3D11(BufferRHI, Format); -#endif // (PK_GPU_D3D11 == 1) -#if (PK_GPU_D3D12 == 1) - if (g_PopcornFXRHIAPI == SUERenderContext::D3D12) - return My_RHICreateUnorderedAccessView_D3D12(BufferRHI, Format); -#endif // (PK_GPU_D3D12 == 1) - PK_ASSERT_NOT_REACHED(); - return null; -} - -//---------------------------------------------------------------------------- - -#if (ENGINE_MAJOR_VERSION == 4) -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView(FIBRHIParamRef IndexBufferRHI, uint8 Format) -{ -#if (PK_GPU_D3D11 == 1) - if (g_PopcornFXRHIAPI == SUERenderContext::D3D11) - return My_RHICreateUnorderedAccessView_D3D11(IndexBufferRHI, Format); -#endif // (PK_GPU_D3D11 == 1) -#if (PK_GPU_D3D12 == 1) - if (g_PopcornFXRHIAPI == SUERenderContext::D3D12) - return My_RHICreateUnorderedAccessView_D3D12(IndexBufferRHI, Format); -#endif // (PK_GPU_D3D12 == 1) - PK_ASSERT_NOT_REACHED(); - return null; -} -#endif // (ENGINE_MAJOR_VERSION == 4) - -//---------------------------------------------------------------------------- - bool StreamBufferByteOffset(const PopcornFX::CParticleStreamToRender_GPU &stream_GPU, PopcornFX::CGuid streamId, u32 &streamOffset) { PK_ASSERT(streamId.Valid()); diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.h b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.h index 79bee9e..f96d511 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.h +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim.h @@ -38,17 +38,6 @@ void SetupPopcornFXRHIAPI(uint32 API); - // RHICreateShaderResourceView + handles Byte Access Buffers - FShaderResourceViewRHIRef My_RHICreateShaderResourceView(FVBRHIParamRef VertexBufferRHI, uint32 Stride, uint8 Format); - - // RHICreateUnorderedAccessView - FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView(FVBRHIParamRef VertexBufferRHI, uint8 Format); - -#if (ENGINE_MAJOR_VERSION == 4) - // RHICreateUnorderedAccessView for index buffers - FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView(FIBRHIParamRef IndexBufferRHI, uint8 Format); -#endif // (ENGINE_MAJOR_VERSION == 4) - template FShaderResourceViewRHIRef StreamBufferSRVToRHI(const PopcornFX::CParticleStreamToRender &stream_GPU, PopcornFX::CGuid streamId, PopcornFX::CGuid &offset); diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.cpp index 39f737c..d6d9240 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.cpp @@ -47,199 +47,15 @@ DECLARE_LOG_CATEGORY_EXTERN(LogD3D11RHI, Log, All); #if WITH_EDITOR -// FIX EDITOR BUILD -void UpdateBufferStats(TRefCountPtr Buffer, bool bAllocating) { } -#endif // WITH_EDITOR - -//---------------------------------------------------------------------------- -#define DEPTH_32_BIT_CONVERSION 0 - -// Engine\Source\Runtime\Windows\D3D11RHI\Private\D3D11RHIPrivate.h -/** Find an appropriate DXGI format for the input format and SRGB setting. */ -inline static DXGI_FORMAT My_FindShaderResourceDXGIFormat(DXGI_FORMAT InFormat, bool bSRGB) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +FD3D11Buffer::~FD3D11Buffer() { - if (bSRGB) - { - switch (InFormat) - { - case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; - case DXGI_FORMAT_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; - case DXGI_FORMAT_BC1_TYPELESS: return DXGI_FORMAT_BC1_UNORM_SRGB; - case DXGI_FORMAT_BC2_TYPELESS: return DXGI_FORMAT_BC2_UNORM_SRGB; - case DXGI_FORMAT_BC3_TYPELESS: return DXGI_FORMAT_BC3_UNORM_SRGB; - case DXGI_FORMAT_BC7_TYPELESS: return DXGI_FORMAT_BC7_UNORM_SRGB; - }; - } - else - { - switch (InFormat) - { - case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM; - case DXGI_FORMAT_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_UNORM; - case DXGI_FORMAT_BC1_TYPELESS: return DXGI_FORMAT_BC1_UNORM; - case DXGI_FORMAT_BC2_TYPELESS: return DXGI_FORMAT_BC2_UNORM; - case DXGI_FORMAT_BC3_TYPELESS: return DXGI_FORMAT_BC3_UNORM; - case DXGI_FORMAT_BC7_TYPELESS: return DXGI_FORMAT_BC7_UNORM; - }; - } - switch (InFormat) - { - case DXGI_FORMAT_R24G8_TYPELESS: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; - case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_R32_FLOAT; - case DXGI_FORMAT_R16_TYPELESS: return DXGI_FORMAT_R16_UNORM; -#if DEPTH_32_BIT_CONVERSION - // Changing Depth Buffers to 32 bit on Dingo as D24S8 is actually implemented as a 32 bit buffer in the hardware - case DXGI_FORMAT_R32G8X24_TYPELESS: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS; -#endif - } - return InFormat; } - -//---------------------------------------------------------------------------- - -// Source/Runtime/Windows/D3D11RHI/Private/D3D11UAV.cpp -// -// Creates a ***Raw Byte Address*** SRV -// -FShaderResourceViewRHIRef My_RHICreateShaderResourceView_D3D11(FVBRHIParamRef /*Vertex*/BufferRHI, u32 Stride, u8 Format) -{ -#if (ENGINE_MAJOR_VERSION == 5) - FD3D11Buffer *VertexBuffer = (FD3D11Buffer*)/*Vertex*/BufferRHI; #else - FD3D11VertexBuffer *VertexBuffer = (FD3D11VertexBuffer*)/*Vertex*/BufferRHI; -#endif // (ENGINE_MAJOR_VERSION == 5) - check(VertexBuffer); - check(VertexBuffer->Resource); - - D3D11_BUFFER_DESC BufferDesc; - VertexBuffer->Resource->GetDesc(&BufferDesc); - - const bool bByteAccessBuffer = (BufferDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS) != 0; - - // Create a Shader Resource View - D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc; - PopcornFX::Mem::Clear(SRVDesc); - - if (bByteAccessBuffer) - { - SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX; - SRVDesc.BufferEx.NumElements = BufferDesc.ByteWidth / 4; - SRVDesc.BufferEx.FirstElement = 0; - SRVDesc.BufferEx.Flags = D3D11_BUFFEREX_SRV_FLAG_RAW; - SRVDesc.Format = DXGI_FORMAT_R32_TYPELESS; - } - else - { - SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; - SRVDesc.Buffer.FirstElement = 0; - - SRVDesc.Format = My_FindShaderResourceDXGIFormat((DXGI_FORMAT)GPixelFormats[Format].PlatformFormat, false); - SRVDesc.Buffer.NumElements = BufferDesc.ByteWidth / Stride; - } - - TRefCountPtr ShaderResourceView; - - // - ID3D11Device *Direct3DDevice = (ID3D11Device*)RHIGetNativeDevice(); - // - - HRESULT hr = Direct3DDevice->CreateShaderResourceView(VertexBuffer->Resource, &SRVDesc, (ID3D11ShaderResourceView**)ShaderResourceView.GetInitReference()); - if (FAILED(hr)) - { - if (hr == E_OUTOFMEMORY) - { - // There appears to be a driver bug that causes SRV creation to fail with an OOM error and then succeed on the next call. - hr = Direct3DDevice->CreateShaderResourceView(VertexBuffer->Resource, &SRVDesc, (ID3D11ShaderResourceView**)ShaderResourceView.GetInitReference()); - } - if (FAILED(hr)) - { - //UE_LOG(LogD3D11RHI, Error, TEXT("Failed to create shader resource view for vertex buffer: ByteWidth=%d NumElements=%d"), BufferDesc.ByteWidth, BufferDesc.ByteWidth / Stride); - //VerifyD3D11Result(hr, "Direct3DDevice->CreateShaderResourceView", __FILE__, __LINE__, Direct3DDevice); - PK_ASSERT_NOT_REACHED(); - } - } - -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) - return new FD3D11ShaderResourceView(ShaderResourceView, VertexBuffer, VertexBuffer); -#else - return new FD3D11ShaderResourceView(ShaderResourceView, VertexBuffer); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) -} - -//---------------------------------------------------------------------------- - -// Source/Runtime/Windows/D3D11RHI/Private/D3D11RHIPrivate.h -inline static DXGI_FORMAT My_FindUnorderedAccessDXGIFormat(DXGI_FORMAT InFormat) -{ - switch (InFormat) - { - case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM; - case DXGI_FORMAT_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_UNORM; - } - return InFormat; -} +void UpdateBufferStats(TRefCountPtr Buffer, bool bAllocating) { } +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) -//---------------------------------------------------------------------------- - -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D11(FVBRHIParamRef /*Vertex*/BufferRHI, u8 Format) -{ - return RHICreateUnorderedAccessView(BufferRHI, Format); -} - -//---------------------------------------------------------------------------- - -#if (ENGINE_MAJOR_VERSION == 4) -// Source/Runtime/Windows/D3D11RHI/Private/D3D11UAV.cpp -// -// UAV from Index Buffer -// -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D11(FIBRHIParamRef /*Index*/BufferRHI, u8 Format) -{ - PK_ASSERT(IsValidRef(/*Index*/BufferRHI)); - -#if (ENGINE_MAJOR_VERSION == 5) - FD3D11Buffer *IndexBuffer = (FD3D11Buffer*)/*Index*/BufferRHI; -#else - FD3D11IndexBuffer *IndexBuffer = (FD3D11IndexBuffer*)/*Index*/BufferRHI; -#endif // (ENGINE_MAJOR_VERSION == 5) - - D3D11_BUFFER_DESC BufferDesc; - IndexBuffer->Resource->GetDesc(&BufferDesc); - - const bool bByteAccessBuffer = (BufferDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS) != 0; - - D3D11_UNORDERED_ACCESS_VIEW_DESC UAVDesc; - UAVDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; - UAVDesc.Format = My_FindUnorderedAccessDXGIFormat((DXGI_FORMAT)GPixelFormats[Format].PlatformFormat); - UAVDesc.Buffer.FirstElement = 0; - - UAVDesc.Buffer.NumElements = BufferDesc.ByteWidth / GPixelFormats[Format].BlockBytes; - UAVDesc.Buffer.Flags = 0; - - // It seems UE does not enable RAW_VIEWS on IndexBuffer (for now ?) - // If this assert Pops up, Great ! just change the shader: - // from "RWBuffer OutIndices;" - // to "RWByteAddressBuffer OutIndices;" with the code that depends on that - PK_ASSERT(!bByteAccessBuffer); - if (bByteAccessBuffer) - { - UAVDesc.Buffer.Flags |= D3D11_BUFFER_UAV_FLAG_RAW; - UAVDesc.Format = DXGI_FORMAT_R32_TYPELESS; - } - - // - ID3D11Device *Direct3DDevice = (ID3D11Device*)RHIGetNativeDevice(); - // - - TRefCountPtr UnorderedAccessView; - //VERIFYD3D11RESULT(Direct3DDevice->CreateUnorderedAccessView(IndexBuffer->Resource, &UAVDesc, (ID3D11UnorderedAccessView**)UnorderedAccessView.GetInitReference())); - HRESULT hr = Direct3DDevice->CreateUnorderedAccessView(IndexBuffer->Resource, &UAVDesc, (ID3D11UnorderedAccessView**)UnorderedAccessView.GetInitReference()); - - PK_ASSERT(!FAILED(hr)); - - return new FD3D11UnorderedAccessView(UnorderedAccessView, IndexBuffer); -} -#endif // (ENGINE_MAJOR_VERSION == 4) +#endif // WITH_EDITOR //---------------------------------------------------------------------------- // @@ -249,28 +65,25 @@ FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D11(FIBRHIParamRef FShaderResourceViewRHIRef StreamBufferSRVToRHI(const PopcornFX::SParticleStreamBuffer_D3D11 *stream, u32 bytes, u32 stride, u8 pixelFormat) { +#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3) + FRHICommandListBase &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); +#endif + #if (ENGINE_MAJOR_VERSION == 5) FD3D11Buffer *buffer = static_cast(StreamBufferResourceToRHI(stream, bytes, stride)); #else FD3D11VertexBuffer *buffer = static_cast(StreamBufferResourceToRHI(stream, bytes, stride)); #endif // (ENGINE_MAJOR_VERSION == 5) - if (pixelFormat == PF_Unknown) - { - // Create RHI SRV wrapper from SRV already available -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) - FD3D11ShaderResourceView* srv = new FD3D11ShaderResourceView(stream->m_BufferSRV, buffer, buffer); + check(pixelFormat != PF_Unknown); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + return RHICmdList.CreateShaderResourceView(buffer, FRHIViewDesc::CreateBufferSRV() + .SetTypeFromBuffer(buffer) + .SetStride(stride)); #else - FD3D11ShaderResourceView* srv = new FD3D11ShaderResourceView(stream->m_BufferSRV, buffer); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) - PK_ASSERT(_PopcornFXD3DGetRefCount(*(srv->View)) > 1); // Referenced here and by PopcornFX - return srv; - } - else - { - // Create a new SRV from resource - return RHICreateShaderResourceView(buffer, stride, pixelFormat); - } + // Create a new SRV from resource + return RHICreateShaderResourceView(buffer, stride, pixelFormat); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } //---------------------------------------------------------------------------- @@ -291,7 +104,9 @@ FRHIVertexBuffer *StreamBufferResourceToRHI(const PopcornFX::SParticleStreamB PK_ASSERT((desc.CPUAccessFlags) == 0); // no BUF_AnyDynamic const EBufferUsageFlags bufferUsage = BUF_UnorderedAccess | BUF_ByteAddressBuffer | BUF_ShaderResource; -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FD3D11Buffer *buffer = new FD3D11Buffer(stream->m_Buffer, FRHIBufferDesc(bytes, stride, bufferUsage)); +#elif (ENGINE_MAJOR_VERSION == 5) FD3D11Buffer *buffer = new FD3D11Buffer(stream->m_Buffer, bytes, bufferUsage, stride); #else FD3D11VertexBuffer *buffer = new FD3D11VertexBuffer(stream->m_Buffer, bytes, bufferUsage); diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.h b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.h index 0536985..bfbe6fb 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.h +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D11.h @@ -17,13 +17,7 @@ struct SParticleStreamBuffer_D3D11; class CParticleStreamToRender_D3D11; FWD_PK_API_END -FShaderResourceViewRHIRef My_RHICreateShaderResourceView_D3D11(FVBRHIParamRef VertexBufferRHI, u32 Stride, uint8 Format); -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D11(FVBRHIParamRef VertexBufferRHI, u8 Format); -#if (ENGINE_MAJOR_VERSION == 4) -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D11(FIBRHIParamRef IndexBufferRHI, u8 Format); -#endif // (ENGINE_MAJOR_VERSION == 4) - -FShaderResourceViewRHIRef StreamBufferSRVToRHI(const PopcornFX::SParticleStreamBuffer_D3D11 *stream, u32 bytes, u32 stride, u8 pixelFormat = PF_Unknown); +FShaderResourceViewRHIRef StreamBufferSRVToRHI(const PopcornFX::SParticleStreamBuffer_D3D11 *stream, u32 bytes, u32 stride, u8 pixelFormat = PF_R32_FLOAT); #if (ENGINE_MAJOR_VERSION == 5) FRHIBuffer *StreamBufferResourceToRHI(const PopcornFX::SParticleStreamBuffer_D3D11 *stream, u32 bytes, u32 stride); #else diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp index 18e6bbe..d40df6f 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp @@ -170,7 +170,11 @@ FD3D12Resource::FD3D12Resource(FD3D12Device* ParentDevice, #if (ENGINE_MAJOR_VERSION == 5) , Desc(InDesc) , HeapType(InHeapType) +# if (ENGINE_MINOR_VERSION >= 3) + , PlaneCount(UE::DXGIUtilities::GetPlaneCount(Desc.Format)) +# else , PlaneCount(::GetPlaneCount(Desc.Format)) +# endif , bRequiresResourceStateTracking(true) , bDepthStencil(false) , bDeferDelete(true) @@ -281,13 +285,7 @@ ID3D12Device* FD3D12Device::GetDevice() //---------------------------------------------------------------------------- -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D12(FVBRHIParamRef VertexBufferRHI, uint8 Format) -{ - return RHICreateUnorderedAccessView(VertexBufferRHI, Format); -} - -//---------------------------------------------------------------------------- - +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MAJOR_VERSION < 3) // Source/Runtime/D3D12RHI/Private/D3D12UAV.cpp template @@ -303,55 +301,7 @@ inline FD3D12UnorderedAccessView* CreateUAV(D3D12_UNORDERED_ACCESS_VIEW_DESC& De return new FD3D12UnorderedAccessView(Device, Desc, Resource->ResourceLocation, CounterResource); }); } - -//---------------------------------------------------------------------------- - -#if (ENGINE_MAJOR_VERSION == 4) -// -// UAV from Index Buffer -// -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D12(FIBRHIParamRef /*Index*/BufferRHI, uint8 Format) -{ -#if (ENGINE_MAJOR_VERSION == 5) - FD3D12Buffer* IndexBuffer = FD3D12DynamicRHI::ResourceCast(/*Index*/BufferRHI); -#else - FD3D12IndexBuffer* IndexBuffer = FD3D12DynamicRHI::ResourceCast(/*Index*/BufferRHI); -#endif // (ENGINE_MAJOR_VERSION == 5) - FD3D12ResourceLocation& Location = IndexBuffer->ResourceLocation; - - const D3D12_RESOURCE_DESC& BufferDesc = Location.GetResource()->GetDesc(); - const uint64 effectiveBufferSize = Location.GetSize(); - - const uint32 BufferUsage = IndexBuffer->GetUsage(); - const bool bByteAccessBuffer = (BufferUsage & BUF_ByteAddressBuffer) != 0; - - D3D12_UNORDERED_ACCESS_VIEW_DESC UAVDesc = {}; - UAVDesc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER; - UAVDesc.Format = FindUnorderedAccessDXGIFormat((DXGI_FORMAT)GPixelFormats[Format].PlatformFormat); - UAVDesc.Buffer.FirstElement = Location.GetOffsetFromBaseOfResource(); - - UAVDesc.Buffer.NumElements = effectiveBufferSize / GPixelFormats[Format].BlockBytes; - UAVDesc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_NONE; - UAVDesc.Buffer.CounterOffsetInBytes = 0; - UAVDesc.Buffer.StructureByteStride = 0; - - if (bByteAccessBuffer) - { - UAVDesc.Buffer.Flags |= D3D12_BUFFER_UAV_FLAG_RAW; - UAVDesc.Format = DXGI_FORMAT_R32_TYPELESS; - UAVDesc.Buffer.NumElements = effectiveBufferSize / 4; - UAVDesc.Buffer.FirstElement /= 4; - } - - else - { - UAVDesc.Buffer.NumElements = effectiveBufferSize / GPixelFormats[Format].BlockBytes; - UAVDesc.Buffer.FirstElement /= GPixelFormats[Format].BlockBytes; - } - - return CreateUAV(UAVDesc, IndexBuffer); -} -#endif // (ENGINE_MAJOR_VERSION == 4) +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MAJOR_VERSION < 3) //---------------------------------------------------------------------------- // @@ -370,8 +320,13 @@ FShaderResourceViewRHIRef StreamBufferSRVToRHI(const PopcornFX::SParticleStreamB #endif // (ENGINE_MAJOR_VERSION == 5) PK_ASSERT(bufferD3D12 != null); - FShaderResourceViewRHIRef srv = RHICreateShaderResourceView(bufferD3D12, sizeof(uint32), pixelFormat); - return srv; + +#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3) + FRHICommandListBase &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); + return RHICmdList.CreateShaderResourceView(bufferD3D12, sizeof(uint32), pixelFormat); +#else + return RHICreateShaderResourceView(bufferD3D12, sizeof(uint32), pixelFormat); +#endif } //---------------------------------------------------------------------------- @@ -405,7 +360,11 @@ FRHIVertexBuffer *StreamBufferResourceToRHI(const PopcornFX::SParticleStreamBuff #if (ENGINE_MAJOR_VERSION == 5) FD3D12Buffer *buffer = adapter->CreateLinkedObject(device->GetVisibilityMask(), [&](FD3D12Device* device) { +#if (ENGINE_MINOR_VERSION >= 3) + FD3D12Buffer *newBuffer = new FD3D12Buffer(device, FRHIBufferDesc(stream->m_ByteSize, stride, bufferUsage)); +#else FD3D12Buffer *newBuffer = new FD3D12Buffer(device, stream->m_ByteSize, bufferUsage, stride); +#endif // (ENGINE_MINOR_VERSION >= 3) return newBuffer; }); #else diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.h b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.h index e6dc330..2d98658 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.h +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.h @@ -17,12 +17,6 @@ struct SParticleStreamBuffer_D3D12; class CParticleStreamToRender_D3D12; FWD_PK_API_END -FShaderResourceViewRHIRef My_RHICreateShaderResourceView_D3D12(FVBRHIParamRef VertexBufferRHI, uint32 Stride, uint8 Format); -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D12(FVBRHIParamRef VertexBufferRHI, uint8 Format); -#if (ENGINE_MAJOR_VERSION == 4) -FUnorderedAccessViewRHIRef My_RHICreateUnorderedAccessView_D3D12(FIBRHIParamRef IndexBufferRHI, uint8 Format); -#endif // (ENGINE_MAJOR_VERSION == 4) - FShaderResourceViewRHIRef StreamBufferSRVToRHI(const PopcornFX::SParticleStreamBuffer_D3D12 *stream, u32 stride, u8 pixelFormat = PF_R32_FLOAT); #if (ENGINE_MAJOR_VERSION == 5) FRHIBuffer *StreamBufferResourceToRHI(const PopcornFX::SParticleStreamBuffer_D3D12 *stream, u32 stride); diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp index ce94ca7..ef45719 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp @@ -258,29 +258,57 @@ void FPopcornFXSortComputeShader_Sorter::DispatchGenIndiceBatch(FRHICommandList& PK_ASSERT(params.m_Count > 0); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3) SetComputePipelineState(RHICmdList, shader); #else RHICmdList.SetComputeShader(shader); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3) + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); +#endif if (PK_VERIFY(genKeys->InPositions.IsBound()) && PK_VERIFY(IsValidRef(params.m_InputPositions))) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, genKeys->InPositions, params.m_InputPositions); +#else RHICmdList.SetShaderResourceViewParameter(shader, genKeys->InPositions.GetBaseIndex(), params.m_InputPositions); - SetShaderValue(RHICmdList, shader, genKeys->InPositionsOffset, params.m_InputPositionsOffset); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } if (PK_VERIFY(genKeys->OutKeys.IsBound())) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, m_Keys[m_CurrBuff]->UAV()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, genKeys->OutKeys, m_Keys[m_CurrBuff]->UAV()); +#else RHICmdList.SetUAVParameter(shader, genKeys->OutKeys.GetBaseIndex(), m_Keys[m_CurrBuff]->UAV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } if (PK_VERIFY(genKeys->OutValues.IsBound())) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, m_Values[m_CurrBuff]->UAV()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, genKeys->OutValues, m_Values[m_CurrBuff]->UAV()); +#else RHICmdList.SetUAVParameter(shader, genKeys->OutValues.GetBaseIndex(), m_Values[m_CurrBuff]->UAV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, genKeys->InPositionsOffset, params.m_InputPositionsOffset); + + SetShaderValue(batchedParameters, genKeys->TotalCount, params.m_Count); + SetShaderValue(batchedParameters, genKeys->SortOrigin, ToUE(params.m_SortOrigin)); + SetShaderValue(batchedParameters, genKeys->IndexStart, params.m_IndexStart); + SetShaderValue(batchedParameters, genKeys->IndexStep, params.m_IndexStep); + SetShaderValue(batchedParameters, genKeys->InputOffset, params.m_InputOffset); + + SetShaderValue(batchedParameters, genKeys->OutputOffset, m_CurrGenOutputOffset); +#else + SetShaderValue(RHICmdList, shader, genKeys->InPositionsOffset, params.m_InputPositionsOffset); + SetShaderValue(RHICmdList, shader, genKeys->TotalCount, params.m_Count); SetShaderValue(RHICmdList, shader, genKeys->SortOrigin, ToUE(params.m_SortOrigin)); SetShaderValue(RHICmdList, shader, genKeys->IndexStart, params.m_IndexStart); @@ -288,9 +316,14 @@ void FPopcornFXSortComputeShader_Sorter::DispatchGenIndiceBatch(FRHICommandList& SetShaderValue(RHICmdList, shader, genKeys->InputOffset, params.m_InputOffset); SetShaderValue(RHICmdList, shader, genKeys->OutputOffset, m_CurrGenOutputOffset); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) m_CurrGenOutputOffset += params.m_Count; PK_ASSERT(m_CurrGenOutputOffset <= m_TotalCount); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.SetBatchedShaderParameters(shader, batchedParameters); +#endif + { const uint32 threadGroupCount = PopcornFX::Mem::Align(params.m_Count, CS_SORT_THREADGROUP_SIZE) / CS_SORT_THREADGROUP_SIZE; RHICmdList.DispatchComputeShader(threadGroupCount, 1, 1); @@ -301,18 +334,24 @@ void FPopcornFXSortComputeShader_Sorter::DispatchGenIndiceBatch(FRHICommandList& if (genKeys->OutValues.IsBound()) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::EReadable, EResourceTransitionPipeline::EComputeToCompute, m_Keys[m_CurrBuff]->UAV()); +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) RHICmdList.SetUAVParameter(shader, genKeys->OutValues.GetBaseIndex(), nullUAV); +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) } if (genKeys->OutKeys.IsBound()) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::EReadable, EResourceTransitionPipeline::EComputeToCompute, m_Values[m_CurrBuff]->UAV()); +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) RHICmdList.SetUAVParameter(shader, genKeys->OutKeys.GetBaseIndex(), nullUAV); +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) } if (genKeys->InPositions.IsBound()) + { +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) RHICmdList.SetShaderResourceViewParameter(shader, genKeys->InPositions.GetBaseIndex(), nullSRV); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } } //---------------------------------------------------------------------------- @@ -342,6 +381,10 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis FUAVRHIParamRef nullUAV = FUAVRHIParamRef(); FSRVRHIParamRef nullSRV = FSRVRHIParamRef(); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); +#endif + for (u32 bitOffset = 0; bitOffset < 16; bitOffset += 1) { //---------------------------------------------------------------------------- @@ -354,20 +397,38 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis #endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) if (PK_VERIFY(upSweep->InKeys.IsBound())) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, upSweep->InKeys, m_Keys[m_CurrBuff]->SRV()); +#else RHICmdList.SetShaderResourceViewParameter(upSweepShader, upSweep->InKeys.GetBaseIndex(), m_Keys[m_CurrBuff]->SRV()); +#endif (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } if (PK_VERIFY(upSweep->OutOffsets.IsBound())) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, m_Cache->UAV()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, upSweep->OutOffsets, m_Cache->UAV()); +#else RHICmdList.SetUAVParameter(upSweepShader, upSweep->OutOffsets.GetBaseIndex(), m_Cache->UAV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, upSweep->KeyBitOffset, bitOffset); +#else SetShaderValue(RHICmdList, upSweepShader, upSweep->KeyBitOffset, bitOffset); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.SetBatchedShaderParameters(upSweepShader, batchedParameters); +#endif { SCOPED_DRAW_EVENT(RHICmdList, PopcornFXSortComputeShader_Sorter_Sort_UpSweep); RHICmdList.DispatchComputeShader(threadGroupCount, 1, 1); } +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) if (upSweep->InKeys.IsBound()) RHICmdList.SetShaderResourceViewParameter(upSweepShader, upSweep->InKeys.GetBaseIndex(), nullSRV); if (upSweep->OutOffsets.IsBound()) @@ -375,6 +436,7 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis //RHICmdList.TransitionResource(EResourceTransitionAccess::EReadable, EResourceTransitionPipeline::EComputeToCompute, m_Cache->UAV()); RHICmdList.SetUAVParameter(upSweepShader, upSweep->OutOffsets.GetBaseIndex(), nullUAV); } +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) //---------------------------------------------------------------------------- // Up Sweep Offsets @@ -386,22 +448,35 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis if (PK_VERIFY(upSweepOffsets->InOutOffsets.IsBound())) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, m_Cache->UAV()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, upSweepOffsets->InOutOffsets, m_Cache->UAV()); +#else RHICmdList.SetUAVParameter(upSweepOffsetsShader, upSweepOffsets->InOutOffsets.GetBaseIndex(), m_Cache->UAV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, upSweepOffsets->GroupCount, threadGroupCount); +#else SetShaderValue(RHICmdList, upSweepOffsetsShader, upSweepOffsets->GroupCount, threadGroupCount); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.SetBatchedShaderParameters(upSweepOffsetsShader, batchedParameters); +#endif { SCOPED_DRAW_EVENT(RHICmdList, PopcornFXSortComputeShader_Sorter_Sort_UpSweepOffsets); RHICmdList.DispatchComputeShader(1, 1, 1); } +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) if (upSweepOffsets->InOutOffsets.IsBound()) { //RHICmdList.TransitionResource(EResourceTransitionAccess::EReadable, EResourceTransitionPipeline::EComputeToCompute, m_Cache->UAV()); RHICmdList.SetUAVParameter(upSweepOffsetsShader, upSweepOffsets->InOutOffsets.GetBaseIndex(), nullUAV); } +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) //---------------------------------------------------------------------------- // Down Sweep @@ -412,34 +487,68 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis #endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) if (PK_VERIFY(downSweep->InOffsets.IsBound())) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, downSweep->InOffsets, m_Cache->SRV()); +#else RHICmdList.SetShaderResourceViewParameter(downSweepShader, downSweep->InOffsets.GetBaseIndex(), m_Cache->SRV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } if (PK_VERIFY(downSweep->InKeys.IsBound())) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, downSweep->InKeys, m_Keys[m_CurrBuff]->SRV()); +#else RHICmdList.SetShaderResourceViewParameter(downSweepShader, downSweep->InKeys.GetBaseIndex(), m_Keys[m_CurrBuff]->SRV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } if (PK_VERIFY(downSweep->InValues.IsBound())) + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetSRVParameter(batchedParameters, downSweep->InValues, m_Values[m_CurrBuff]->SRV()); +#else RHICmdList.SetShaderResourceViewParameter(downSweepShader, downSweep->InValues.GetBaseIndex(), m_Values[m_CurrBuff]->SRV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } m_CurrBuff = (m_CurrBuff + 1) % PK_ARRAY_COUNT(m_Keys); if (PK_VERIFY(downSweep->OutKeys.IsBound())) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, m_Keys[m_CurrBuff]->UAV()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, downSweep->OutKeys, m_Keys[m_CurrBuff]->UAV()); +#else RHICmdList.SetUAVParameter(downSweepShader, downSweep->OutKeys.GetBaseIndex(), m_Keys[m_CurrBuff]->UAV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } if (PK_VERIFY(downSweep->OutValues.IsBound())) { - //RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EComputeToCompute, m_Values[m_CurrBuff]->UAV()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetUAVParameter(batchedParameters, downSweep->OutValues, m_Values[m_CurrBuff]->UAV()); +#else RHICmdList.SetUAVParameter(downSweepShader, downSweep->OutValues.GetBaseIndex(), m_Values[m_CurrBuff]->UAV()); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + SetShaderValue(batchedParameters, downSweep->KeyBitOffset, bitOffset); + SetShaderValue(batchedParameters, downSweep->GroupCount, threadGroupCount); +#else SetShaderValue(RHICmdList, downSweepShader, downSweep->KeyBitOffset, bitOffset); SetShaderValue(RHICmdList, downSweepShader, downSweep->GroupCount, threadGroupCount); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.SetBatchedShaderParameters(downSweepShader, batchedParameters); +#endif { SCOPED_DRAW_EVENT(RHICmdList, PopcornFXSortComputeShader_Sorter_Sort_DownSweep); RHICmdList.DispatchComputeShader(threadGroupCount, 1, 1); } +#if (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) if (downSweep->InOffsets.IsBound()) RHICmdList.SetShaderResourceViewParameter(downSweepShader, downSweep->InOffsets.GetBaseIndex(), nullSRV); if (downSweep->InKeys.IsBound()) @@ -456,6 +565,7 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis //RHICmdList.TransitionResource(EResourceTransitionAccess::EReadable, EResourceTransitionPipeline::EComputeToCompute, m_Values[m_CurrBuff]->UAV()); RHICmdList.SetUAVParameter(downSweepShader, downSweep->OutValues.GetBaseIndex(), nullUAV); } +#endif // (ENGINE_MAJOR_VERSION != 5) || (ENGINE_MINOR_VERSION < 3) } } diff --git a/Source/PopcornFX/Private/Internal/ParticleScene.cpp b/Source/PopcornFX/Private/Internal/ParticleScene.cpp index 408bbb3..6e454e6 100644 --- a/Source/PopcornFX/Private/Internal/ParticleScene.cpp +++ b/Source/PopcornFX/Private/Internal/ParticleScene.cpp @@ -231,12 +231,12 @@ bool CParticleScene::InternalSetup(const UPopcornFXSceneComponent *sceneComp) SUERenderContext::ERHIAPI API = SUERenderContext::_Unsupported; #define PK_NEW_UPDATER_IFN(__name) \ - m_Enable ## __name = FModuleManager::Get().IsModuleLoaded(PK_STRINGIFY(__name) "RHI") && hardwareDetails.Contains(PK_STRINGIFY(__name)); \ - if (m_Enable ## __name) \ + m_Enable##__name = FModuleManager::Get().IsModuleLoaded(PK_STRINGIFY(__name) "RHI") && hardwareDetails.Contains(PK_STRINGIFY(__name)); \ + if (m_Enable##__name) \ { \ PK_ASSERT(updateManager == null); \ - updateManager = PopcornFX::CParticleUpdateManager_Auto::New(PopcornFX::Context ## __name); \ - API = SUERenderContext:: ## __name; \ + updateManager = PopcornFX::CParticleUpdateManager_Auto::New(PopcornFX::Context##__name); \ + API = SUERenderContext::__name; \ } \ # if (PK_GPU_D3D11 == 1) @@ -2157,8 +2157,17 @@ static void _D3D11_ExecuteImmTasksArray(CParticleScene *self) if (self->m_D3D11_DummyResource == null) { check(self->m_D3D11_DummyView == null); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + self->m_D3D11_DummyResource = new FRHIBuffer(FRHIBufferDesc()); + self->m_D3D11_DummyResource->AddRef(); + + FRHIViewDesc viewDesc; + viewDesc.Common.ViewType = FRHIViewDesc::EViewType::BufferUAV; + self->m_D3D11_DummyView = new FRHIUnorderedAccessView(self->m_D3D11_DummyResource, viewDesc); +#else self->m_D3D11_DummyResource = new FRHIBuffer(); self->m_D3D11_DummyView = new FRHIUnorderedAccessView(self->m_D3D11_DummyResource); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } RHICmdList.Transition(FRHITransitionInfo(self->m_D3D11_DummyView, ERHIAccess::UAVGraphics, ERHIAccess::UAVCompute)); #else @@ -2205,13 +2214,18 @@ void CParticleScene::D3D11_Destroy() // GPU_Destroy() } } #if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) - if (m_D3D11_DummyResource != null) + if (m_D3D11_DummyResource != null && m_D3D11_DummyView != null) { - check(m_D3D11_DummyView != null); - m_D3D11_DummyResource->Delete(); - m_D3D11_DummyResource = null; + // Delete view, release resource for proper ref count tracking. m_D3D11_DummyView->Delete(); + m_D3D11_DummyResource->Release(); m_D3D11_DummyView = null; + m_D3D11_DummyResource = null; + } + else + { + check(m_D3D11_DummyResource == null); + check(m_D3D11_DummyView == null); } #endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) m_D3D11_DeferedContext = null; diff --git a/Source/PopcornFX/Private/Internal/ResourceHandlerImage_UE.cpp b/Source/PopcornFX/Private/Internal/ResourceHandlerImage_UE.cpp index 9cdb810..319dd0e 100644 --- a/Source/PopcornFX/Private/Internal/ResourceHandlerImage_UE.cpp +++ b/Source/PopcornFX/Private/Internal/ResourceHandlerImage_UE.cpp @@ -253,7 +253,7 @@ PopcornFX::CImage *CResourceHandlerImage_UE::NewFromPath(const PopcornFX::CStrin const FText title = FText::FromString(FString("PopcornFX: Texture used for sampling")); const FText message = FText::Format(FText::FromString(FString("Texture \"{0}\" is used for CPU sampling so its LOD Group will be set to 'ColorLookupTable'.\n")), FText::FromString(texture->GetPathName())); - FMessageDialog::Open(EAppMsgType::Ok, message, &title); + OpenMessageBox(EAppMsgType::Ok, message, title); { texture->Modify(); texture->MipGenSettings = TMGS_NoMipmaps; diff --git a/Source/PopcornFX/Private/PopcornFXHelper.cpp b/Source/PopcornFX/Private/PopcornFXHelper.cpp index dbb9151..b745fba 100644 --- a/Source/PopcornFX/Private/PopcornFXHelper.cpp +++ b/Source/PopcornFX/Private/PopcornFXHelper.cpp @@ -7,6 +7,9 @@ #include "PopcornFXSDK.h" #include +#if WITH_EDITOR +# include "Misc/MessageDialog.h" +#endif static const TCHAR *kHumanStr[] = { TEXT(" "), TEXT("k"), TEXT("m"), TEXT("g"), TEXT("t") @@ -33,3 +36,14 @@ const TCHAR *HumanReadS(float v, u32 base) } return kHumanStr[i]; } + +#if WITH_EDITOR +EAppReturnType::Type OpenMessageBox(EAppMsgType::Type messageType, const FText& message, const FText& title) +{ +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + return FMessageDialog::Open(messageType, message, title); +#else + return FMessageDialog::Open(messageType, message, &title); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +} +#endif diff --git a/Source/PopcornFX/Private/PopcornFXHelper.h b/Source/PopcornFX/Private/PopcornFXHelper.h index 5a25a60..3eb748c 100644 --- a/Source/PopcornFX/Private/PopcornFXHelper.h +++ b/Source/PopcornFX/Private/PopcornFXHelper.h @@ -96,3 +96,7 @@ PK_FORCEINLINE CFloat3 &ToPkRef(FVector3f &vec) float HumanReadF(float v, u32 base = 1024); const TCHAR *HumanReadS(float v, u32 base = 1024); static inline float SafeRcp(float v) { return v == 0.f ? 0.f : 1.f / v; } + +#if WITH_EDITOR +EAppReturnType::Type OpenMessageBox(EAppMsgType::Type MessageType, const FText& Message, const FText& Title); +#endif diff --git a/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp b/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp index 778c75a..2720a03 100644 --- a/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp +++ b/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp @@ -427,7 +427,7 @@ bool UPopcornFXSettingsEditor::AskForAValidSourcePackForIFN(const FString &sourc "\n" "Continue anyway ?\n"), FText::FromString(sourceAssetPath), FText::FromString(SourcePackRootDir)); - return FMessageDialog::Open(EAppMsgType::YesNo, msg, &title) == EAppReturnType::Yes; + return OpenMessageBox(EAppMsgType::YesNo, msg, title) == EAppReturnType::Yes; } return true; } @@ -476,7 +476,7 @@ bool UPopcornFXSettingsEditor::AskForAValidSourcePackForIFN(const FString &sourc LOCTEXT("PopcornFXSourcePackFoundMsg", "Source PopcornFX Project found and saved.\n\nProject Settings > PopcornFX > Source PopcornFX Project path\n\nis now {0}\n"), FText::FromString(ImportSourcePack)); - FMessageDialog::Open(EAppMsgType::Ok, text, &title); + OpenMessageBox(EAppMsgType::Ok, text, title); SaveConfig(); // Force save return true; @@ -500,7 +500,7 @@ bool UPopcornFXSettingsEditor::AskForAValidSourcePackForIFN(const FString &sourc Project Settings > PopcornFX > Source PopcornFX Project path\n\ \n\ Continue anyway ?\n"); - return FMessageDialog::Open(EAppMsgType::YesNo, msg, &title) == EAppReturnType::Yes; + return OpenMessageBox(EAppMsgType::YesNo, msg, title) == EAppReturnType::Yes; } return false; } diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp index 96247ab..aa59c0a 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp @@ -678,7 +678,11 @@ void CBatchDrawer_Billboard_CPUBB::_IssueDrawCall_Billboard(const SUERenderConte vertexFactory->m_BillboardCommonUniformBuffer = FPopcornFXBillboardCommonUniformsRef::CreateUniformBufferImmediate(commonUniformsBillboard, UniformBuffer_SingleDraw); PK_ASSERT(!vertexFactory->IsInitialized()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + vertexFactory->InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else vertexFactory->InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } if (!PK_VERIFY(vertexFactory->IsInitialized())) diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp index 863a130..a2b8003 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp @@ -59,6 +59,10 @@ bool FPopcornFXAtlasRectsVertexBuffer::_LoadRects(const PopcornFX::TMemoryView= 3) + FRHICommandListImmediate &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); +#endif + if (empty || bytes > m_AtlasBufferCapacity) { m_AtlasBufferCapacity = PopcornFX::Mem::Align<0x100>(bytes + 0x10); @@ -70,12 +74,16 @@ bool FPopcornFXAtlasRectsVertexBuffer::_LoadRects(const PopcornFX::TMemoryView= 3) + m_AtlasBuffer_Raw = RHICmdList.CreateVertexBuffer(m_AtlasBufferCapacity, usage, info); + m_AtlasBufferSRV = RHICmdList.CreateShaderResourceView(m_AtlasBuffer_Raw, sizeof(CFloat4), PF_A32B32G32R32F); +#else m_AtlasBuffer_Raw = RHICreateVertexBuffer(m_AtlasBufferCapacity, usage, info); - if (!PK_VERIFY(IsValidRef(m_AtlasBuffer_Raw))) - return false; m_AtlasBufferSRV = RHICreateShaderResourceView(m_AtlasBuffer_Raw, sizeof(CFloat4), PF_A32B32G32R32F); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) - if (!PK_VERIFY(IsValidRef(m_AtlasBufferSRV))) + if (!PK_VERIFY(IsValidRef(m_AtlasBuffer_Raw)) || + !PK_VERIFY(IsValidRef(m_AtlasBufferSRV))) return false; } else @@ -83,19 +91,25 @@ bool FPopcornFXAtlasRectsVertexBuffer::_LoadRects(const PopcornFX::TMemoryView= 3) + void *map = RHICmdList.LockBuffer(m_AtlasBuffer_Raw, 0, bytes, RLM_WriteOnly); +#elif (ENGINE_MAJOR_VERSION == 5) void *map = RHILockBuffer(m_AtlasBuffer_Raw, 0, bytes, RLM_WriteOnly); #else void *map = RHILockVertexBuffer(m_AtlasBuffer_Raw, 0, bytes, RLM_WriteOnly); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) if (!PK_VERIFY(map != null)) return false; + PopcornFX::Mem::Copy(map, rects.Data(), bytes); -#if (ENGINE_MAJOR_VERSION == 5) + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.UnlockBuffer(m_AtlasBuffer_Raw); +#elif (ENGINE_MAJOR_VERSION == 5) RHIUnlockBuffer(m_AtlasBuffer_Raw); #else RHIUnlockVertexBuffer(m_AtlasBuffer_Raw); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) m_AtlasRectsCount = rects.Count(); return true; @@ -119,19 +133,18 @@ bool FPopcornFXDrawRequestsBuffer::LoadIFN() #endif // (ENGINE_MAJOR_VERSION == 5) const EBufferUsageFlags usage = BUF_Dynamic | BUF_ShaderResource; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListImmediate &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); + m_DrawRequestsBuffer = RHICmdList.CreateVertexBuffer(totalByteCount, usage, info); + m_DrawRequestsBufferSRV = RHICmdList.CreateShaderResourceView(m_DrawRequestsBuffer, sizeof(PopcornFX::Drawers::SBillboardDrawRequest), PF_A32B32G32R32F); +#else m_DrawRequestsBuffer = RHICreateVertexBuffer(totalByteCount, usage, info); - if (!PK_VERIFY(IsValidRef(m_DrawRequestsBuffer))) - { - UE_LOG(LogVertexBillboardingPolicy, Error, TEXT("Couldn't create draw requests structured buffer")); - return false; - } m_DrawRequestsBufferSRV = RHICreateShaderResourceView(m_DrawRequestsBuffer, sizeof(PopcornFX::Drawers::SBillboardDrawRequest), PF_A32B32G32R32F); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) - if (!PK_VERIFY(IsValidRef(m_DrawRequestsBufferSRV))) - { - UE_LOG(LogVertexBillboardingPolicy, Error, TEXT("Invalid draw requests structured buffer ref")); + if (!PK_VERIFY(IsValidRef(m_DrawRequestsBuffer)) || + !PK_VERIFY(IsValidRef(m_DrawRequestsBufferSRV))) return false; - } } else { @@ -157,11 +170,13 @@ bool FPopcornFXDrawRequestsBuffer::Map(PopcornFX::TMemoryView= 3) + void *mappedBuffer = FRHICommandListExecutor::GetImmediateCommandList().LockBuffer(m_DrawRequestsBuffer, 0, totalByteCount, RLM_WriteOnly); +#elif (ENGINE_MAJOR_VERSION == 5) void *mappedBuffer = RHILockBuffer(m_DrawRequestsBuffer, 0, totalByteCount, RLM_WriteOnly); #else void *mappedBuffer = RHILockVertexBuffer(m_DrawRequestsBuffer, 0, totalByteCount, RLM_WriteOnly); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) if (!PK_VERIFY(mappedBuffer != null)) { outView.Clear(); @@ -179,11 +194,13 @@ void FPopcornFXDrawRequestsBuffer::Unmap() if (m_Mapped) { m_Mapped = false; -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListExecutor::GetImmediateCommandList().UnlockBuffer(m_DrawRequestsBuffer); +#elif (ENGINE_MAJOR_VERSION == 5) RHIUnlockBuffer(m_DrawRequestsBuffer); #else RHIUnlockVertexBuffer(m_DrawRequestsBuffer); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } } @@ -197,7 +214,6 @@ class FPopcornFXGPUBillboardCollector : public FOneFrameResource { public: FPopcornFXGPUVertexFactory *m_VertexFactory = null; - // CPooledIndexBuffer m_IndexBufferForRefCount; FPopcornFXGPUBillboardCollector() { } ~FPopcornFXGPUBillboardCollector() @@ -220,19 +236,26 @@ class FPopcornFXGPUBillboardCollector : public FOneFrameResource class FPopcornFXGPUParticlesIndexBuffer : public FIndexBuffer { public: +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override +#else virtual void InitRHI() override +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { const uint32 sizeInBytes = sizeof(u16) * 12; const uint32 stride = sizeof(u16); FRHIResourceCreateInfo info(TEXT("PopcornFXGPUParticlesIndexBuffer")); void *data = null; -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + IndexBufferRHI = RHICmdList.CreateBuffer(sizeInBytes, BUF_Static | BUF_IndexBuffer, stride, ERHIAccess::VertexOrIndexBuffer, info); + data = RHICmdList.LockBuffer(IndexBufferRHI, 0, sizeInBytes, RLM_WriteOnly); +#elif (ENGINE_MAJOR_VERSION == 5) IndexBufferRHI = RHICreateBuffer(sizeInBytes, BUF_Static | BUF_IndexBuffer, stride, ERHIAccess::VertexOrIndexBuffer, info); data = RHILockBuffer(IndexBufferRHI, 0, sizeInBytes, RLM_WriteOnly); #else IndexBufferRHI = RHICreateAndLockIndexBuffer(stride, sizeInBytes, BUF_Static, info, data); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) u16* indices = (u16*)data; @@ -249,11 +272,13 @@ class FPopcornFXGPUParticlesIndexBuffer : public FIndexBuffer indices[10] = 4; indices[11] = 2; -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.UnlockBuffer(IndexBufferRHI); +#elif (ENGINE_MAJOR_VERSION == 5) RHIUnlockBuffer(IndexBufferRHI); #else RHIUnlockIndexBuffer(IndexBufferRHI); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } }; @@ -499,11 +524,13 @@ bool CBatchDrawer_Billboard_GPUBB::AllocBuffers(PopcornFX::SRenderContext &ctx, if (IsRayTracingEnabled() && !m_RTBuffers_Initialized) { // Will be resized if necessary -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_RayTracingDynamicVertexBuffer.Initialize(FRHICommandListExecutor::GetImmediateCommandList(), TEXT("PopcornFXRayTracingDynamicVertexBuffer"), 4, 256, PF_R32_FLOAT, BUF_UnorderedAccess | BUF_ShaderResource); +#elif (ENGINE_MAJOR_VERSION == 5) m_RayTracingDynamicVertexBuffer.Initialize(TEXT("PopcornFXRayTracingDynamicVertexBuffer"), 4, 256, PF_R32_FLOAT, BUF_UnorderedAccess | BUF_ShaderResource); #else m_RayTracingDynamicVertexBuffer.Initialize(4, 256, PF_R32_FLOAT, BUF_UnorderedAccess | BUF_ShaderResource, TEXT("RayTracingDynamicVertexBuffer")); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) FRayTracingGeometryInitializer initializer; initializer.IndexBuffer = null; @@ -512,7 +539,11 @@ bool CBatchDrawer_Billboard_GPUBB::AllocBuffers(PopcornFX::SRenderContext &ctx, initializer.bAllowUpdate = false; // fully dynamic geom m_RayTracingGeometry.SetInitializer(initializer); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_RayTracingGeometry.InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else m_RayTracingGeometry.InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) m_RTBuffers_Initialized = true; } @@ -535,11 +566,13 @@ bool CBatchDrawer_Billboard_GPUBB::AllocBuffers(PopcornFX::SRenderContext &ctx, m_DrawIndirectArgsCapacity = drawPass.m_DrawRequests.Count(); // One per draw request m_DrawIndirectBuffer.Release(); -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_DrawIndirectBuffer.Initialize(FRHICommandListExecutor::GetImmediateCommandList(), TEXT("PopcornFXGPUDrawIndirectArgs"), sizeof(u32), m_DrawIndirectArgsCapacity * POPCORNFX_INDIRECT_ARGS_ARG_COUNT, EPixelFormat::PF_R32_UINT, BUF_Static | BUF_DrawIndirect); +#elif (ENGINE_MAJOR_VERSION == 5) m_DrawIndirectBuffer.Initialize(TEXT("PopcornFXGPUDrawIndirectArgs"), sizeof(u32), m_DrawIndirectArgsCapacity * POPCORNFX_INDIRECT_ARGS_ARG_COUNT, EPixelFormat::PF_R32_UINT, BUF_Static | BUF_DrawIndirect); #else m_DrawIndirectBuffer.Initialize(sizeof(u32), m_DrawIndirectArgsCapacity * POPCORNFX_INDIRECT_ARGS_ARG_COUNT, EPixelFormat::PF_R32_UINT, BUF_Static | BUF_DrawIndirect, TEXT("PopcornFXGPUDrawIndirectArgs")); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } // TODO: Sort for gpu particles if (drawPass.m_IsNewFrame || @@ -1172,7 +1205,11 @@ void CBatchDrawer_Billboard_GPUBB::_IssueDrawCall_Billboard(const SUERenderConte vertexFactory->m_GPUBillboardVSUniformBuffer = FPopcornFXGPUBillboardVSUniformsRef::CreateUniformBufferImmediate(vsUniformsGPUBillboard, UniformBuffer_SingleFrame); PK_ASSERT(!vertexFactory->IsInitialized()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + vertexFactory->InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else vertexFactory->InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } if (!PK_VERIFY(vertexFactory->IsInitialized())) diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Mesh_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Mesh_CPU.cpp index bcb1502..0350f18 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Mesh_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Mesh_CPU.cpp @@ -493,7 +493,12 @@ void CBatchDrawer_Mesh_CPUBB::_CreateMeshVertexFactory( const CMaterialDesc_Rend outFactory->m_VSUniformBuffer = FPopcornFXUniformsRef::CreateUniformBufferImmediate(vsUniforms, UniformBuffer_SingleFrame); outFactory->m_MeshVSUniformBuffer = FPopcornFXMeshVSUniformsRef::CreateUniformBufferImmediate(vsUniformsMesh, UniformBuffer_SingleFrame); PK_ASSERT(!outFactory->IsInitialized()); + +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + outFactory->InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else outFactory->InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } } diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp index 4bb5893..cf58de3 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp @@ -715,7 +715,11 @@ void CBatchDrawer_Ribbon_CPUBB::_IssueDrawCall_Ribbon(const SUERenderContext &re vertexFactory->m_BillboardCommonUniformBuffer = FPopcornFXBillboardCommonUniformsRef::CreateUniformBufferImmediate(commonUniformsBillboard, UniformBuffer_SingleDraw); PK_ASSERT(!vertexFactory->IsInitialized()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + vertexFactory->InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else vertexFactory->InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } if (!PK_VERIFY(vertexFactory->IsInitialized())) diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp index 7933b8a..1a76ed3 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp @@ -292,7 +292,12 @@ bool CBatchDrawer_SkeletalMesh_CPUBB::AllocBuffers(PopcornFX::SRenderContext &ct m_BoneMatrices.Release(); m_PreviousBoneMatrices.Release(); -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListImmediate &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); + m_BoneMatrices.Initialize(RHICmdList, TEXT("PopcornFXBoneMatrices"), sizeof(PopcornFX::CFloat4), m_BoneMatricesCapacity, EPixelFormat::PF_A32B32G32R32F, BUF_UnorderedAccess | BUF_ShaderResource); + if (m_MotionBlur) + m_PreviousBoneMatrices.Initialize(RHICmdList, TEXT("PopcornFXPreviousBoneMatrices"), sizeof(PopcornFX::CFloat4), m_BoneMatricesCapacity, EPixelFormat::PF_A32B32G32R32F, BUF_UnorderedAccess | BUF_ShaderResource); +#elif (ENGINE_MAJOR_VERSION == 5) m_BoneMatrices.Initialize(TEXT("PopcornFXBoneMatrices"), sizeof(PopcornFX::CFloat4), m_BoneMatricesCapacity, EPixelFormat::PF_A32B32G32R32F, BUF_UnorderedAccess | BUF_ShaderResource); if (m_MotionBlur) m_PreviousBoneMatrices.Initialize(TEXT("PopcornFXPreviousBoneMatrices"), sizeof(PopcornFX::CFloat4), m_BoneMatricesCapacity, EPixelFormat::PF_A32B32G32R32F, BUF_UnorderedAccess | BUF_ShaderResource); @@ -300,7 +305,7 @@ bool CBatchDrawer_SkeletalMesh_CPUBB::AllocBuffers(PopcornFX::SRenderContext &ct m_BoneMatrices.Initialize(sizeof(PopcornFX::CFloat4), m_BoneMatricesCapacity, EPixelFormat::PF_A32B32G32R32F, BUF_UnorderedAccess | BUF_ShaderResource, TEXT("PopcornFXBoneMatrices")); if (m_MotionBlur) m_PreviousBoneMatrices.Initialize(sizeof(PopcornFX::CFloat4), m_BoneMatricesCapacity, EPixelFormat::PF_A32B32G32R32F, BUF_UnorderedAccess | BUF_ShaderResource, TEXT("PopcornFXPreviousBoneMatrices")); -#endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } #endif // (PK_PREBUILD_BONE_TRANSFORMS != 0) @@ -633,7 +638,11 @@ void CBatchDrawer_SkeletalMesh_CPUBB::_CreateSkelMeshVertexFactory( CMaterialDes outFactory->m_VSUniformBuffer = FPopcornFXUniformsRef::CreateUniformBufferImmediate(vsUniforms, UniformBuffer_SingleFrame); outFactory->m_SkelMeshVSUniformBuffer = FPopcornFXSkelMeshUniformsRef::CreateUniformBufferImmediate(uniformsSkelMesh, UniformBuffer_SingleFrame); PK_ASSERT(!outFactory->IsInitialized()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + outFactory->InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else outFactory->InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } } diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp index 021df9c..c8138da 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp @@ -589,7 +589,11 @@ void CBatchDrawer_Triangle_CPUBB::_IssueDrawCall_Triangle(const SUERenderContext vertexFactory->m_BillboardCommonUniformBuffer = FPopcornFXBillboardCommonUniformsRef::CreateUniformBufferImmediate(commonUniformsBillboard, UniformBuffer_SingleDraw); PK_ASSERT(!vertexFactory->IsInitialized()); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + vertexFactory->InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else vertexFactory->InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } if (!PK_VERIFY(vertexFactory->IsInitialized())) diff --git a/Source/PopcornFX/Private/Render/MaterialDesc.cpp b/Source/PopcornFX/Private/Render/MaterialDesc.cpp index ad02b63..740ec39 100644 --- a/Source/PopcornFX/Private/Render/MaterialDesc.cpp +++ b/Source/PopcornFX/Private/Render/MaterialDesc.cpp @@ -590,7 +590,11 @@ bool CMaterialDesc_RenderThread::SetupFromGame(const CMaterialDesc_GameThread &g dstSegment.bEnabled = srcSegment.bEnabled; m_RayTracingGeometries[iSection].SetInitializer(initializer); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_RayTracingGeometries[iSection].InitResource(FRHICommandListExecutor::GetImmediateCommandList()); +#else m_RayTracingGeometries[iSection].InitResource(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } } } diff --git a/Source/PopcornFX/Private/Render/PopcornFXBuffer.cpp b/Source/PopcornFX/Private/Render/PopcornFXBuffer.cpp index a26a5e2..00e9627 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXBuffer.cpp +++ b/Source/PopcornFX/Private/Render/PopcornFXBuffer.cpp @@ -25,7 +25,11 @@ void FPopcornFXVertexBuffer::ReleaseRHI() //---------------------------------------------------------------------------- +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +void FPopcornFXVertexBuffer::InitRHI(FRHICommandListBase &RHICmdList) +#else void FPopcornFXVertexBuffer::InitRHI() +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { m_UAV = null; m_SRV = null; @@ -49,7 +53,11 @@ void FPopcornFXVertexBuffer::InitRHI() } else usage |= BUF_Dynamic; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + VertexBufferRHI = RHICmdList.CreateVertexBuffer(m_CapacityInBytes, usage, emptyInformations); +#else VertexBufferRHI = RHICreateVertexBuffer(m_CapacityInBytes, usage, emptyInformations); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) if (!PK_VERIFY(IsValidRef(VertexBufferRHI))) m_CapacityInBytes = 0; } @@ -84,10 +92,18 @@ bool FPopcornFXVertexBuffer::HardResize(u32 sizeInBytes) PK_ASSERT(m_CapacityInBytes == 0); const u32 capacity = PopcornFX::Mem::Align(sizeInBytes); m_CapacityInBytes = capacity; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListImmediate &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); + if (!IsInitialized()) + InitResource(RHICmdList); + else + UpdateRHI(RHICmdList); +#else if (!IsInitialized()) InitResource(); else UpdateRHI(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) return m_CapacityInBytes == capacity; } @@ -112,7 +128,9 @@ void *FPopcornFXVertexBuffer::RawMap(u32 count, u32 stride) void *map; { PK_NAMEDSCOPEDPROFILE("FPopcornFXVertexBuffer::RawMap RHILockVertexBuffer"); -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + map = FRHICommandListExecutor::GetImmediateCommandList().LockBuffer(VertexBufferRHI, 0, sizeToMap, RLM_WriteOnly); +#elif (ENGINE_MAJOR_VERSION == 5) map = RHILockBuffer(VertexBufferRHI, 0, sizeToMap, RLM_WriteOnly); #else map = RHILockVertexBuffer(VertexBufferRHI, 0, sizeToMap, RLM_WriteOnly); @@ -130,7 +148,9 @@ void FPopcornFXVertexBuffer::Unmap() { if (Mappable() && Mapped()) { -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListExecutor::GetImmediateCommandList().UnlockBuffer(VertexBufferRHI); +#elif (ENGINE_MAJOR_VERSION == 5) RHIUnlockBuffer(VertexBufferRHI); #else RHIUnlockVertexBuffer(VertexBufferRHI); @@ -147,7 +167,11 @@ const FUnorderedAccessViewRHIRef &FPopcornFXVertexBuffer::UAV() PK_ASSERT(UsedAsUAV()); if (!IsValidRef(m_UAV)) { - m_UAV = /*My_*/RHICreateUnorderedAccessView(VertexBufferRHI, PF_R32_UINT); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_UAV = FRHICommandListExecutor::GetImmediateCommandList().CreateUnorderedAccessView(VertexBufferRHI, PF_R32_UINT); +#else + m_UAV = RHICreateUnorderedAccessView(VertexBufferRHI, PF_R32_UINT); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } PK_ASSERT(IsValidRef(m_UAV)); #else @@ -163,7 +187,11 @@ const FShaderResourceViewRHIRef &FPopcornFXVertexBuffer::SRV() PK_ASSERT(UsedAsSRV()); if (!IsValidRef(m_SRV)) { - m_SRV = /*My_*/RHICreateShaderResourceView(VertexBufferRHI, sizeof(u32), PF_R32_UINT); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_SRV = FRHICommandListExecutor::GetImmediateCommandList().CreateShaderResourceView(VertexBufferRHI, sizeof(u32), PF_R32_UINT); +#else + m_SRV = RHICreateShaderResourceView(VertexBufferRHI, sizeof(u32), PF_R32_UINT); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } PK_ASSERT(IsValidRef(m_SRV)); return m_SRV; @@ -186,7 +214,11 @@ void FPopcornFXIndexBuffer::ReleaseRHI() //---------------------------------------------------------------------------- +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +void FPopcornFXIndexBuffer::InitRHI(FRHICommandListBase &RHICmdList) +#else void FPopcornFXIndexBuffer::InitRHI() +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { m_UAV = null; m_SRV = null; @@ -215,7 +247,11 @@ void FPopcornFXIndexBuffer::InitRHI() } else usage |= BUF_Dynamic; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + IndexBufferRHI = RHICmdList.CreateIndexBuffer(Stride(), m_Capacity * Stride(), usage, emptyInformations); +#else IndexBufferRHI = RHICreateIndexBuffer(Stride(), m_Capacity * Stride(), usage, emptyInformations); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) if (!PK_VERIFY(IsValidRef(IndexBufferRHI))) { m_Capacity = 0; @@ -255,10 +291,18 @@ bool FPopcornFXIndexBuffer::HardResize(u32 count) return false; const u32 capacity = PopcornFX::Mem::Align(count); m_Capacity = capacity; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListImmediate &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); + if (!IsInitialized()) + InitResource(RHICmdList); + else + UpdateRHI(RHICmdList); +#else if (!IsInitialized()) InitResource(); else UpdateRHI(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) return m_Capacity == capacity; } @@ -281,7 +325,9 @@ void *FPopcornFXIndexBuffer::RawMap(u32 countToMap) void *map; { PK_NAMEDSCOPEDPROFILE("FPopcornFXIndexBuffer::RawMap RHILockBuffer"); -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + map = FRHICommandListExecutor::GetImmediateCommandList().LockBuffer(IndexBufferRHI, 0, sizeToMap, RLM_WriteOnly); +#elif (ENGINE_MAJOR_VERSION == 5) map = RHILockBuffer(IndexBufferRHI, 0, sizeToMap, RLM_WriteOnly); #else map = RHILockIndexBuffer(IndexBufferRHI, 0, sizeToMap, RLM_WriteOnly); @@ -299,7 +345,9 @@ void FPopcornFXIndexBuffer::Unmap() { if (Mappable() && Mapped()) { -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHICommandListExecutor::GetImmediateCommandList().UnlockBuffer(IndexBufferRHI); +#elif (ENGINE_MAJOR_VERSION == 5) RHIUnlockBuffer(IndexBufferRHI); #else RHIUnlockIndexBuffer(IndexBufferRHI); @@ -315,7 +363,13 @@ const FUnorderedAccessViewRHIRef &FPopcornFXIndexBuffer::UAV() #if (PK_HAS_GPU != 0) PK_ASSERT(UsedAsUAV()); if (!IsValidRef(m_UAV)) - m_UAV = /*My_*/RHICreateUnorderedAccessView(IndexBufferRHI, PF_R32_UINT); + { +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_UAV = FRHICommandListExecutor::GetImmediateCommandList().CreateUnorderedAccessView(IndexBufferRHI, PF_R32_UINT); +#else + m_UAV = RHICreateUnorderedAccessView(IndexBufferRHI, PF_R32_UINT); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + } PK_ASSERT(IsValidRef(m_UAV)); #else PK_ASSERT_NOT_REACHED(); diff --git a/Source/PopcornFX/Private/Render/PopcornFXBuffer.h b/Source/PopcornFX/Private/Render/PopcornFXBuffer.h index c4b0625..7284756 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXBuffer.h +++ b/Source/PopcornFX/Private/Render/PopcornFXBuffer.h @@ -87,8 +87,12 @@ class FPopcornFXVertexBuffer : public FVertexBuffer const FShaderResourceViewRHIRef &SRV(); protected: - virtual void ReleaseRHI() override; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override; +#else virtual void InitRHI() override; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void ReleaseRHI() override; private: @@ -119,8 +123,12 @@ class FPopcornFXIndexBuffer : public FIndexBuffer : m_Capacity(0), m_Flags(0), m_AllocatedCount(0), m_CurrentMap(null) { } - virtual void ReleaseRHI() override; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override; +#else virtual void InitRHI() override; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void ReleaseRHI() override; bool Large() const { return m_Flags & Flag_Large; } u32 Stride() const { return Large() ? sizeof(u32) : sizeof(u16); } diff --git a/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.cpp b/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.cpp index 5973a6d..ac727ae 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.cpp +++ b/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.cpp @@ -169,7 +169,11 @@ class FPopcornFXVertexDeclaration : public FRenderResource FPopcornFXVertexDeclaration() {} virtual ~FPopcornFXVertexDeclaration() {} +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override +#else virtual void InitDynamicRHI() override +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { FVertexDeclarationElementList vDecl; @@ -177,7 +181,11 @@ class FPopcornFXVertexDeclaration : public FRenderResource VertexDeclarationRHI = PipelineStateCache::GetOrCreateVertexDeclaration(vDecl); } +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void ReleaseRHI() override +#else virtual void ReleaseDynamicRHI() override +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { VertexDeclarationRHI.SafeRelease(); } @@ -193,13 +201,20 @@ static TGlobalResource GPopcornFXBillboardsParticl class FPopcornFXGPUParticlesTexCoordVertexBuffer : public FVertexBuffer { public: +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override +#else virtual void InitRHI() override +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { const u32 sizeInBytes = sizeof(CFloat2) * 6; FRHIResourceCreateInfo info(TEXT("PopcornFX Texcoords buffer")); void *data = null; -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + VertexBufferRHI = RHICmdList.CreateBuffer(sizeInBytes, BUF_Static | BUF_VertexBuffer, sizeof(CFloat2), ERHIAccess::VertexOrIndexBuffer, info); + data = RHICmdList.LockBuffer(VertexBufferRHI, 0, sizeInBytes, RLM_WriteOnly); +#elif (ENGINE_MAJOR_VERSION == 5) VertexBufferRHI = RHICreateBuffer(sizeInBytes, BUF_Static | BUF_VertexBuffer, sizeof(CFloat2), ERHIAccess::VertexOrIndexBuffer, info); data = RHILockBuffer(VertexBufferRHI, 0, sizeInBytes, RLM_WriteOnly); #else @@ -215,7 +230,9 @@ class FPopcornFXGPUParticlesTexCoordVertexBuffer : public FVertexBuffer vertices[4] = CFloat2(0.0f, 2.0f); // Capsule up vertices[5] = CFloat2(0.0f, -2.0f); // Capsule down -#if (ENGINE_MAJOR_VERSION == 5) +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + RHICmdList.UnlockBuffer(VertexBufferRHI); +#elif (ENGINE_MAJOR_VERSION == 5) RHIUnlockBuffer(VertexBufferRHI); #else RHIUnlockVertexBuffer(VertexBufferRHI); @@ -227,7 +244,11 @@ TGlobalResource GPopcornFXGPUParticl //---------------------------------------------------------------------------- +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +void FPopcornFXGPUVertexFactory::InitRHI(FRHICommandListBase &RHICmdList) +#else void FPopcornFXGPUVertexFactory::InitRHI() +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { const bool bInstanced = true; // Supported everyone since 4.25 diff --git a/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.h b/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.h index 0098951..b9a80b6 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.h +++ b/Source/PopcornFX/Private/Render/PopcornFXGPUVertexFactory.h @@ -69,7 +69,11 @@ class FPopcornFXGPUVertexFactory : public FVertexFactory static bool IsCompatible(UMaterialInterface *material); /** FRenderResource interface */ +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override; +#else virtual void InitRHI() override; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) /** Does the vertex factory supports tesselation shaders */ static bool SupportsTessellationShaders() { return false; } diff --git a/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.cpp b/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.cpp index 87a44a6..e7a53c2 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.cpp +++ b/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.cpp @@ -96,12 +96,20 @@ void FPopcornFXMeshVertexFactory::SetData(const FDataType& InData) { check(IsInRenderingThread()); Data = InData; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + UpdateRHI(FRHICommandListExecutor::GetImmediateCommandList()); +#else UpdateRHI(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } //---------------------------------------------------------------------------- +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +void FPopcornFXMeshVertexFactory::InitRHI(FRHICommandListBase &RHICmdList) +#else void FPopcornFXMeshVertexFactory::InitRHI() +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { FVertexDeclarationElementList Elements; diff --git a/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.h b/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.h index 2d579ca..6f660d2 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.h +++ b/Source/PopcornFX/Private/Render/PopcornFXMeshVertexFactory.h @@ -62,7 +62,11 @@ class FPopcornFXMeshVertexFactory : public FVertexFactory static bool ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters& Parameters); static bool IsCompatible(UMaterialInterface *material); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override; +#else virtual void InitRHI() override; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) void SetData(const FDataType& InData); static void ModifyCompilationEnvironment(const FVertexFactoryShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment); diff --git a/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.cpp b/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.cpp index 2ac2a04..88793f2 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.cpp +++ b/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.cpp @@ -131,12 +131,25 @@ void FPopcornFXComputeBoneTransformsCS::Dispatch(FRHICommandList& RHICmdList, co { FCSRHIParamRef shader = RHICmdList.GetBoundComputeShader(); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); + + SetShaderValue(batchedParameters, TotalParticleCount, params.m_TotalParticleCount); + SetShaderValue(batchedParameters, TotalBoneCount, params.m_TotalBoneCount); + + SetUniformBufferParameter(batchedParameters, GetUniformBufferParameter(), params.m_UniformBuffer); + SetUniformBufferParameter(batchedParameters, GetUniformBufferParameter(), params.m_MeshUniformBuffer); + SetUAVParameter(batchedParameters, BoneMatrices, params.m_BoneMatrices); + + RHICmdList.SetBatchedShaderParameters(shader, batchedParameters); +#else SetShaderValue(RHICmdList, shader, TotalParticleCount, params.m_TotalParticleCount); SetShaderValue(RHICmdList, shader, TotalBoneCount, params.m_TotalBoneCount); SetUniformBufferParameter(RHICmdList, shader, GetUniformBufferParameter(), params.m_UniformBuffer); SetUniformBufferParameter(RHICmdList, shader, GetUniformBufferParameter(), params.m_MeshUniformBuffer); SetUAVParameter(RHICmdList, shader, BoneMatrices, params.m_BoneMatrices); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { PK_NAMEDSCOPEDPROFILE("FPopcornFXComputeBoneTransformsCS::Dispatch"); @@ -182,6 +195,18 @@ void FPopcornFXComputeMBBoneTransformsCS::Dispatch(FRHICommandList& RHICmdList, { FCSRHIParamRef shader = RHICmdList.GetBoundComputeShader(); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + FRHIBatchedShaderParameters &batchedParameters = RHICmdList.GetScratchShaderParameters(); + + SetShaderValue(batchedParameters, TotalParticleCount, params.m_TotalParticleCount); + SetShaderValue(batchedParameters, TotalBoneCount, params.m_TotalBoneCount); + + SetUniformBufferParameter(batchedParameters, GetUniformBufferParameter(), params.m_UniformBuffer); + SetUniformBufferParameter(batchedParameters, GetUniformBufferParameter(), params.m_MeshUniformBuffer); + SetUAVParameter(batchedParameters, BoneMatrices, params.m_BoneMatrices); + SetUAVParameter(batchedParameters, PrevBoneMatrices, params.m_PrevBoneMatrices); + RHICmdList.SetBatchedShaderParameters(shader, batchedParameters); +#else SetShaderValue(RHICmdList, shader, TotalParticleCount, params.m_TotalParticleCount); SetShaderValue(RHICmdList, shader, TotalBoneCount, params.m_TotalBoneCount); @@ -189,6 +214,7 @@ void FPopcornFXComputeMBBoneTransformsCS::Dispatch(FRHICommandList& RHICmdList, SetUniformBufferParameter(RHICmdList, shader, GetUniformBufferParameter(), params.m_MeshUniformBuffer); SetUAVParameter(RHICmdList, shader, BoneMatrices, params.m_BoneMatrices); SetUAVParameter(RHICmdList, shader, PrevBoneMatrices, params.m_PrevBoneMatrices); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { PK_NAMEDSCOPEDPROFILE("FPopcornFXComputeMBBoneTransformsCS::Dispatch"); @@ -248,12 +274,20 @@ void FPopcornFXSkelMeshVertexFactory::SetData(const FDataType& InData) { check(IsInRenderingThread()); Data = InData; +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + UpdateRHI(FRHICommandListExecutor::GetImmediateCommandList()); +#else UpdateRHI(); +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) } //---------------------------------------------------------------------------- +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +void FPopcornFXSkelMeshVertexFactory::InitRHI(FRHICommandListBase &RHICmdList) +#else void FPopcornFXSkelMeshVertexFactory::InitRHI() +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { FVertexDeclarationElementList Elements; diff --git a/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.h b/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.h index 5fb19e8..65ba603 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.h +++ b/Source/PopcornFX/Private/Render/PopcornFXSkeletalMeshVertexFactory.h @@ -156,7 +156,11 @@ class FPopcornFXSkelMeshVertexFactory : public FVertexFactory static bool ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters& Parameters); static bool IsCompatible(UMaterialInterface *material); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override; +#else virtual void InitRHI() override; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) void SetData(const FDataType& InData); const FDataType &GetData() const { return Data; } diff --git a/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.cpp b/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.cpp index 1b3c61a..02f05d6 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.cpp +++ b/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.cpp @@ -112,7 +112,11 @@ bool FPopcornFXVertexFactory::IsCompatible(UMaterialInterface *material) //---------------------------------------------------------------------------- +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) +void FPopcornFXVertexFactory::InitRHI(FRHICommandListBase &RHICmdList) +#else void FPopcornFXVertexFactory::InitRHI() +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) { FVertexDeclarationElementList vDeclElements; Streams.Empty(); diff --git a/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h b/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h index 1089a8a..e04f28d 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h +++ b/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h @@ -76,7 +76,11 @@ class FPopcornFXVertexFactory : public FVertexFactory static bool IsCompatible(UMaterialInterface *material); /** FRenderResource interface */ +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + virtual void InitRHI(FRHICommandListBase &RHICmdList) override; +#else virtual void InitRHI() override; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) /** Does the vertex factory supports tesselation shaders */ static bool SupportsTessellationShaders() { return false; } diff --git a/Source/PopcornFX/Private/Render/RenderBatchManager.cpp b/Source/PopcornFX/Private/Render/RenderBatchManager.cpp index 5a80bd8..9ebabbe 100644 --- a/Source/PopcornFX/Private/Render/RenderBatchManager.cpp +++ b/Source/PopcornFX/Private/Render/RenderBatchManager.cpp @@ -639,7 +639,11 @@ void CRenderBatchManager::GameThread_EndUpdate(PopcornFX::CRendererSubView &upda m_UE_UpdateThreadRenderContext.m_RendererSubView = &updateView; m_UE_UpdateThreadRenderContext.SetWorld(world); +#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) + m_CurrentFeatureLevel = world->GetFeatureLevel(); +#else m_CurrentFeatureLevel = world->FeatureLevel; +#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 3) PopcornFX::SSceneView dummyView; m_UE_UpdateThreadRenderContext.m_Views = TStridedMemoryView(dummyView); diff --git a/Source/PopcornFX/Public/Assets/PopcornFXRendererMaterial.h b/Source/PopcornFX/Public/Assets/PopcornFXRendererMaterial.h index 4d9c65c..31b7a55 100644 --- a/Source/PopcornFX/Public/Assets/PopcornFXRendererMaterial.h +++ b/Source/PopcornFX/Public/Assets/PopcornFXRendererMaterial.h @@ -6,7 +6,7 @@ #pragma once #include "RenderCommandFence.h" -#include "Launch/Resources/Version.h" +#include "Runtime/Launch/Resources/Version.h" #include "PopcornFXRendererMaterial.generated.h" @@ -40,6 +40,7 @@ class UPopcornFXTextureAtlas; X_POPCORNFX_MATERIAL_TYPE(Billboard_VolumetricFog) \ X_POPCORNFX_MATERIAL_TYPE(Billboard_SixWayLightmap) \ X_POPCORNFX_MATERIAL_TYPE(Mesh_Additive) \ + X_POPCORNFX_MATERIAL_TYPE(Mesh_AlphaBlend) \ X_POPCORNFX_MATERIAL_TYPE(Mesh_Distortion) \ X_POPCORNFX_MATERIAL_TYPE(Mesh_Solid) \ X_POPCORNFX_MATERIAL_TYPE(Mesh_Solid_Lit) \ @@ -78,6 +79,7 @@ namespace EPopcornFXMaterialType Billboard_SixWayLightmap, Mesh_Additive, + Mesh_AlphaBlend, Mesh_Distortion, Mesh_Solid, Mesh_Solid_Lit, @@ -107,7 +109,6 @@ namespace EPopcornFXMaterialType extern const EPopcornFXMaterialType::Type kTransparentBillboard_Material_ToUE[4]; extern const EPopcornFXMaterialType::Type kOpaqueBillboard_Material_ToUE[2]; -extern const EPopcornFXMaterialType::Type kTransparentMesh_Material_ToUE[4]; extern const EPopcornFXMaterialType::Type kOpaqueMesh_Material_ToUE[2]; USTRUCT(BlueprintType) diff --git a/Source/PopcornFX/Public/PopcornFXAttributeList.h b/Source/PopcornFX/Public/PopcornFXAttributeList.h index b452f4a..a1e7758 100644 --- a/Source/PopcornFX/Public/PopcornFXAttributeList.h +++ b/Source/PopcornFX/Public/PopcornFXAttributeList.h @@ -15,7 +15,6 @@ class UPopcornFXAttribSamplerInterface; class UPopcornFXEmitterComponent; uint32 ToPkShapeType(EPopcornFXAttribSamplerShapeType::Type ueShapeType); -const char *ResolveAttribSamplerShapeNodeName(EPopcornFXAttribSamplerShapeType::Type shapeType); #if WITH_EDITORONLY_DATA UENUM() diff --git a/Source/PopcornFX/Public/PopcornFXDefaultMaterialsSettings.h b/Source/PopcornFX/Public/PopcornFXDefaultMaterialsSettings.h index 2c29a7d..2b2ed49 100644 --- a/Source/PopcornFX/Public/PopcornFXDefaultMaterialsSettings.h +++ b/Source/PopcornFX/Public/PopcornFXDefaultMaterialsSettings.h @@ -71,6 +71,10 @@ struct FPopcornFXDefaultMaterialsSettings UPROPERTY(Config, EditAnywhere, Category="Default Materials", meta=(AllowedClasses="MaterialInterface")) FSoftObjectPath Material_Mesh_Additive; + /** AlphaBlend Mesh Default Material. */ + UPROPERTY(Config, EditAnywhere, Category="Default Materials", meta=(AllowedClasses="MaterialInterface")) + FSoftObjectPath Material_Mesh_AlphaBlend; + /** Distortion Mesh Default Material. */ UPROPERTY(Config, EditAnywhere, Category="Default Materials", meta=(AllowedClasses="MaterialInterface")) FSoftObjectPath Material_Mesh_Distortion; diff --git a/Source/PopcornFX/Public/PopcornFXVersionGenerated.h b/Source/PopcornFX/Public/PopcornFXVersionGenerated.h index debd68d..3886588 100644 --- a/Source/PopcornFX/Public/PopcornFXVersionGenerated.h +++ b/Source/PopcornFX/Public/PopcornFXVersionGenerated.h @@ -7,5 +7,5 @@ #define POPCORNFX_PLUGIN_VERSION_MAJOR 2 #define POPCORNFX_PLUGIN_VERSION_MINOR 15 -#define POPCORNFX_PLUGIN_VERSION_PATCH 12 +#define POPCORNFX_PLUGIN_VERSION_PATCH 13 #define POPCORNFX_PLUGIN_VERSION_TAG "" diff --git a/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp b/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp index af9c914..b72cec6 100644 --- a/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp +++ b/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp @@ -5,7 +5,7 @@ #include "PopcornFXEmitterFactory.h" -#include "Launch/Resources/Version.h" +#include "Runtime/Launch/Resources/Version.h" #if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) # include "AssetRegistry/AssetData.h" #else diff --git a/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp b/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp index deefd3d..1778dc5 100644 --- a/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp +++ b/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp @@ -8,7 +8,7 @@ #include "PopcornFXFileFactory.h" #include "Assets/PopcornFXFile.h" -#include "Launch/Resources/Version.h" +#include "Runtime/Launch/Resources/Version.h" #include "EditorReimportHandler.h" #if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) # include "AssetRegistry/AssetRegistryModule.h"