1
0
forked from 0ad/0ad

Removes ogl_WarnIfError from regular renderer code.

This was SVN commit r26850.
This commit is contained in:
Vladislav Belov 2022-05-02 21:52:21 +00:00
parent a493a9f07f
commit 3ed4eaf247
28 changed files with 13 additions and 87 deletions

View File

@ -19,7 +19,6 @@
#define INCLUDED_PARTICLEEMITTERTYPE
#include "graphics/Texture.h"
#include "lib/ogl.h"
#include "lib/file/vfs/vfs_path.h"
#include "maths/BoundingBoxAligned.h"

View File

@ -24,7 +24,6 @@
#include "graphics/TerrainProperties.h"
#include "graphics/TerrainTextureManager.h"
#include "graphics/TextureManager.h"
#include "lib/ogl.h"
#include "lib/utf8.h"
#include "ps/CLogger.h"
#include "ps/CStrInternStatic.h"

View File

@ -24,7 +24,6 @@
#include "graphics/TextureManager.h"
#include "lib/allocators/shared_ptr.h"
#include "lib/bits.h"
#include "lib/ogl.h"
#include "lib/tex/tex.h"
#include "lib/timer.h"
#include "ps/CLogger.h"

View File

@ -23,7 +23,6 @@
#include "graphics/FontManager.h"
#include "graphics/ShaderProgram.h"
#include "graphics/TextureManager.h"
#include "lib/ogl.h"
#include "maths/Matrix3D.h"
#include "ps/CStrIntern.h"
#include "ps/CStrInternStatic.h"

View File

@ -21,7 +21,6 @@
#include "lib/external_libraries/libsdl.h"
#include "lib/file/vfs/vfs.h"
#include "lib/tex/tex.h"
#include "lib/ogl.h"
#include "ps/XML/Xeromyces.h"
class TestTextureManager : public CxxTest::TestSuite

View File

@ -35,7 +35,6 @@
#include "gui/GUIMatrix.h"
#include "lib/bits.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/ogl.h"
#include "lib/timer.h"
#include "maths/MathUtil.h"
#include "ps/CLogger.h"

View File

@ -36,7 +36,6 @@ that of Atlas depending on commandline parameters.
#include "lib/secure_crt.h"
#include "lib/frequency_filter.h"
#include "lib/input.h"
#include "lib/ogl.h"
#include "lib/timer.h"
#include "lib/external_libraries/libsdl.h"
@ -361,8 +360,6 @@ static void Frame()
g_Profiler2.IncrementFrameNumber();
PROFILE2_ATTR("%d", g_Profiler2.GetFrameNumber());
ogl_WarnIfError();
// get elapsed time
const double time = timer_Time();
g_frequencyFilter->Update(time);
@ -420,12 +417,8 @@ static void Frame()
if (g_NetClient)
g_NetClient->Poll();
ogl_WarnIfError();
g_GUI->TickObjects();
ogl_WarnIfError();
if (g_RLInterface)
g_RLInterface->TryApplyMessage();
@ -444,7 +437,6 @@ static void Frame()
g_UserReporter.Update();
g_Console->Update(realTimeSinceLastFrame);
ogl_WarnIfError();
if (g_SoundManager)
g_SoundManager->IdleTask();

View File

@ -25,7 +25,6 @@
#include "gui/CGUI.h"
#include "gui/GUIManager.h"
#include "lib/code_generation.h"
#include "lib/ogl.h"
#include "lib/timer.h"
#include "lib/utf8.h"
#include "maths/MathUtil.h"

View File

@ -22,7 +22,6 @@
#include "graphics/Canvas2D.h"
#include "graphics/FontMetrics.h"
#include "graphics/TextRenderer.h"
#include "lib/ogl.h"
#include "lib/os_path.h"
#include "lib/timer.h"
#include "lib/utf8.h"

View File

@ -635,8 +635,6 @@ void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& i
RunHardwareDetection();
ogl_WarnIfError();
// Optionally start profiler GPU timings automatically
// (By default it's only enabled by a hotkey, for performance/compatibility)
bool profilerGPUEnable = false;
@ -670,8 +668,6 @@ void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& i
);
}
ogl_WarnIfError();
g_RenderingOptions.ReadConfigAndSetupHooks();
// create renderer
@ -679,8 +675,6 @@ void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& i
InitInput();
ogl_WarnIfError();
// TODO: Is this the best place for this?
if (VfsDirectoryExists(L"maps/"))
CXeromyces::AddValidator(g_VFS, "map", "maps/scenario.rng");

View File

@ -23,7 +23,6 @@
#include "gui/GUIManager.h"
#include "lib/config2.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/ogl.h"
#include "lib/tex/tex.h"
#include "ps/CConsole.h"
#include "ps/CLogger.h"

View File

@ -23,7 +23,6 @@
#include "graphics/Color.h"
#include "graphics/ShaderManager.h"
#include "graphics/ShaderProgram.h"
#include "lib/ogl.h"
#include "maths/BoundingBoxAligned.h"
#include "maths/Brush.h"
#include "maths/Matrix3D.h"

View File

@ -25,7 +25,6 @@
#include "graphics/ModelDef.h"
#include "graphics/ShaderProgram.h"
#include "lib/bits.h"
#include "lib/ogl.h"
#include "lib/sysdep/rtl.h"
#include "maths/Vector3D.h"
#include "renderer/Renderer.h"

View File

@ -22,7 +22,6 @@
#include "graphics/LightEnv.h"
#include "graphics/Model.h"
#include "graphics/ModelDef.h"
#include "lib/ogl.h"
#include "maths/Vector3D.h"
#include "maths/Vector4D.h"
#include "ps/CLogger.h"

View File

@ -27,7 +27,6 @@
#include "lib/allocators/DynamicArena.h"
#include "lib/allocators/STLAllocators.h"
#include "lib/hash.h"
#include "lib/ogl.h"
#include "maths/Vector3D.h"
#include "maths/Vector4D.h"
#include "ps/CLogger.h"

View File

@ -26,7 +26,6 @@
#include "graphics/Terrain.h"
#include "graphics/TextureManager.h"
#include "lib/hash.h"
#include "lib/ogl.h"
#include "maths/MathUtil.h"
#include "maths/Quaternion.h"
#include "ps/CStrInternStatic.h"

View File

@ -23,7 +23,6 @@
#include "graphics/LightEnv.h"
#include "graphics/ShaderManager.h"
#include "lib/bits.h"
#include "lib/ogl.h"
#include "maths/MathUtil.h"
#include "ps/ConfigDB.h"
#include "ps/CLogger.h"

View File

@ -24,7 +24,6 @@
#include "graphics/LOSTexture.h"
#include "graphics/Model.h"
#include "graphics/TextureManager.h"
#include "lib/ogl.h"
#include "maths/Vector3D.h"
#include "maths/Vector4D.h"
#include "maths/Matrix3D.h"

View File

@ -27,7 +27,6 @@
#include "graphics/TerrainTextureManager.h"
#include "i18n/L10n.h"
#include "lib/allocators/shared_ptr.h"
#include "lib/ogl.h"
#include "lib/tex/tex.h"
#include "gui/GUIManager.h"
#include "ps/CConsole.h"
@ -440,7 +439,6 @@ void CRenderer::RenderFrameImpl(const bool renderGUI, const bool renderLogger)
PROFILE3("render");
g_Profiler2.RecordGPUFrameStart();
ogl_WarnIfError();
g_TexMan.UploadResourcesIfNeeded(m->deviceCommandContext.get());
@ -456,12 +454,9 @@ void CRenderer::RenderFrameImpl(const bool renderGUI, const bool renderLogger)
// start new frame
BeginFrame();
ogl_WarnIfError();
if (g_Game && g_Game->IsGameStarted())
{
g_Game->GetView()->Render();
ogl_WarnIfError();
}
m->deviceCommandContext->SetFramebuffer(
@ -471,13 +466,11 @@ void CRenderer::RenderFrameImpl(const bool renderGUI, const bool renderLogger)
if (g_AtlasGameLoop && g_AtlasGameLoop->view)
{
g_AtlasGameLoop->view->DrawCinemaPathTool();
ogl_WarnIfError();
}
if (g_Game && g_Game->IsGameStarted())
{
g_Game->GetView()->GetCinema()->Render();
ogl_WarnIfError();
}
RenderFrame2D(renderGUI, renderLogger);
@ -493,10 +486,7 @@ void CRenderer::RenderFrameImpl(const bool renderGUI, const bool renderLogger)
PROFILE2_ATTR("blend splats: %zu", stats.m_BlendSplats);
PROFILE2_ATTR("particles: %zu", stats.m_Particles);
ogl_WarnIfError();
g_Profiler2.RecordGPUFrameEnd();
ogl_WarnIfError();
}
void CRenderer::RenderFrame2D(const bool renderGUI, const bool renderLogger)
@ -511,34 +501,29 @@ void CRenderer::RenderFrame2D(const bool renderGUI, const bool renderLogger)
// All GUI elements are drawn in Z order to render semi-transparent
// objects correctly.
g_GUI->Draw(canvas);
ogl_WarnIfError();
}
// If we're in Atlas game view, render special overlays (e.g. editor bandbox).
if (g_AtlasGameLoop && g_AtlasGameLoop->view)
{
g_AtlasGameLoop->view->DrawOverlays(canvas);
ogl_WarnIfError();
}
{
GPU_SCOPED_LABEL(m->deviceCommandContext.get(), "Render console");
g_Console->Render(canvas);
ogl_WarnIfError();
}
if (renderLogger)
{
GPU_SCOPED_LABEL(m->deviceCommandContext.get(), "Render logger");
g_Logger->Render(canvas);
ogl_WarnIfError();
}
{
GPU_SCOPED_LABEL(m->deviceCommandContext.get(), "Render profiler");
// Profile information
g_ProfileViewer.RenderProfile(canvas);
ogl_WarnIfError();
}
}
@ -638,8 +623,6 @@ void CRenderer::RenderBigScreenShot(const bool needsPresent)
return;
}
ogl_WarnIfError();
CCamera oldCamera = *g_Game->GetView()->GetCamera();
// Resize various things so that the sizes and aspect ratios are correct

View File

@ -587,20 +587,17 @@ void CSceneRenderer::RenderReflections(
CShaderDefines reflectionsContext = context;
reflectionsContext.Add(str_PASS_REFLECTIONS, str_1);
// Render terrain and models
RenderPatches(deviceCommandContext, reflectionsContext, CULL_REFLECTIONS);
ogl_WarnIfError();
RenderModels(deviceCommandContext, reflectionsContext, CULL_REFLECTIONS);
ogl_WarnIfError();
RenderTransparentModels(deviceCommandContext, reflectionsContext, CULL_REFLECTIONS, TRANSPARENT);
ogl_WarnIfError();
// Particles are always oriented to face the camera in the vertex shader,
// so they don't need the inverted cull face.
if (g_RenderingOptions.GetParticles())
{
RenderParticles(deviceCommandContext, CULL_REFLECTIONS);
ogl_WarnIfError();
}
deviceCommandContext->SetScissors(0, nullptr);
@ -660,14 +657,12 @@ void CSceneRenderer::RenderRefractions(
// Render terrain and models
RenderPatches(deviceCommandContext, context, CULL_REFRACTIONS);
ogl_WarnIfError();
// Render debug-related terrain overlays to make it visible under water.
ITerrainOverlay::RenderOverlaysBeforeWater(deviceCommandContext);
ogl_WarnIfError();
RenderModels(deviceCommandContext, context, CULL_REFRACTIONS);
ogl_WarnIfError();
RenderTransparentModels(deviceCommandContext, context, CULL_REFRACTIONS, TRANSPARENT_OPAQUE);
ogl_WarnIfError();
deviceCommandContext->SetScissors(0, nullptr);
@ -766,8 +761,6 @@ void CSceneRenderer::RenderSubmissions(
int cullGroup = CULL_DEFAULT;
ogl_WarnIfError();
// Set the camera
g_Renderer.SetViewport(m_ViewCamera.GetViewPort());
@ -793,8 +786,6 @@ void CSceneRenderer::RenderSubmissions(
RenderShadowMap(deviceCommandContext, context);
}
ogl_WarnIfError();
if (m->waterManager.m_RenderWater)
{
if (waterScissor.GetVolume() > 0 && m->waterManager.WillRenderFancyWater())
@ -844,18 +835,14 @@ void CSceneRenderer::RenderSubmissions(
// render submitted patches and models
RenderPatches(deviceCommandContext, context, cullGroup);
ogl_WarnIfError();
// render debug-related terrain overlays
ITerrainOverlay::RenderOverlaysBeforeWater(deviceCommandContext);
ogl_WarnIfError();
// render other debug-related overlays before water (so they can be seen when underwater)
m->overlayRenderer.RenderOverlaysBeforeWater(deviceCommandContext);
ogl_WarnIfError();
RenderModels(deviceCommandContext, context, cullGroup);
ogl_WarnIfError();
// render water
if (m->waterManager.m_RenderWater && g_Game && waterScissor.GetVolume() > 0)
@ -864,45 +851,36 @@ void CSceneRenderer::RenderSubmissions(
{
// Render transparent stuff, but only the solid parts that can occlude block water.
RenderTransparentModels(deviceCommandContext, context, cullGroup, TRANSPARENT_OPAQUE);
ogl_WarnIfError();
m->terrainRenderer.RenderWater(deviceCommandContext, context, cullGroup, &m->shadow);
ogl_WarnIfError();
// Render transparent stuff again, but only the blended parts that overlap water.
RenderTransparentModels(deviceCommandContext, context, cullGroup, TRANSPARENT_BLEND);
ogl_WarnIfError();
}
else
{
m->terrainRenderer.RenderWater(deviceCommandContext, context, cullGroup, &m->shadow);
ogl_WarnIfError();
// Render transparent stuff, so it can overlap models/terrain.
RenderTransparentModels(deviceCommandContext, context, cullGroup, TRANSPARENT);
ogl_WarnIfError();
}
}
else
{
// render transparent stuff, so it can overlap models/terrain
RenderTransparentModels(deviceCommandContext, context, cullGroup, TRANSPARENT);
ogl_WarnIfError();
}
// render debug-related terrain overlays
ITerrainOverlay::RenderOverlaysAfterWater(deviceCommandContext, cullGroup);
ogl_WarnIfError();
// render some other overlays after water (so they can be displayed on top of water)
m->overlayRenderer.RenderOverlaysAfterWater(deviceCommandContext);
ogl_WarnIfError();
// particles are transparent so render after water
if (g_RenderingOptions.GetParticles())
{
RenderParticles(deviceCommandContext, cullGroup);
ogl_WarnIfError();
}
if (postprocManager.IsEnabled())
@ -931,7 +909,6 @@ void CSceneRenderer::RenderSubmissions(
// render overlays that should appear on top of all other objects
m->overlayRenderer.RenderForegroundOverlays(deviceCommandContext, m_ViewCamera);
ogl_WarnIfError();
}
void CSceneRenderer::EndFrame()
@ -964,8 +941,6 @@ void CSceneRenderer::RenderTextOverlays(CCanvas2D& canvas)
if (m_DisplayTerrainPriorities)
m->terrainRenderer.RenderPriorities(canvas, CULL_DEFAULT);
ogl_WarnIfError();
}
// SetSceneCamera: setup projection and transform of camera and adjust viewport to current view
@ -1155,8 +1130,6 @@ void CSceneRenderer::RenderScene(
m_CurrentCullGroup = -1;
ogl_WarnIfError();
RenderSubmissions(deviceCommandContext, waterScissor);
m_CurrentScene = NULL;

View File

@ -24,7 +24,6 @@
#include "graphics/ShaderManager.h"
#include "gui/GUIMatrix.h"
#include "lib/bits.h"
#include "lib/ogl.h"
#include "maths/BoundingBoxAligned.h"
#include "maths/Brush.h"
#include "maths/Frustum.h"
@ -722,8 +721,6 @@ void ShadowMap::RenderDebugBounds()
g_Renderer.GetDebugRenderer().DrawBrush(frustumBrush, CColor(1.0f, 0.0f, 0.0f, 0.1f));
g_Renderer.GetDebugRenderer().DrawBrush(frustumBrush, CColor(1.0f, 0.0f, 0.0f, 0.1f), true);
}
ogl_WarnIfError();
}
int ShadowMap::GetCascadeCount() const

View File

@ -24,7 +24,6 @@
#include "graphics/ShaderProgram.h"
#include "graphics/Terrain.h"
#include "lib/bits.h"
#include "lib/ogl.h"
#include "maths/MathUtil.h"
#include "ps/CStrInternStatic.h"
#include "ps/Game.h"

View File

@ -19,7 +19,6 @@
#include "VertexBuffer.h"
#include "lib/ogl.h"
#include "lib/sysdep/cpu.h"
#include "ps/CLogger.h"
#include "ps/Errors.h"

View File

@ -19,7 +19,6 @@
#include "VertexBufferManager.h"
#include "lib/ogl.h"
#include "ps/CLogger.h"
#define DUMP_VB_STATS 0 // for debugging

View File

@ -23,7 +23,6 @@
#include "graphics/ShaderProgram.h"
#include "lib/bits.h"
#include "lib/timer.h"
#include "lib/ogl.h"
#include "maths/MathUtil.h"
#include "maths/Vector2D.h"
#include "ps/CLogger.h"

View File

@ -334,6 +334,7 @@ void CDeviceCommandContext::UploadBufferRegion(
{
// Tell the driver that it can reallocate the whole VBO
glBufferDataARB(target, buffer->GetSize(), nullptr, buffer->IsDynamic() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
ogl_WarnIfError();
// (In theory, glMapBufferRange with GL_MAP_INVALIDATE_BUFFER_BIT could be used
// here instead of glBufferData(..., NULL, ...) plus glMapBuffer(), but with
@ -348,6 +349,7 @@ void CDeviceCommandContext::UploadBufferRegion(
else
{
glBufferSubDataARB(target, dataOffset, dataSize, data);
ogl_WarnIfError();
}
}
@ -401,6 +403,7 @@ void CDeviceCommandContext::BindTexture(
glBindTexture(m_BoundTextures[unit].target, 0);
if (m_BoundTextures[unit].handle != handle)
glBindTexture(target, handle);
ogl_WarnIfError();
m_BoundTextures[unit] = {target, handle};
}
@ -422,6 +425,7 @@ void CDeviceCommandContext::BindBuffer(const CBuffer::Type type, CBuffer* buffer
const GLenum target = BufferTypeToGLTarget(type);
const GLuint handle = buffer ? buffer->GetHandle() : 0;
glBindBufferARB(target, handle);
ogl_WarnIfError();
const size_t cacheIndex = static_cast<size_t>(type);
ENSURE(cacheIndex < m_BoundBuffers.size());
m_BoundBuffers[cacheIndex].second = handle;
@ -703,6 +707,8 @@ void CDeviceCommandContext::SetGraphicsPipelineStateImpl(
}
#endif
ogl_WarnIfError();
m_GraphicsPipelineStateDesc = pipelineStateDesc;
}
@ -726,6 +732,7 @@ void CDeviceCommandContext::BlitFramebuffer(
0, 0, sourceFramebuffer->GetWidth(), sourceFramebuffer->GetHeight(),
(sourceFramebuffer->GetAttachmentMask() & destinationFramebuffer->GetAttachmentMask()),
GL_NEAREST);
ogl_WarnIfError();
#endif
}
@ -776,6 +783,7 @@ void CDeviceCommandContext::SetFramebuffer(CFramebuffer* framebuffer)
ENSURE(framebuffer->GetHandle() == 0 || (framebuffer->GetWidth() > 0 && framebuffer->GetHeight() > 0));
m_Framebuffer = framebuffer;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer->GetHandle());
ogl_WarnIfError();
}
void CDeviceCommandContext::ReadbackFramebufferSync(
@ -806,6 +814,7 @@ void CDeviceCommandContext::SetScissors(const uint32_t scissorCount, const Rect*
glScissor(m_Scissors[0].x, m_Scissors[0].y, m_Scissors[0].width, m_Scissors[0].height);
}
}
ogl_WarnIfError();
m_ScissorCount = scissorCount;
}
@ -813,6 +822,7 @@ void CDeviceCommandContext::SetViewports(const uint32_t viewportCount, const Rec
{
ENSURE(viewportCount == 1);
glViewport(viewports[0].x, viewports[0].y, viewports[0].width, viewports[0].height);
ogl_WarnIfError();
}
void CDeviceCommandContext::SetVertexAttributeFormat(

View File

@ -536,8 +536,6 @@ void ActorViewer::Render()
}
g_Renderer.EndFrame();
ogl_WarnIfError();
}
void ActorViewer::Update(float simFrameLength, float realFrameLength)

View File

@ -28,7 +28,6 @@
#include "graphics/ObjectManager.h"
#include "gui/GUIManager.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/ogl.h"
#include "lib/timer.h"
#include "maths/MathUtil.h"
#include "ps/CConsole.h"