This commit is contained in:
Wojtek Figat
2022-11-24 20:14:47 +01:00
parent 9076d3b82b
commit 5cc66d60dc
3 changed files with 7 additions and 7 deletions

View File

@@ -181,7 +181,7 @@ void SceneRendering::RemoveActor(Actor* a, int32& key)
#define DRAW_ACTOR(mode) e.Actor->Draw(mode) #define DRAW_ACTOR(mode) e.Actor->Draw(mode)
#endif #endif
void SceneRendering::DrawActorsJob(int32 i) void SceneRendering::DrawActorsJob(int32)
{ {
PROFILE_CPU(); PROFILE_CPU();
auto& mainContext = _drawBatch->GetMainContext(); auto& mainContext = _drawBatch->GetMainContext();

View File

@@ -171,5 +171,5 @@ private:
volatile int64 _drawListIndex; volatile int64 _drawListIndex;
RenderContextBatch* _drawBatch; RenderContextBatch* _drawBatch;
void DrawActorsJob(int32 i); void DrawActorsJob(int32);
}; };

View File

@@ -637,27 +637,27 @@ void RenderList::ExecuteDrawCalls(const RenderContext& renderContext, DrawCallsL
if (useInstancing) if (useInstancing)
{ {
// Prepare buffer memory // Prepare buffer memory
int32 batchesCount = 0; int32 instancedBatchesCount = 0;
for (int32 i = 0; i < list.Batches.Count(); i++) for (int32 i = 0; i < list.Batches.Count(); i++)
{ {
auto& batch = batchesData[i]; auto& batch = batchesData[i];
if (batch.BatchSize > 1) if (batch.BatchSize > 1)
batchesCount += batch.BatchSize; instancedBatchesCount += batch.BatchSize;
} }
for (int32 i = 0; i < list.PreBatchedDrawCalls.Count(); i++) for (int32 i = 0; i < list.PreBatchedDrawCalls.Count(); i++)
{ {
auto& batch = BatchedDrawCalls.Get()[list.PreBatchedDrawCalls.Get()[i]]; auto& batch = BatchedDrawCalls.Get()[list.PreBatchedDrawCalls.Get()[i]];
if (batch.Instances.Count() > 1) if (batch.Instances.Count() > 1)
batchesCount += batch.Instances.Count(); instancedBatchesCount += batch.Instances.Count();
} }
if (batchesCount == 0) if (instancedBatchesCount == 0)
{ {
// Faster path if none of the draw batches requires instancing // Faster path if none of the draw batches requires instancing
useInstancing = false; useInstancing = false;
goto DRAW; goto DRAW;
} }
_instanceBuffer.Clear(); _instanceBuffer.Clear();
_instanceBuffer.Data.Resize(batchesCount * sizeof(InstanceData)); _instanceBuffer.Data.Resize(instancedBatchesCount * sizeof(InstanceData));
auto instanceData = (InstanceData*)_instanceBuffer.Data.Get(); auto instanceData = (InstanceData*)_instanceBuffer.Data.Get();
// Write to instance buffer // Write to instance buffer