Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,21 @@ static const uint kDOTSInstancingFlagCameraMotion = (1 << 2); // Object uses
static const uint kDOTSInstancingFlagHasPrevPosition = (1 << 3); // Object has a separate previous frame position vertex streams (e.g. for deformed objects)
static const uint kDOTSInstancingFlagMainLightEnabled = (1 << 4); // Object should receive direct lighting from the main light (e.g. light not baked into lightmap)

static DOTSVisibleData unity_SampledDOTSVisibleData;

void SetupDOTSVisibleInstancingData()
{
unity_SampledDOTSVisibleData = unity_DOTSVisibleInstances[unity_InstanceID];
}

uint GetDOTSInstanceIndex()
{
return unity_DOTSVisibleInstances[unity_InstanceID].VisibleData.x;
return unity_SampledDOTSVisibleData.VisibleData.x;
}

int GetDOTSInstanceCrossfadeSnorm8()
{
return unity_DOTSVisibleInstances[unity_InstanceID].VisibleData.y;
return unity_SampledDOTSVisibleData.VisibleData.y;
}

bool IsDOTSInstancedProperty(uint metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@
#define UNITY_ACCESS_INSTANCED_PROP(arr, var) var

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityDOTSInstancing.hlsl"
#if defined(UNITY_SETUP_INSTANCE_ID)
#undef UNITY_SETUP_INSTANCE_ID
#define UNITY_SETUP_INSTANCE_ID(input) {\
DEFAULT_UNITY_SETUP_INSTANCE_ID(input);\
SetupDOTSVisibleInstancingData();}
#endif

#else
#define UNITY_INSTANCING_BUFFER_START(buf) UNITY_INSTANCING_CBUFFER_SCOPE_BEGIN(UnityInstancing_##buf) struct {
Expand Down