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
if (alignmentSize > 0)
{
alignedSize = (alignedSize + alignmentSize - 1) & ~(alignmentSize - 1);
alignedSize = (alignedSize + static_cast<uint32_t>(alignmentSize) - 1) & ~(alignmentSize - 1);
}
return alignedSize;
}

View File

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

View File

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

View File

@ -266,8 +266,8 @@ namespace SHADE
// Begin recording the command buffer
currentCmdBuffer->BeginRecording();
uint32_t w = viewports[vpIndex]->GetWidth();
uint32_t h = viewports[vpIndex]->GetHeight();
uint32_t w = static_cast<uint32_t>(viewports[vpIndex]->GetWidth());
uint32_t h = static_cast<uint32_t>(viewports[vpIndex]->GetHeight());
currentCmdBuffer->SetViewportScissor (static_cast<float>(w), static_cast<float>(h), w, h);
currentCmdBuffer->ForceSetPipelineLayout(SHGraphicsGlobalData::GetDummyPipelineLayout());
@ -325,15 +325,6 @@ namespace SHADE
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);
defaultViewport->SetWidth(windowDims.first);
defaultViewport->SetHeight(windowDims.second);
defaultViewport->SetWidth(static_cast<float>(windowDims.first));
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);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -149,7 +149,7 @@ namespace SHADE
{
texOrder.emplace_back(job.TextureHandle);
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();

View File

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

View File

@ -118,7 +118,7 @@ namespace SHADE
/// <param name="handle">Handle to the resource object.</param>
/// <returns>Read-only reference to the resource object.</returns>
template<typename T>
const T& Get(Handle<T> handle) const;
const T& Get(Handle<T> handle) const;
private:
/*-----------------------------------------------------------------------------*/