Fixed warnings in SHBatch.cpp

This commit is contained in:
Kah Wei 2022-09-24 02:13:09 +08:00
parent 759c87e2a1
commit 15f12a2608
1 changed files with 9 additions and 11 deletions

View File

@ -81,8 +81,8 @@ namespace SHADE
// Check if other renderables in subBatches contain the same material instance
bool matUnused = true;
for (const auto& subBatch : subBatches)
for (const auto& rend : subBatch.Renderables)
for (const auto& sb : subBatches)
for (const auto& rend : sb.Renderables)
{
if (rend->GetMaterial() == renderable->GetMaterial())
{
@ -134,7 +134,7 @@ namespace SHADE
// Check if any materials have changed
bool hasChanged = false;
for (auto material : referencedMatInstances)
for (const auto& material : referencedMatInstances)
{
if (material->HasChanged())
{
@ -155,12 +155,10 @@ namespace SHADE
return;
// Build CPI Buffer
uint32_t nextInstanceIndex = 0;
char* propsCurrPtr = matPropsData.get();
for (auto& subBatch : subBatches)
for (const SHRenderable* renderable : subBatch.Renderables)
{
renderable->GetMaterial()->ExportProperties(propsCurrPtr);
propsCurrPtr += singleMatPropSize;
}
@ -205,10 +203,10 @@ namespace SHADE
}
// Transfer to GPU
transformDataBuffer[frameIndex]->WriteToMemory(transformData.data(), transformData.size() * sizeof(SHMatrix), 0, 0);
transformDataBuffer[frameIndex]->WriteToMemory(transformData.data(), static_cast<uint32_t>(transformData.size() * sizeof(SHMatrix)), 0, 0);
}
void SHBatch::Build(Handle<SHVkLogicalDevice> device, uint32_t frameIndex)
void SHBatch::Build(Handle<SHVkLogicalDevice> _device, uint32_t frameIndex)
{
if (frameIndex >= SHGraphicsConstants::NUM_FRAME_BUFFERS)
{
@ -305,14 +303,14 @@ namespace SHADE
const uint32_t DRAW_DATA_BYTES = static_cast<uint32_t>(drawData.size() * sizeof(vk::DrawIndexedIndirectCommand));
SHVkUtil::EnsureBufferAndCopyHostVisibleData
(
device, drawDataBuffer[frameIndex], drawData.data(), DRAW_DATA_BYTES,
_device, drawDataBuffer[frameIndex], drawData.data(), DRAW_DATA_BYTES,
BuffUsage::eIndirectBuffer
);
// - Transform Buffer
const uint32_t TF_DATA_BYTES = static_cast<uint32_t>(transformData.size() * sizeof(SHMatrix));
SHVkUtil::EnsureBufferAndCopyHostVisibleData
(
device, transformDataBuffer[frameIndex], transformData.data(), TF_DATA_BYTES,
_device, transformDataBuffer[frameIndex], transformData.data(), TF_DATA_BYTES,
BuffUsage::eVertexBuffer
);
// - Material Properties Buffer
@ -320,7 +318,7 @@ namespace SHADE
{
SHVkUtil::EnsureBufferAndCopyHostVisibleData
(
device, matPropsBuffer[frameIndex], matPropsData.get(), static_cast<uint32_t>(matPropsDataSize),
_device, matPropsBuffer[frameIndex], matPropsData.get(), static_cast<uint32_t>(matPropsDataSize),
BuffUsage::eStorageBuffer
);
}
@ -328,7 +326,7 @@ namespace SHADE
isDirty[frameIndex] = false;
// Save logical device
this->device = device;
this->device = _device;
}
/*---------------------------------------------------------------------------------*/