Minor fixes

This commit is contained in:
SirLynix 2022-04-04 08:17:03 +02:00
parent 83de0939bb
commit 66ff6cfa81
10 changed files with 12 additions and 15 deletions

View File

@ -264,7 +264,7 @@ namespace Nz
{
UInt32 crc = 0xFFFFFFFFu;
for (std::size_t i = 0u; auto c = str[i]; ++i)
for (std::size_t i = 0u; str[i]; ++i)
crc = Detail::crc32Table[(crc ^ str[i]) & 0xFF] ^ (crc >> 8);
return ~crc;

View File

@ -44,13 +44,7 @@ namespace Nz
inline bool QueueHandle::Present(const VkPresentInfoKHR& presentInfo) const
{
m_lastErrorCode = m_device->vkQueuePresentKHR(m_handle, &presentInfo);
if (m_lastErrorCode != VkResult::VK_SUCCESS)
{
NazaraError("Failed to present queue: " + TranslateVulkanError(m_lastErrorCode));
return false;
}
return true;
return (m_lastErrorCode != VkResult::VK_SUCCESS);
}
inline bool QueueHandle::Present(VkSwapchainKHR swapchain, UInt32 imageIndex, VkSemaphore waitSemaphore) const

View File

@ -106,7 +106,7 @@ namespace Nz
return 0;
}
assert(readBytes > 0 && readBytes <= remainingBytes);
assert(readBytes > 0 && UInt64(readBytes) <= remainingBytes);
ptr += readBytes;
remainingBytes -= readBytes;

View File

@ -75,7 +75,7 @@ namespace Nz
{
table[i] = crc32_reflect(i, 8) << 24;
for (unsigned int j = 0; j < 8; ++j)
table[i] = (table[i] << 1) ^ (table[i] & ((1 << 31) ? polynomial : 0));
table[i] = (table[i] << 1) ^ ((table[i] & (1 << 31)) ? polynomial : 0);
table[i] = crc32_reflect(table[i], 32);
}

View File

@ -72,7 +72,7 @@ namespace Nz
{
// Material should always have textures but we're better safe than sorry
if (const auto& texture = mat.GetDiffuseMap())
return mat.GetDiffuseMap()->GetSize();
return texture->GetSize();
}
}

View File

@ -71,7 +71,7 @@ namespace Nz
{
// Material should always have textures but we're better safe than sorry
if (const auto& texture = mat.GetDiffuseMap())
return mat.GetDiffuseMap()->GetSize();
return texture->GetSize();
}
}

View File

@ -29,7 +29,7 @@ namespace Nz
{
const OpenGLBuffer& glBuffer = static_cast<const OpenGLBuffer&>(indexBuffer);
m_commandBuffer.BindIndexBuffer(glBuffer.GetBuffer().GetObjectId());
m_commandBuffer.BindIndexBuffer(glBuffer.GetBuffer().GetObjectId(), offset);
}
void OpenGLCommandBufferBuilder::BindPipeline(const RenderPipeline& pipeline)

View File

@ -3257,6 +3257,7 @@ namespace Nz::ShaderAst
{
case PrimitiveType::Boolean:
case PrimitiveType::String:
case PrimitiveType::UInt32:
return false;
case PrimitiveType::Float32:
@ -3280,6 +3281,8 @@ namespace Nz::ShaderAst
}
}
}
throw ShaderLang::AstInternalError{ node.sourceLocation, "unexpected cast from " + ShaderAst::ToString(fromPrimitiveType) + " to " + ShaderAst::ToString(targetPrimitiveType) };
}();
if (!areTypeCompatibles)

View File

@ -56,7 +56,7 @@ namespace Nz
{
}
void CheckboxWidgetStyle::OnNewState(CheckboxState newState)
void CheckboxWidgetStyle::OnNewState(CheckboxState /*newState*/)
{
}

View File

@ -30,7 +30,7 @@ QImage PreviewValues::GenerateImage() const
for (std::size_t y = 0; y < 4; ++y)
*ptr++ = static_cast<Nz::UInt8>(std::clamp((*src)[y] * 0xFF, 0.f, 255.f));
*src++;
src++;
}
return preview;