Fixed warnings and errors

This commit is contained in:
Kah Wei 2022-10-02 03:06:13 +08:00
parent 4771fbfb76
commit 45514ac77e
11 changed files with 21 additions and 30 deletions

View File

@ -92,7 +92,7 @@ namespace SHADE
//uint32_t minBuffer //uint32_t minBuffer
if (alignmentSize > 0) if (alignmentSize > 0)
{ {
alignedSize = (alignedSize + alignmentSize - 1) & ~(alignmentSize - 1); alignedSize = (alignedSize + static_cast<uint32_t>(alignmentSize) - 1) & ~(alignmentSize - 1);
} }
return alignedSize; return alignedSize;
} }

View File

@ -249,7 +249,7 @@ namespace SHADE
if (!EMPTY_MAT_PROPS) if (!EMPTY_MAT_PROPS)
{ {
singleMatPropSize = SHADER_INFO->GetBytesRequired(); singleMatPropSize = SHADER_INFO->GetBytesRequired();
singleMatPropAlignedSize = device->PadSSBOSize(singleMatPropSize); singleMatPropAlignedSize = device->PadSSBOSize(static_cast<uint32_t>(singleMatPropSize));
matPropTotalBytes = numTotalElements * singleMatPropAlignedSize; matPropTotalBytes = numTotalElements * singleMatPropAlignedSize;
if (matPropsDataSize < matPropTotalBytes) if (matPropsDataSize < matPropTotalBytes)
{ {
@ -386,7 +386,7 @@ namespace SHADE
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE, SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA, SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA,
bufferList, bufferList,
0, matPropsDataSize 0, static_cast<uint32_t>(matPropsDataSize)
); );
matPropsDescSet[frameIndex]->UpdateDescriptorSetBuffer matPropsDescSet[frameIndex]->UpdateDescriptorSetBuffer
( (

View File

@ -69,7 +69,7 @@ namespace SHADE
SHMatrix inverseViewMatrix; SHMatrix inverseViewMatrix;
SHMatrix inverseProjMatrix; SHMatrix inverseProjMatrix;
SHMatrix inverseVpMatrix; SHMatrix inverseVpMatrix;
bool isDirty; bool isDirty = true;
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Helper Functions */ /* Helper Functions */

View File

@ -266,8 +266,8 @@ namespace SHADE
// Begin recording the command buffer // Begin recording the command buffer
currentCmdBuffer->BeginRecording(); currentCmdBuffer->BeginRecording();
uint32_t w = viewports[vpIndex]->GetWidth(); uint32_t w = static_cast<uint32_t>(viewports[vpIndex]->GetWidth());
uint32_t h = viewports[vpIndex]->GetHeight(); uint32_t h = static_cast<uint32_t>(viewports[vpIndex]->GetHeight());
currentCmdBuffer->SetViewportScissor (static_cast<float>(w), static_cast<float>(h), w, h); currentCmdBuffer->SetViewportScissor (static_cast<float>(w), static_cast<float>(h), w, h);
currentCmdBuffer->ForceSetPipelineLayout(SHGraphicsGlobalData::GetDummyPipelineLayout()); currentCmdBuffer->ForceSetPipelineLayout(SHGraphicsGlobalData::GetDummyPipelineLayout());
@ -325,15 +325,6 @@ namespace SHADE
void SHGraphicsSystem::Exit(void) void SHGraphicsSystem::Exit(void)
{ {
//worldRenderer->
graphicsCmdPool.Free();
renderContext.Destroy();
graphicsQueue.Free();
swapchain.Free();
surface.Free();
device.Free();
SHVkInstance::Destroy();
} }
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -554,8 +545,8 @@ namespace SHADE
worldRenderGraph->HandleResize(windowDims.first, windowDims.second); worldRenderGraph->HandleResize(windowDims.first, windowDims.second);
defaultViewport->SetWidth(windowDims.first); defaultViewport->SetWidth(static_cast<float>(windowDims.first));
defaultViewport->SetHeight(windowDims.second); defaultViewport->SetHeight(static_cast<float>(windowDims.second));
worldCamera->SetPerspective(90.0f, static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.0f, 100.0f); worldCamera->SetPerspective(90.0f, static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.0f, 100.0f);
} }

View File

@ -63,7 +63,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
Handle<SHVkPipeline> pipeline; Handle<SHVkPipeline> pipeline;
std::unique_ptr<char> propMemory; std::unique_ptr<char> propMemory;
Byte propMemorySize; Byte propMemorySize = 0;
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Helper Functions */ /* Helper Functions */

View File

@ -74,12 +74,12 @@ namespace SHADE
renderers.erase(iter); renderers.erase(iter);
} }
void SHViewport::SetWidth(uint32_t w) noexcept void SHViewport::SetWidth(float w) noexcept
{ {
viewport.width = w; viewport.width = w;
} }
void SHViewport::SetHeight(uint32_t h) noexcept void SHViewport::SetHeight(float h) noexcept
{ {
viewport.height = h; viewport.height = h;

View File

@ -65,8 +65,8 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Setters */ /* Setters */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
void SetWidth(uint32_t w) noexcept; void SetWidth(float w) noexcept;
void SetHeight (uint32_t h) noexcept; void SetHeight (float h) noexcept;
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Getters */ /* Getters */

View File

@ -196,12 +196,12 @@ namespace SHADE
static SHMeshData meshData = Cube(); static SHMeshData meshData = Cube();
return meshLibrary.AddMesh return meshLibrary.AddMesh
( (
meshData.VertexPositions.size(), static_cast<uint32_t>(meshData.VertexPositions.size()),
meshData.VertexPositions.data(), meshData.VertexPositions.data(),
meshData.VertexTexCoords.data(), meshData.VertexTexCoords.data(),
meshData.VertexTangents.data(), meshData.VertexTangents.data(),
meshData.VertexNormals.data(), meshData.VertexNormals.data(),
meshData.Indices.size(), static_cast<uint32_t>(meshData.Indices.size()),
meshData.Indices.data() meshData.Indices.data()
); );
} }
@ -211,12 +211,12 @@ namespace SHADE
static SHMeshData meshData = Cube(); static SHMeshData meshData = Cube();
return gfxSystem.AddMesh return gfxSystem.AddMesh
( (
meshData.VertexPositions.size(), static_cast<uint32_t>(meshData.VertexPositions.size()),
meshData.VertexPositions.data(), meshData.VertexPositions.data(),
meshData.VertexTexCoords.data(), meshData.VertexTexCoords.data(),
meshData.VertexTangents.data(), meshData.VertexTangents.data(),
meshData.VertexNormals.data(), meshData.VertexNormals.data(),
meshData.Indices.size(), static_cast<uint32_t>(meshData.Indices.size()),
meshData.Indices.data() meshData.Indices.data()
); );
} }

View File

@ -149,7 +149,7 @@ namespace SHADE
{ {
texOrder.emplace_back(job.TextureHandle); texOrder.emplace_back(job.TextureHandle);
combinedImageSamplers.emplace_back(std::make_tuple(job.TextureHandle->ImageView, job.Sampler, vk::ImageLayout::eShaderReadOnlyOptimal)); combinedImageSamplers.emplace_back(std::make_tuple(job.TextureHandle->ImageView, job.Sampler, vk::ImageLayout::eShaderReadOnlyOptimal));
job.TextureHandle->TextureArrayIndex = texOrder.size() - 1; job.TextureHandle->TextureArrayIndex = static_cast<uint32_t>(texOrder.size()) - 1U;
} }
addJobs.clear(); addJobs.clear();

View File

@ -8,9 +8,9 @@ namespace SHADE
ResourceManager::~ResourceManager() ResourceManager::~ResourceManager()
{ {
// Delete all resources libraries // Delete all resources libraries
for (const auto& deleter : deleters) for (auto iter = deleters.rbegin(); iter != deleters.rend(); ++iter)
{ {
deleter(); (*iter)();
} }
deleters.clear(); deleters.clear();
} }