Removes unused OGL legacy
Some checks failed
checkrefs / lfscheck (push) Has been cancelled
checkrefs / checkrefs (push) Has been cancelled
lint / cppcheck (push) Has been cancelled
lint / copyright (push) Has been cancelled
lint / jenkinsfiles (push) Has been cancelled
pre-commit / build (push) Has been cancelled

This commit is contained in:
Vladislav Belov 2026-07-09 22:53:30 +02:00
parent 552d91e92a
commit 92ee2dba9e
No known key found for this signature in database
GPG key ID: 353545E45DB9CCB3
12 changed files with 65 additions and 166 deletions

View file

@ -1,81 +0,0 @@
/* Copyright (C) 2026 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "precompiled.h"
#include "ogl.h"
#include "lib/config2.h"
#include "lib/debug.h"
#include "ps/CLogger.h"
#include <cstdarg>
#include <cstring>
const char* ogl_GetErrorName(GLenum err)
{
#define E(e) case e: return #e;
switch (err)
{
E(GL_INVALID_ENUM)
E(GL_INVALID_VALUE)
E(GL_INVALID_OPERATION)
#if !CONFIG2_GLES
E(GL_STACK_OVERFLOW)
E(GL_STACK_UNDERFLOW)
#endif
E(GL_OUT_OF_MEMORY)
E(GL_INVALID_FRAMEBUFFER_OPERATION)
default: return "Unknown GL error";
}
#undef E
}
static void dump_gl_error(GLenum err)
{
debug_printf("OGL| %s (%04x)\n", ogl_GetErrorName(err), err);
}
void ogl_WarnIfErrorLoc(const char *file, int line)
{
// glGetError may return multiple errors, so we poll it in a loop.
// the debug_printf should only happen once (if this is set), though.
bool error_enountered = false;
GLenum first_error = 0;
for(;;)
{
GLenum err = glGetError();
if(err == GL_NO_ERROR)
break;
if(!error_enountered)
first_error = err;
error_enountered = true;
dump_gl_error(err);
}
if(error_enountered)
debug_printf("%s:%d: OpenGL error(s) occurred: %s (%04x)\n", file, line, ogl_GetErrorName(first_error), (unsigned int)first_error);
}

View file

@ -1,72 +0,0 @@
/* Copyright (C) 2026 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* OpenGL helper functions.
*/
#ifndef INCLUDED_OGL
#define INCLUDED_OGL
#include "lib/code_annotation.h"
#include "lib/config2.h" // CONFIG2_GLES
#if CONFIG2_GLES
# include "external_libraries/opengles2_wrapper.h"
#else
# include <glad/gl.h>
#endif
//-----------------------------------------------------------------------------
// errors
/**
* raise a warning (break into the debugger) if an OpenGL error is pending.
* resets the OpenGL error state afterwards.
*
* when an error is reported, insert calls to this in a binary-search scheme
* to quickly narrow down the actual error location.
*
* reports a bogus invalid_operation error if called before OpenGL is
* initialized, so don't!
*
* disabled in release mode for efficiency and to avoid annoying errors.
**/
extern void ogl_WarnIfErrorLoc(const char *file, int line);
#ifdef NDEBUG
# define ogl_WarnIfError()
#else
# define ogl_WarnIfError() ogl_WarnIfErrorLoc(__FILE__, __LINE__)
#endif
/**
* get a name of the error.
*
* useful for debug.
*
* @return read-only C string of unspecified length containing
* the error's name.
**/
extern const char* ogl_GetErrorName(GLenum err);
#endif // INCLUDED_OGL

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games. /* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -18,9 +18,15 @@
#ifndef INCLUDED_RENDERER_BACKEND_GL_BUFFER #ifndef INCLUDED_RENDERER_BACKEND_GL_BUFFER
#define INCLUDED_RENDERER_BACKEND_GL_BUFFER #define INCLUDED_RENDERER_BACKEND_GL_BUFFER
#include "lib/ogl.h" #include "lib/config2.h"
#include "renderer/backend/IBuffer.h" #include "renderer/backend/IBuffer.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>

View file

@ -24,7 +24,6 @@
#include "lib/config2.h" #include "lib/config2.h"
#include "lib/debug.h" #include "lib/debug.h"
#include "lib/external_libraries/libsdl.h" #include "lib/external_libraries/libsdl.h"
#include "lib/ogl.h"
#include "lib/secure_crt.h" #include "lib/secure_crt.h"
#include "ps/CLogger.h" #include "ps/CLogger.h"
#include "ps/ConfigDB.h" #include "ps/ConfigDB.h"
@ -41,6 +40,12 @@
#include "renderer/backend/gl/Texture.h" #include "renderer/backend/gl/Texture.h"
#include "scriptinterface/Object.h" #include "scriptinterface/Object.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <SDL_config.h> #include <SDL_config.h>
#include <SDL_error.h> #include <SDL_error.h>
#include <SDL_version.h> #include <SDL_version.h>

View file

@ -18,7 +18,7 @@
#ifndef INCLUDED_RENDERER_BACKEND_GL_DEVICE #ifndef INCLUDED_RENDERER_BACKEND_GL_DEVICE
#define INCLUDED_RENDERER_BACKEND_GL_DEVICE #define INCLUDED_RENDERER_BACKEND_GL_DEVICE
#include "lib/ogl.h" #include "lib/config2.h"
#include "ps/CStr.h" #include "ps/CStr.h"
#include "renderer/backend/Backend.h" #include "renderer/backend/Backend.h"
#include "renderer/backend/IBuffer.h" #include "renderer/backend/IBuffer.h"
@ -27,6 +27,12 @@
#include "renderer/backend/ITexture.h" #include "renderer/backend/ITexture.h"
#include "renderer/backend/gl/DeviceForward.h" #include "renderer/backend/gl/DeviceForward.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <js/TypeDecls.h> #include <js/TypeDecls.h>

View file

@ -19,13 +19,19 @@
#define INCLUDED_RENDERER_BACKEND_GL_DEVICECOMMANDCONTEXT #define INCLUDED_RENDERER_BACKEND_GL_DEVICECOMMANDCONTEXT
#include "graphics/Color.h" #include "graphics/Color.h"
#include "lib/ogl.h" #include "lib/config2.h"
#include "lib/types.h" #include "lib/types.h"
#include "renderer/backend/IBuffer.h" #include "renderer/backend/IBuffer.h"
#include "renderer/backend/IDeviceCommandContext.h" #include "renderer/backend/IDeviceCommandContext.h"
#include "renderer/backend/IShaderProgram.h" #include "renderer/backend/IShaderProgram.h"
#include "renderer/backend/PipelineState.h" #include "renderer/backend/PipelineState.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games. /* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify

View file

@ -19,9 +19,15 @@
#define INCLUDED_RENDERER_BACKEND_GL_FRAMEBUFFER #define INCLUDED_RENDERER_BACKEND_GL_FRAMEBUFFER
#include "graphics/Color.h" #include "graphics/Color.h"
#include "lib/ogl.h" #include "lib/config2.h"
#include "renderer/backend/IFramebuffer.h" #include "renderer/backend/IFramebuffer.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games. /* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -18,7 +18,13 @@
#ifndef INCLUDED_RENDERER_BACKEND_GL_MAPPING #ifndef INCLUDED_RENDERER_BACKEND_GL_MAPPING
#define INCLUDED_RENDERER_BACKEND_GL_MAPPING #define INCLUDED_RENDERER_BACKEND_GL_MAPPING
#include "lib/ogl.h" #include "lib/config2.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
namespace Renderer::Backend { enum class BlendFactor; } namespace Renderer::Backend { enum class BlendFactor; }
namespace Renderer::Backend { enum class BlendOp; } namespace Renderer::Backend { enum class BlendOp; }

View file

@ -20,7 +20,6 @@
#include "lib/code_annotation.h" #include "lib/code_annotation.h"
#include "lib/debug.h" #include "lib/debug.h"
#include "lib/ogl.h"
#include "ps/containers/StaticVector.h" #include "ps/containers/StaticVector.h"
#include "ps/CStr.h" #include "ps/CStr.h"
#include "ps/CStrIntern.h" #include "ps/CStrIntern.h"
@ -29,6 +28,12 @@
#include "renderer/backend/IBuffer.h" #include "renderer/backend/IBuffer.h"
#include "renderer/backend/IShaderProgram.h" #include "renderer/backend/IShaderProgram.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <cstdint> #include <cstdint>
#include <map> #include <map>
#include <memory> #include <memory>

View file

@ -18,10 +18,16 @@
#ifndef INCLUDED_RENDERER_BACKEND_GL_SWAPCHAIN #ifndef INCLUDED_RENDERER_BACKEND_GL_SWAPCHAIN
#define INCLUDED_RENDERER_BACKEND_GL_SWAPCHAIN #define INCLUDED_RENDERER_BACKEND_GL_SWAPCHAIN
#include "lib/ogl.h" #include "lib/config2.h"
#include "renderer/backend/gl/Framebuffer.h" #include "renderer/backend/gl/Framebuffer.h"
#include "renderer/backend/ISwapChain.h" #include "renderer/backend/ISwapChain.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games. /* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -18,10 +18,16 @@
#ifndef INCLUDED_RENDERER_BACKEND_GL_TEXTURE #ifndef INCLUDED_RENDERER_BACKEND_GL_TEXTURE
#define INCLUDED_RENDERER_BACKEND_GL_TEXTURE #define INCLUDED_RENDERER_BACKEND_GL_TEXTURE
#include "lib/ogl.h" #include "lib/config2.h"
#include "renderer/backend/Format.h" #include "renderer/backend/Format.h"
#include "renderer/backend/ITexture.h" #include "renderer/backend/ITexture.h"
#if CONFIG2_GLES
#include "external_libraries/opengles2_wrapper.h"
#else
#include <glad/gl.h>
#endif
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>