Some more warning fixes

This commit is contained in:
Lynix 2017-02-17 00:38:44 +01:00
parent a4100d5b4e
commit ee9712fdcd
2 changed files with 11 additions and 11 deletions

View File

@ -36,7 +36,7 @@ namespace Nz
unsigned int width; unsigned int width;
}; };
unsigned int attachmentIndex[AttachmentPoint_Max+1] = unsigned int s_attachmentIndex[AttachmentPoint_Max+1] =
{ {
3, // AttachmentPoint_Color 3, // AttachmentPoint_Color
0, // AttachmentPoint_Depth 0, // AttachmentPoint_Depth
@ -117,7 +117,7 @@ namespace Nz
return false; return false;
} }
unsigned int depthStencilIndex = attachmentIndex[AttachmentPoint_DepthStencil]; unsigned int depthStencilIndex = s_attachmentIndex[AttachmentPoint_DepthStencil];
if (m_impl->attachments.size() > depthStencilIndex && m_impl->attachments[depthStencilIndex].isUsed) if (m_impl->attachments.size() > depthStencilIndex && m_impl->attachments[depthStencilIndex].isUsed)
{ {
if (attachmentPoint == AttachmentPoint_Depth) if (attachmentPoint == AttachmentPoint_Depth)
@ -154,7 +154,7 @@ namespace Nz
Unlock(); Unlock();
unsigned int attachIndex = attachmentIndex[attachmentPoint] + index; unsigned int attachIndex = s_attachmentIndex[attachmentPoint] + index;
if (attachIndex >= m_impl->attachments.size()) if (attachIndex >= m_impl->attachments.size())
m_impl->attachments.resize(attachIndex+1); m_impl->attachments.resize(attachIndex+1);
@ -223,7 +223,7 @@ namespace Nz
return false; return false;
} }
unsigned int depthStencilIndex = attachmentIndex[AttachmentPoint_DepthStencil]; unsigned int depthStencilIndex = s_attachmentIndex[AttachmentPoint_DepthStencil];
if (attachmentPoint == AttachmentPoint_Depth && m_impl->attachments.size() > depthStencilIndex && if (attachmentPoint == AttachmentPoint_Depth && m_impl->attachments.size() > depthStencilIndex &&
m_impl->attachments[depthStencilIndex].isUsed) m_impl->attachments[depthStencilIndex].isUsed)
{ {
@ -288,7 +288,7 @@ namespace Nz
Unlock(); Unlock();
unsigned int attachIndex = attachmentIndex[attachmentPoint] + index; unsigned int attachIndex = s_attachmentIndex[attachmentPoint] + index;
if (attachIndex >= m_impl->attachments.size()) if (attachIndex >= m_impl->attachments.size())
m_impl->attachments.resize(attachIndex+1); m_impl->attachments.resize(attachIndex+1);
@ -394,7 +394,7 @@ namespace Nz
} }
#endif #endif
unsigned int attachIndex = attachmentIndex[attachmentPoint] + index; unsigned int attachIndex = s_attachmentIndex[attachmentPoint] + index;
if (attachIndex >= m_impl->attachments.size()) if (attachIndex >= m_impl->attachments.size())
return; return;
@ -575,7 +575,7 @@ namespace Nz
#if NAZARA_RENDERER_SAFE #if NAZARA_RENDERER_SAFE
for (unsigned int i = 0; i < targetCount; ++i) for (unsigned int i = 0; i < targetCount; ++i)
{ {
unsigned int index = attachmentIndex[AttachmentPoint_Color] + targets[i]; unsigned int index = s_attachmentIndex[AttachmentPoint_Color] + targets[i];
if (index >= m_impl->attachments.size() || !m_impl->attachments[index].isUsed) if (index >= m_impl->attachments.size() || !m_impl->attachments[index].isUsed)
{ {
NazaraError("Target " + String::Number(targets[i]) + " not attached"); NazaraError("Target " + String::Number(targets[i]) + " not attached");
@ -598,7 +598,7 @@ namespace Nz
#if NAZARA_RENDERER_SAFE #if NAZARA_RENDERER_SAFE
for (UInt8 target : targets) for (UInt8 target : targets)
{ {
unsigned int index = attachmentIndex[AttachmentPoint_Color] + target; unsigned int index = s_attachmentIndex[AttachmentPoint_Color] + target;
if (index >= m_impl->attachments.size() || !m_impl->attachments[index].isUsed) if (index >= m_impl->attachments.size() || !m_impl->attachments[index].isUsed)
{ {
NazaraError("Target " + String::Number(target) + " not attached"); NazaraError("Target " + String::Number(target) + " not attached");
@ -752,7 +752,7 @@ namespace Nz
for (UInt8 index : m_impl->colorTargets) for (UInt8 index : m_impl->colorTargets)
{ {
Attachment& attachment = m_impl->attachments[attachmentIndex[AttachmentPoint_Color] + index]; Attachment& attachment = m_impl->attachments[s_attachmentIndex[AttachmentPoint_Color] + index];
if (!attachment.isBuffer) if (!attachment.isBuffer)
attachment.texture->InvalidateMipmaps(); attachment.texture->InvalidateMipmaps();
} }
@ -833,7 +833,7 @@ namespace Nz
m_impl->colorTargets.clear(); m_impl->colorTargets.clear();
unsigned int colorIndex = 0; unsigned int colorIndex = 0;
for (unsigned int index = attachmentIndex[AttachmentPoint_Color]; index < m_impl->attachments.size(); ++index) for (unsigned int index = s_attachmentIndex[AttachmentPoint_Color]; index < m_impl->attachments.size(); ++index)
m_impl->colorTargets.push_back(colorIndex++); m_impl->colorTargets.push_back(colorIndex++);
} }

View File

@ -93,7 +93,7 @@ namespace Nz
} }
catch (const std::exception&) catch (const std::exception&)
{ {
ErrorFlags errFlags(ErrorFlag_ThrowExceptionDisabled); ErrorFlags errFlags2(ErrorFlag_ThrowExceptionDisabled);
NazaraError("Shader code failed to compile (" + stage.GetLog() + ")\n" + code.ToString()); NazaraError("Shader code failed to compile (" + stage.GetLog() + ")\n" + code.ToString());
throw; throw;