Removes SkipSubmit and unused friends from Renderer.

This was SVN commit r26162.
This commit is contained in:
vladislavbelov
2022-01-03 12:16:16 +00:00
parent 3e6b0780fa
commit 2f90becb28
10 changed files with 30 additions and 65 deletions
+3 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -58,8 +58,7 @@ inline void DrawTextureImpl(const CShaderProgramPtr& shader, CTexturePtr texture
shader->TexCoordPointer(GL_TEXTURE0, 2, GL_FLOAT, 0, uvs.data());
shader->AssertPointersBound();
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.size() / 2);
glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.size() / 2);
}
} // anonymous namespace
@@ -132,8 +131,7 @@ void CCanvas2D::DrawLine(const std::vector<CVector2D>& points, const float width
glEnable(GL_LINE_SMOOTH);
#endif
glLineWidth(width);
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_LINE_STRIP, 0, vertices.size() / 2);
glDrawArrays(GL_LINE_STRIP, 0, vertices.size() / 2);
glLineWidth(1.0f);
#if !CONFIG2_GLES
glDisable(GL_LINE_SMOOTH);
+2 -4
View File
@@ -89,8 +89,7 @@ void DrawTexture(CShaderProgramPtr shader)
shader->VertexPointer(3, GL_FLOAT, 0, quadVertices);
shader->AssertPointersBound();
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_TRIANGLES, 0, 6);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
struct MinimapUnitVertex
@@ -497,8 +496,7 @@ void CMiniMapTexture::RenderFinalTexture()
shader->ColorPointer(4, GL_UNSIGNED_BYTE, stride, base + m_AttributeColor.offset);
shader->AssertPointersBound();
if (!g_Renderer.DoSkipSubmit())
glDrawElements(GL_POINTS, (GLsizei)(m_EntitiesDrawn), GL_UNSIGNED_SHORT, indexBase);
glDrawElements(GL_POINTS, (GLsizei)(m_EntitiesDrawn), GL_UNSIGNED_SHORT, indexBase);
g_Renderer.GetStats().m_DrawCalls++;
CVertexBuffer::Unbind();
+1 -2
View File
@@ -124,8 +124,7 @@ void DrawTexture(CShaderProgramPtr shader, float angle, float x, float y, float
shader->VertexPointer(3, GL_FLOAT, 0, quadVerts);
shader->AssertPointersBound();
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_TRIANGLES, 0, 6);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
} // anonymous namespace
+2 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -204,8 +204,7 @@ void CDecalRData::RenderDecals(
}
u8* indexBase = nullptr;
if (!g_Renderer.m_SkipSubmit)
glDrawElements(GL_TRIANGLES, batch.indices->m_Count, GL_UNSIGNED_SHORT, indexBase + sizeof(u16) * (batch.indices->m_Index));
glDrawElements(GL_TRIANGLES, batch.indices->m_Count, GL_UNSIGNED_SHORT, indexBase + sizeof(u16) * (batch.indices->m_Index));
// bump stats
g_Renderer.m_Stats.m_DrawCalls++;
+5 -8
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -226,16 +226,13 @@ void ShaderModelVertexRenderer::RenderModel(const CShaderProgramPtr& shader, int
// render the lot
size_t numFaces = mdldef->GetNumFaces();
if (!g_Renderer.m_SkipSubmit)
{
// Draw with DrawRangeElements where available, since it might be more efficient
// Draw with DrawRangeElements where available, since it might be more efficient
#if CONFIG2_GLES
glDrawElements(GL_TRIANGLES, (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, indexBase);
glDrawElements(GL_TRIANGLES, (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, indexBase);
#else
glDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdldef->GetNumVertices()-1,
(GLsizei)numFaces*3, GL_UNSIGNED_SHORT, indexBase);
glDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdldef->GetNumVertices()-1,
(GLsizei)numFaces*3, GL_UNSIGNED_SHORT, indexBase);
#endif
}
// bump stats
g_Renderer.m_Stats.m_DrawCalls++;
+5 -8
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -374,16 +374,13 @@ void InstancingModelRenderer::RenderModel(const CShaderProgramPtr& shader, int U
// render the lot
size_t numFaces = mdldef->GetNumFaces();
if (!g_Renderer.m_SkipSubmit)
{
// Draw with DrawRangeElements where available, since it might be more efficient
// Draw with DrawRangeElements where available, since it might be more efficient
#if CONFIG2_GLES
glDrawElements(GL_TRIANGLES, (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldefIndexBase);
glDrawElements(GL_TRIANGLES, (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldefIndexBase);
#else
glDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)m->imodeldef->m_Array.GetNumVertices()-1,
(GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldefIndexBase);
glDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)m->imodeldef->m_Array.GetNumVertices()-1,
(GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldefIndexBase);
#endif
}
// bump stats
g_Renderer.m_Stats.m_DrawCalls++;
+11 -21
View File
@@ -790,14 +790,11 @@ void CPatchRData::RenderBases(
BatchElements& batch = it->second;
if (!g_Renderer.m_SkipSubmit)
{
// Don't use glMultiDrawElements here since it doesn't have a significant
// performance impact and it suffers from various driver bugs (e.g. it breaks
// in Mesa 7.10 swrast with index VBOs)
for (size_t i = 0; i < batch.first.size(); ++i)
glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
}
// Don't use glMultiDrawElements here since it doesn't have a significant
// performance impact and it suffers from various driver bugs (e.g. it breaks
// in Mesa 7.10 swrast with index VBOs)
for (size_t i = 0; i < batch.first.size(); ++i)
glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
g_Renderer.m_Stats.m_DrawCalls++;
g_Renderer.m_Stats.m_TerrainTris += std::accumulate(batch.first.begin(), batch.first.end(), 0) / 3;
@@ -1012,11 +1009,8 @@ void CPatchRData::RenderBlends(
BatchElements& batch = it->second;
if (!g_Renderer.m_SkipSubmit)
{
for (size_t i = 0; i < batch.first.size(); ++i)
glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
}
for (size_t i = 0; i < batch.first.size(); ++i)
glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
g_Renderer.m_Stats.m_DrawCalls++;
g_Renderer.m_Stats.m_BlendSplats++;
@@ -1085,11 +1079,8 @@ void CPatchRData::RenderStreams(const std::vector<CPatchRData*>& patches, const
const StreamBatchElements& batch = batchIndexBuffer.second;
if (!g_Renderer.m_SkipSubmit)
{
for (size_t i = 0; i < batch.first.size(); ++i)
glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
}
for (size_t i = 0; i < batch.first.size(); ++i)
glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
g_Renderer.m_Stats.m_DrawCalls++;
g_Renderer.m_Stats.m_TerrainTris += std::accumulate(batch.first.begin(), batch.first.end(), 0) / 3;
@@ -1155,8 +1146,7 @@ void CPatchRData::RenderSides(const std::vector<CPatchRData*>& patches, const CS
shader->AssertPointersBound();
if (!g_Renderer.m_SkipSubmit)
glDrawArrays(GL_TRIANGLE_STRIP, patch->m_VBSides->m_Index, (GLsizei)patch->m_VBSides->m_Count);
glDrawArrays(GL_TRIANGLE_STRIP, patch->m_VBSides->m_Index, (GLsizei)patch->m_VBSides->m_Count);
// bump stats
g_Renderer.m_Stats.m_DrawCalls++;
@@ -1387,7 +1377,7 @@ void CPatchRData::RenderWater(CShaderProgramPtr& shader, bool onlyShore, bool fi
{
ASSERT(m_UpdateFlags==0);
if (g_Renderer.m_SkipSubmit || (!m_VBWater && !m_VBWaterShore))
if (!m_VBWater && !m_VBWaterShore)
return;
#if !CONFIG2_GLES
-1
View File
@@ -404,7 +404,6 @@ CRenderer::CRenderer()
m_ClearColor[0] = m_ClearColor[1] = m_ClearColor[2] = m_ClearColor[3] = 0;
m_DisplayTerrainPriorities = false;
m_SkipSubmit = false;
CStr skystring = "0 0 0";
CColor skycolor;
-12
View File
@@ -271,22 +271,12 @@ public:
*/
void ResetState();
/**
* m_SkipSubmit: Disable the actual submission of rendering commands to OpenGL.
* All state setup is still performed as usual.
*/
bool DoSkipSubmit() const { return m_SkipSubmit; }
protected:
friend class CVertexBuffer;
friend class CPatchRData;
friend class CDecalRData;
friend class ModelRenderer;
friend class HWLightingModelRenderer;
friend class ShaderModelVertexRenderer;
friend class InstancingModelRenderer;
friend class TerrainRenderer;
friend class WaterRenderer;
friend class CRenderingOptions;
//BEGIN: Implementation of SceneCollector
@@ -388,8 +378,6 @@ protected:
* Enable rendering of terrain tile priority text overlay, for debugging.
*/
bool m_DisplayTerrainPriorities;
bool m_SkipSubmit;
};
#endif // INCLUDED_RENDERER
+1 -1
View File
@@ -842,7 +842,7 @@ void WaterManager::RenderWaves(const CFrustum& frustrum)
#if CONFIG2_GLES
#warning Fix WaterManager::RenderWaves on GLES
#else
if (g_Renderer.DoSkipSubmit() || !m_WaterFancyEffects)
if (!m_WaterFancyEffects)
return;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FancyEffectsFBO);