|
@@ -17,14 +17,17 @@ namespace Core.BRG
|
|
|
|
|
|
|
|
private Map<string, BatchShaderBind> m_batchShaderBindMap = new Map<string, BatchShaderBind>();
|
|
private Map<string, BatchShaderBind> m_batchShaderBindMap = new Map<string, BatchShaderBind>();
|
|
|
|
|
|
|
|
- public void InitRender(BRGSamples samples, List<T> gameObjectInfos,int maxCount)
|
|
|
|
|
|
|
+ public int maxCount;
|
|
|
|
|
+
|
|
|
|
|
+ public void InitRender(BRGSamples samples, List<T> gameObjectInfos, int maxCount)
|
|
|
{
|
|
{
|
|
|
this.m_gameObjectInfos = gameObjectInfos;
|
|
this.m_gameObjectInfos = gameObjectInfos;
|
|
|
-
|
|
|
|
|
|
|
+ this.maxCount = maxCount;
|
|
|
for (int i = 0; i < m_gameObjectInfos.Count; i++)
|
|
for (int i = 0; i < m_gameObjectInfos.Count; i++)
|
|
|
{
|
|
{
|
|
|
m_gameObjectInfos[i].initIndex = i;
|
|
m_gameObjectInfos[i].initIndex = i;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
int maxItemSize = samples.GetAllShaderValueSize();
|
|
int maxItemSize = samples.GetAllShaderValueSize();
|
|
|
Init(samples, maxCount, maxItemSize);
|
|
Init(samples, maxCount, maxItemSize);
|
|
|
UploadGpuData(gameObjectInfos.Count);
|
|
UploadGpuData(gameObjectInfos.Count);
|
|
@@ -42,7 +45,11 @@ namespace Core.BRG
|
|
|
new NativeArray<MetadataValue>(m_samples.AllShaderValues.Count, Allocator.Temp,
|
|
new NativeArray<MetadataValue>(m_samples.AllShaderValues.Count, Allocator.Temp,
|
|
|
NativeArrayOptions.UninitializedMemory);
|
|
NativeArrayOptions.UninitializedMemory);
|
|
|
m_batchShaderBinds.Clear();
|
|
m_batchShaderBinds.Clear();
|
|
|
- // int count= m_maxInstancePerWindow;
|
|
|
|
|
|
|
+ // BatchShaderBind transformBind = new BatchShaderBind();
|
|
|
|
|
+ // transformBind.shaderValue = new BRGShaderValue()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // key = "_Object2World",
|
|
|
|
|
+ // };
|
|
|
for (int i = 0; i < m_samples.AllShaderValues.Count; i++)
|
|
for (int i = 0; i < m_samples.AllShaderValues.Count; i++)
|
|
|
{
|
|
{
|
|
|
BRGShaderValue shaderValue = m_samples.AllShaderValues[i];
|
|
BRGShaderValue shaderValue = m_samples.AllShaderValues[i];
|
|
@@ -60,7 +67,14 @@ namespace Core.BRG
|
|
|
return metadataValues;
|
|
return metadataValues;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public void AddBGRGameObjectInfo(T info)
|
|
|
|
|
+ {
|
|
|
|
|
+ m_gameObjectInfos.Add(info);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void RemoveBGRGameObjectInfo(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ m_gameObjectInfos.RemoveAt(index);
|
|
|
|
|
+ }
|
|
|
public void UpdatePos()
|
|
public void UpdatePos()
|
|
|
{
|
|
{
|
|
|
if (!isUpdate)
|
|
if (!isUpdate)
|
|
@@ -68,6 +82,8 @@ namespace Core.BRG
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
int totalGpuBufferSize;
|
|
int totalGpuBufferSize;
|
|
|
int alignedWindowSize;
|
|
int alignedWindowSize;
|
|
|
NativeArray<float3x4> sysmemBuffer =
|
|
NativeArray<float3x4> sysmemBuffer =
|
|
@@ -80,7 +96,7 @@ namespace Core.BRG
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- int m_itemCount = m_gameObjectInfos.Count;
|
|
|
|
|
|
|
+ int m_itemCount = maxCount;
|
|
|
m_batchShaderBindMap.TryGetValue("_MainColor", out var baseColorBind);
|
|
m_batchShaderBindMap.TryGetValue("_MainColor", out var baseColorBind);
|
|
|
for (int i = 0; i < m_gameObjectInfos.Count; i++)
|
|
for (int i = 0; i < m_gameObjectInfos.Count; i++)
|
|
|
{
|
|
{
|
|
@@ -107,7 +123,7 @@ namespace Core.BRG
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 每帧更新后重新上传数据到GPU
|
|
// 每帧更新后重新上传数据到GPU
|
|
|
- UploadGpuData(m_itemCount, m_batchShaderBinds);
|
|
|
|
|
|
|
+ UploadGpuData(m_gameObjectInfos.Count, m_batchShaderBinds);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|