Skip to content

Commit

Permalink
UnityPlugin: Release 2.15.17
Browse files Browse the repository at this point in the history
  • Loading branch information
PopcornFX Bot committed Jan 11, 2024
1 parent 2e16362 commit 7a64138
Show file tree
Hide file tree
Showing 99 changed files with 878 additions and 701 deletions.
20 changes: 20 additions & 0 deletions Native/ManagedToNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ extern "C"

//----------------------------------------------------------------------------

MANAGED_TO_POPCORN_CONVENTION int GetStackLogNumber()
{
if (!CRuntimeManager::IsInstanceInitialized())
return 0;

CUnityLog *logger = CRuntimeManager::Instance().GetLogger();

return (int)logger->Count();
}

//----------------------------------------------------------------------------

MANAGED_TO_POPCORN_CONVENTION int UnstackLog(char *dstBuffer, int dstSize, int &logSeverity)
{
// DO NOT LOG AIN THIS FUNCTION! INFINITE LOOP...
Expand All @@ -237,6 +249,8 @@ extern "C"
return -1;
}

//----------------------------------------------------------------------------


MANAGED_TO_POPCORN_CONVENTION void SetMaxCameraCount(int count)
{
Expand Down Expand Up @@ -1015,6 +1029,12 @@ extern "C"
loopback->SetVolumeMultiplier(volume);
}

MANAGED_TO_POPCORN_CONVENTION bool CanSkipUpdate()
{
NEED_PK_RUNTIME_STARTED(return true);
return CRuntimeManager::Instance().CanSkipUpdate();
}


#if defined(PK_COMPILER_CLANG) || defined(PK_COMPILER_GCC)
# pragma GCC visibility pop
Expand Down
2 changes: 2 additions & 0 deletions Native/ManagedToNative.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ extern "C"
MANAGED_TO_POPCORN_CONVENTION void PopcornFXShutdown();
//Log
MANAGED_TO_POPCORN_CONVENTION void SetMaxLogStack(int maxLogStack);
MANAGED_TO_POPCORN_CONVENTION int GetStackLogNumber();
MANAGED_TO_POPCORN_CONVENTION int UnstackLog(char *dstBuffer, int dstSize, int &logSeverity);
// Update and rendering:
MANAGED_TO_POPCORN_CONVENTION void SetMaxCameraCount(int number);
Expand Down Expand Up @@ -362,6 +363,7 @@ extern "C"
MANAGED_TO_POPCORN_CONVENTION const char *GetRuntimeVersion();

MANAGED_TO_POPCORN_CONVENTION void SetApplicationLoopbackAudioVolume(float volume);
MANAGED_TO_POPCORN_CONVENTION bool CanSkipUpdate();

#if defined(PK_COMPILER_CLANG) || defined(PK_COMPILER_GCC)
# pragma GCC visibility pop
Expand Down
3 changes: 3 additions & 0 deletions Native/NativeToManaged.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ extern "C"
int m_TextureAtlasCount;
CFloat4 *m_TextureAtlas;

int m_DrawOrder;

SMeshRendererDesc()
: m_MeshAsset(null)
, m_ShaderVariationFlags(0)
Expand All @@ -189,6 +191,7 @@ extern "C"
, m_AnimDescRendering(null)
, m_TextureAtlasCount(0)
, m_TextureAtlas(null)
, m_DrawOrder(0)
{
}

Expand Down
1 change: 1 addition & 0 deletions Native/PKUnity_Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class CUnityLog : public ILogListener
s32 PopFront(SPopcornLogData &out);
void SetMaxLogsCount(u32 maxLogsCount);
void ClearLogs();
u32 Count() const { return m_LogStackMain.Count(); }

void StartLogs();
void ValidateLogsAtLevel(CLog::ELogLevel level, const CString &header);
Expand Down
28 changes: 25 additions & 3 deletions Native/PKUnity_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,29 @@ void CPKFXScene::SyncPreviousUpdateAndRunDeferredCallsIFN()

//----------------------------------------------------------------------------

bool CPKFXScene::ShouldUpdatePopcorn()
{
if (!m_WaitForUpdateOnRenderThread)
{
PK_ASSERT(m_ParticleMediumCollection != null);
if (m_ParticleMediumCollection->CanSkipUpdate())
return false;
}
else
{
PK_ASSERT(m_ParticleMeshMediumCollection != null);
PK_ASSERT(m_ParticleMediumCollection != null);

if (m_ParticleMediumCollection->CanSkipUpdate() &&
m_ParticleMeshMediumCollection->CanSkipUpdate())
return false;
}

return true;
}

//----------------------------------------------------------------------------

void CPKFXScene::LaunchUpdate(float dt)
{
PK_SCOPEDPROFILE();
Expand All @@ -186,21 +209,20 @@ void CPKFXScene::LaunchUpdate(float dt)

if (UpdateMode() != UpdateMode_NoUpdate)
{
if (dt != 0.0f)
if (dt != 0.0f && ShouldUpdatePopcorn())
{
CRuntimeManager::Instance().BeforeUpdate();
CRuntimeManager::Instance().Update(dt);

if (!m_WaitForUpdateOnRenderThread)
{
PK_ASSERT(m_ParticleMeshMediumCollection == null);


#if (PK_PARTICLES_HAS_STATS != 0)
m_ParticleMediumCollection->Stats().Reset();
PopcornFX::CTimer updateTimer;
updateTimer.Start();
#endif // (PK_PARTICLES_HAS_STATS != 0)

m_ParticleMediumCollection->Update(dt);

while (m_ParticleMediumCollection->UpdateFence(1)) {}
Expand Down
1 change: 1 addition & 0 deletions Native/PKUnity_Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CPKFXScene : public CRefCountedObject, public IParticleScene
void TransformAllParticles(const CFloat3 &worldOffset);

void ResolveDynamicCollisionsIFN();
bool ShouldUpdatePopcorn();

// Both of those need to be called for the particles to be correctly updated:
void SyncPreviousUpdateAndRunDeferredCallsIFN();
Expand Down
7 changes: 6 additions & 1 deletion Native/RenderingIntegration/UnityRendererCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ bool CParticleMaterialDescMesh::InitFromRenderer(const CRendererDataMesh &render
const SRendererFeaturePropertyValue *atlasBlending = renderer.m_Declaration.FindProperty(BasicRendererProperties::SID_Atlas_Blending());

m_Flags.m_ShaderVariationFlags = 0;

if (diffuse != null && diffuse->ValueB() && diffuseMap != null && !diffuseMap->ValuePath().Empty())
m_Flags.m_ShaderVariationFlags |= ShaderVariationFlags::Has_DiffuseMap;
if (alphaRemap != null && alphaRemap->ValueB() && alphaRemapAlphaMap != null && !alphaRemapAlphaMap->ValuePath().Empty() && alphaRemapCursor.Valid())
Expand Down Expand Up @@ -482,7 +483,10 @@ bool CParticleMaterialDescMesh::InitFromRenderer(const CRendererDataMesh &render
m_Flags.m_BlendMode = BlendMode::Solid;

if (transparent != null && transparent->ValueB() && transparentType != null)
{
{
const SRendererFeaturePropertyValue *globalSortOverride = renderer.m_Declaration.FindProperty(BasicRendererProperties::SID_Transparent_GlobalSortOverride());
m_Flags.m_DrawOrder = globalSortOverride != null ? globalSortOverride->ValueI().x() : 0;

if (transparentType->ValueI().x() == BasicRendererProperties::Additive)
{
m_Flags.m_BlendMode = BlendMode::Additive;
Expand Down Expand Up @@ -872,6 +876,7 @@ bool CUnityRendererCache::GetRendererInfo(SMeshRendererDesc &desc)
desc.m_InvSoftnessDistance = m_MaterialDescMesh.m_InvSoftnessDistance;
desc.m_AlphaClipThreshold = m_MaterialDescMesh.m_AlphaThreshold;
desc.m_DoubleSided = m_MaterialDescMesh.m_DoubleSided;
desc.m_DrawOrder = m_MaterialDescMesh.m_Flags.m_DrawOrder;

bool fluidVAT = (m_MaterialDescMesh.m_Flags.m_ShaderVariationFlags & ShaderVariationFlags::Has_FluidVAT) != 0;
bool softVAT = (m_MaterialDescMesh.m_Flags.m_ShaderVariationFlags & ShaderVariationFlags::Has_SoftVAT) != 0;
Expand Down
17 changes: 12 additions & 5 deletions Native/RuntimeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,13 @@ void CRuntimeManager::AfterUpdate()

//----------------------------------------------------------------------------

bool CRuntimeManager::CanSkipUpdate()
{
return !m_ParticleScene->ShouldUpdatePopcorn();
}

//----------------------------------------------------------------------------

bool CRuntimeManager::KickBackgroundTasksIFN()
{
if (m_HasBackgroundTasksToKick)
Expand Down Expand Up @@ -1638,10 +1645,10 @@ Threads::PAbstractPool CRuntimeManager::_CreateCustomThreadPool()
#if defined(PK_ORBIS)
// Default worker affinities on Orbis (and UNKNOWN2?):
{
1 << 2,
1 << 3, // our main thread
1 << 4,
1 << 5,
0x0C,
0x0C,
0x30,
0x30,
};
#elif defined(PK_LUMIN)
// Default worker affinities on Lumin:
Expand All @@ -1667,7 +1674,7 @@ Threads::PAbstractPool CRuntimeManager::_CreateCustomThreadPool()
#if defined(PK_ORBIS) || defined(PK_UNKNOWN2)
affinityMasks = kWorkerAffinities;
affinityCount = PK_ARRAY_COUNT(kWorkerAffinities);
workersPriority = CThreadManager::Priority_BackgroundLow;
workersPriority = CThreadManager::Priority_High;
hasExplicitAffinities = true;
#elif defined(PK_LUMIN)
affinityMasks = kWorkerAffinities;
Expand Down
1 change: 1 addition & 0 deletions Native/RuntimeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class CRuntimeManager : public CNonCopyable

void BeforeUpdate();
void AfterUpdate();
bool CanSkipUpdate();

template<class T>
bool AddBackgroundTask(T *functor)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unity PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.15.16`
* **Version:** `v2.15.17`
* **Unity:** `2019.4` to `2022.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`.
[Contact-us](https://www.popcornfx.com/contact-popcornfx/) to request access to the plugin for consoles.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unity PopcornFX Plugin
Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.15.16`
* **Version:** `v2.15.17`
* **Unity:** `2019.4` to `2021.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`. [Contact-us](http://www.popcornfx.com/contact-us/) for more information.

Expand Down
2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx.hdrp/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unity PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.15.16`
* **Version:** `v2.15.17`
* **Unity:** `2019.4` to `2022.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`.
[Contact-us](https://www.popcornfx.com/contact-popcornfx/) to request access to the plugin for consoles.
Expand Down
4 changes: 2 additions & 2 deletions com.persistant-studios.popcornfx.hdrp/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "com.persistant-studios.popcornfx.hdrp",
"description": "HDRP Materials for PopcornFX.",
"version": "2.15.16",
"version": "2.15.17",
"unity": "2020.2",
"unityRelease": "",
"displayName": "PopcornFX HDRP",
"dependencies": {
"com.unity.render-pipelines.core": "10.2.2",
"com.unity.render-pipelines.high-definition": "10.2.2",
"com.persistant-studios.popcornfx": "2.15.16"
"com.persistant-studios.popcornfx": "2.15.17"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unity PopcornFX Plugin
Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.15.16`
* **Version:** `v2.15.17`
* **Unity:** `2017.4` to `2021.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`. [Contact-us](http://www.popcornfx.com/contact-us/) for more information.

Expand Down
2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx.urp/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unity PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.15.16`
* **Version:** `v2.15.17`
* **Unity:** `2019.4` to `2022.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`.
[Contact-us](https://www.popcornfx.com/contact-popcornfx/) to request access to the plugin for consoles.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_RenderTypes: 01010001
m_BlendMode: 010101010000
m_SupportedShaderMask: 4194302
m_SupportedShaderMask: 4194238
m_MandatoryShaderMask: 8
m_BillboardingLocation: 0
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_RenderTypes: 01010001
m_BlendMode: 010101010000
m_SupportedShaderMask: 4194294
m_SupportedShaderMask: 4194230
m_MandatoryShaderMask: 0
m_BillboardingLocation: 0
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_RenderTypes: 00010000
m_BlendMode: 010101010000
m_SupportedShaderMask: 4194301
m_SupportedShaderMask: 4194237
m_MandatoryShaderMask: 9
m_BillboardingLocation: 0
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_RenderTypes: 00010000
m_BlendMode: 010101010000
m_SupportedShaderMask: 4194293
m_SupportedShaderMask: 4194229
m_MandatoryShaderMask: 1
m_BillboardingLocation: 0
Original file line number Diff line number Diff line change
Expand Up @@ -5508,8 +5508,8 @@
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"overrideHLSLDeclaration": true,
"hlslDeclarationOverride": 3,
"m_Hidden": false,
"m_Value": 0.0,
"m_FloatType": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11727,8 +11727,8 @@
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"overrideHLSLDeclaration": true,
"hlslDeclarationOverride": 3,
"m_Hidden": false,
"m_Value": 0.0,
"m_FloatType": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3800,8 +3800,8 @@
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"overrideHLSLDeclaration": true,
"hlslDeclarationOverride": 3,
"m_Hidden": false,
"m_Value": 0.0,
"m_FloatType": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5518,8 +5518,8 @@
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"overrideHLSLDeclaration": true,
"hlslDeclarationOverride": 3,
"m_Hidden": false,
"m_Value": 0.0,
"m_FloatType": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3470,8 +3470,8 @@
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"overrideHLSLDeclaration": true,
"hlslDeclarationOverride": 3,
"m_Hidden": false,
"m_Value": 0.0,
"m_FloatType": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ public override Material ResolveParticleMaterial(SBatchDesc batchDesc, PKFxEffec
Debug.LogError("[PopcornFX] Trying to resolve material from PKFxEffectAsset that is not holding materials");
if (material == null)
return null;
if (batchDesc.m_Type != ERendererType.Mesh)
material.renderQueue = m_RenderQueue + batchDesc.m_DrawOrder;
material.renderQueue = m_RenderQueue + batchDesc.m_DrawOrder;
return material;
}
}
Expand Down
4 changes: 2 additions & 2 deletions com.persistant-studios.popcornfx.urp/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "com.persistant-studios.popcornfx.urp",
"description": "URP Materials for PopcornFX.",
"version": "2.15.16",
"version": "2.15.17",
"unity": "2020.2",
"unityRelease": "",
"displayName": "PopcornFX URP",
"dependencies": {
"com.unity.render-pipelines.core": "10.2.2",
"com.unity.render-pipelines.universal": "10.2.2",
"com.persistant-studios.popcornfx": "2.15.16"
"com.persistant-studios.popcornfx": "2.15.17"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unity PopcornFX Plugin
Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.15.16`
* **Version:** `v2.15.17`
* **Unity:** `2017.4` to `2021.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`. [Contact-us](http://www.popcornfx.com/contact-us/) for more information.

Expand Down
Loading

0 comments on commit 7a64138

Please sign in to comment.