Fixed some Renderer bugs
Former-commit-id: 5a9a4be7282c4b43c47056064d344d41c42cbaba
This commit is contained in:
parent
8897531618
commit
7080719287
|
|
@ -980,7 +980,7 @@ void NzRenderer::SetFaceFilling(nzFaceFilling fillingMode)
|
||||||
void NzRenderer::SetIndexBuffer(const NzIndexBuffer* indexBuffer)
|
void NzRenderer::SetIndexBuffer(const NzIndexBuffer* indexBuffer)
|
||||||
{
|
{
|
||||||
#if NAZARA_RENDERER_SAFE
|
#if NAZARA_RENDERER_SAFE
|
||||||
if (indexBuffer && !indexBuffer->IsHardware() && !indexBuffer->IsSequential())
|
if (indexBuffer && !indexBuffer->IsSequential() && !indexBuffer->IsHardware())
|
||||||
{
|
{
|
||||||
NazaraError("Buffer must be hardware");
|
NazaraError("Buffer must be hardware");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1424,8 +1424,6 @@ void NzRenderer::EnableInstancing(bool instancing)
|
||||||
|
|
||||||
bool NzRenderer::EnsureStateUpdate()
|
bool NzRenderer::EnsureStateUpdate()
|
||||||
{
|
{
|
||||||
if (s_updateFlags != Update_None)
|
|
||||||
{
|
|
||||||
#ifdef NAZARA_DEBUG
|
#ifdef NAZARA_DEBUG
|
||||||
if (NzContext::GetCurrent() == nullptr)
|
if (NzContext::GetCurrent() == nullptr)
|
||||||
{
|
{
|
||||||
|
|
@ -1434,10 +1432,6 @@ bool NzRenderer::EnsureStateUpdate()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NzAbstractShader* shaderImpl;
|
|
||||||
|
|
||||||
if (s_updateFlags & Update_Shader)
|
|
||||||
{
|
|
||||||
#if NAZARA_RENDERER_SAFE
|
#if NAZARA_RENDERER_SAFE
|
||||||
if (!s_shader)
|
if (!s_shader)
|
||||||
{
|
{
|
||||||
|
|
@ -1446,11 +1440,12 @@ bool NzRenderer::EnsureStateUpdate()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Il est plus rapide d'opérer sur l'implémentation du shader directement
|
NzAbstractShader* shaderImpl = s_shader->m_impl;
|
||||||
shaderImpl = s_shader->m_impl;
|
|
||||||
shaderImpl->Bind();
|
shaderImpl->Bind();
|
||||||
shaderImpl->BindTextures();
|
|
||||||
|
|
||||||
|
// Si le shader a été changé depuis la dernière fois
|
||||||
|
if (s_updateFlags & Update_Shader)
|
||||||
|
{
|
||||||
// Récupération des indices des variables uniformes (-1 si la variable n'existe pas)
|
// Récupération des indices des variables uniformes (-1 si la variable n'existe pas)
|
||||||
s_matrixLocation[nzMatrixType_Projection] = shaderImpl->GetUniformLocation(nzShaderUniform_ProjMatrix);
|
s_matrixLocation[nzMatrixType_Projection] = shaderImpl->GetUniformLocation(nzShaderUniform_ProjMatrix);
|
||||||
s_matrixLocation[nzMatrixType_View] = shaderImpl->GetUniformLocation(nzShaderUniform_ViewMatrix);
|
s_matrixLocation[nzMatrixType_View] = shaderImpl->GetUniformLocation(nzShaderUniform_ViewMatrix);
|
||||||
|
|
@ -1472,9 +1467,11 @@ bool NzRenderer::EnsureStateUpdate()
|
||||||
|
|
||||||
s_updateFlags &= ~Update_Shader;
|
s_updateFlags &= ~Update_Shader;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
shaderImpl = s_shader->m_impl;
|
|
||||||
|
|
||||||
|
shaderImpl->BindTextures();
|
||||||
|
|
||||||
|
if (s_updateFlags != Update_None)
|
||||||
|
{
|
||||||
if (s_updateFlags & Update_Textures)
|
if (s_updateFlags & Update_Textures)
|
||||||
{
|
{
|
||||||
if (s_useSamplerObjects)
|
if (s_useSamplerObjects)
|
||||||
|
|
@ -1670,7 +1667,7 @@ bool NzRenderer::EnsureStateUpdate()
|
||||||
glDisableVertexAttribArray(NzOpenGL::AttributeIndex[nzElementUsage_TexCoord]+i);
|
glDisableVertexAttribArray(NzOpenGL::AttributeIndex[nzElementUsage_TexCoord]+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_indexBuffer)
|
if (s_indexBuffer && !s_indexBuffer->IsSequential())
|
||||||
{
|
{
|
||||||
NzHardwareBuffer* indexBufferImpl = static_cast<NzHardwareBuffer*>(s_indexBuffer->GetBuffer()->GetImpl());
|
NzHardwareBuffer* indexBufferImpl = static_cast<NzHardwareBuffer*>(s_indexBuffer->GetBuffer()->GetImpl());
|
||||||
indexBufferImpl->Bind();
|
indexBufferImpl->Bind();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue