mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 15:11:46 +00:00
- moved the entire OpenGL backend into a separate namespace.
This commit is contained in:
parent
0c8b36e121
commit
118bc78fe3
31 changed files with 139 additions and 20 deletions
|
@ -50,6 +50,10 @@ extern bool vid_hdr_active;
|
|||
|
||||
CVAR(Int, gl_dither_bpc, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
||||
void FGLRenderer::RenderScreenQuad()
|
||||
{
|
||||
screen->mVertexData->Bind(gl_RenderState);
|
||||
|
@ -287,3 +291,4 @@ void FGLRenderer::ClearBorders()
|
|||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,6 +30,9 @@
|
|||
#include "gl_load/gl_interface.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Saves state modified by post processing shaders
|
||||
|
@ -133,3 +136,5 @@ FGLPostProcessState::~FGLPostProcessState()
|
|||
|
||||
glActiveTexture(activeTex);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,9 @@
|
|||
#include "c_cvars.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FGLPostProcessState
|
||||
{
|
||||
public:
|
||||
|
@ -35,4 +38,5 @@ private:
|
|||
GLint blendDestAlpha;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
CVAR(Int, gl_multisample, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Initialize render buffers and textures used in rendering passes
|
||||
|
@ -986,3 +989,5 @@ void FGLRenderBuffers::RenderEffect(const FString &name)
|
|||
|
||||
FGLDebug::PopGroup();
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,9 @@
|
|||
#include "gl/shaders/gl_shader.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class PPGLTexture
|
||||
{
|
||||
public:
|
||||
|
@ -168,3 +171,5 @@ private:
|
|||
|
||||
static bool FailedCreate;
|
||||
};
|
||||
|
||||
}
|
|
@ -66,6 +66,9 @@ EXTERN_CVAR(Bool, cl_capfps)
|
|||
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Renderer interface
|
||||
|
@ -378,3 +381,4 @@ void FGLRenderer::BeginFrame()
|
|||
mSaveBuffers->Setup(SAVEPICWIDTH, SAVEPICHEIGHT, SAVEPICWIDTH, SAVEPICHEIGHT);
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
#include "vectors.h"
|
||||
#include "r_renderer.h"
|
||||
#include "r_data/matrix.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "hwrenderer/scene/hw_portal.h"
|
||||
#include "hwrenderer/dynlights/hw_shadowmap.h"
|
||||
#include <functional>
|
||||
|
@ -18,11 +19,9 @@ struct particle_t;
|
|||
class FCanvasTexture;
|
||||
class FFlatVertexBuffer;
|
||||
class FSkyVertexBuffer;
|
||||
class OpenGLFrameBuffer;
|
||||
class FShaderManager;
|
||||
class HWPortal;
|
||||
class FLightBuffer;
|
||||
class FSamplerManager;
|
||||
class DPSprite;
|
||||
class FGLRenderBuffers;
|
||||
class FPresentShader;
|
||||
|
@ -32,11 +31,17 @@ class FPresent3DRowShader;
|
|||
class FGL2DDrawer;
|
||||
class FHardwareTexture;
|
||||
class FShadowMapShader;
|
||||
class FCustomPostProcessShaders;
|
||||
class SWSceneDrawer;
|
||||
class GLViewpointBuffer;
|
||||
struct FRenderViewpoint;
|
||||
class FPresentShaderBase;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
class FSamplerManager;
|
||||
class FCustomPostProcessShaders;
|
||||
class OpenGLFrameBuffer;
|
||||
|
||||
#define NOQUEUE nullptr // just some token to be used as a placeholder
|
||||
|
||||
class FGLRenderer
|
||||
|
@ -129,4 +134,5 @@ struct TexFilter_s
|
|||
|
||||
extern FGLRenderer *GLRenderer;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
FGLRenderState gl_RenderState;
|
||||
|
||||
static VSMatrix identityMatrix(1);
|
||||
|
@ -575,3 +578,4 @@ bool FGLRenderState::SetDepthClamp(bool on)
|
|||
return res;
|
||||
}
|
||||
|
||||
}
|
|
@ -34,6 +34,9 @@
|
|||
#include "r_data/r_translate.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FShader;
|
||||
struct GLSectorPlane;
|
||||
extern TArray<VSMatrix> gl_MatrixStack;
|
||||
|
@ -167,4 +170,6 @@ public:
|
|||
|
||||
extern FGLRenderState gl_RenderState;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -73,6 +73,9 @@ EXTERN_CVAR (Float, r_visibility)
|
|||
EXTERN_CVAR (Bool, r_drawvoxels)
|
||||
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// gl_drawscene - this function renders the scene from the current
|
||||
|
@ -215,3 +218,4 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came
|
|||
return mainvp.sector;
|
||||
}
|
||||
|
||||
}
|
|
@ -31,6 +31,7 @@
|
|||
#include "hwrenderer/utility/hw_vrmodes.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "hwrenderer/postprocessing/hw_presentshader.h"
|
||||
#include "hwrenderer/postprocessing/hw_present3dRowshader.h"
|
||||
|
||||
|
@ -41,6 +42,9 @@ EXTERN_CVAR(Float, vid_contrast)
|
|||
EXTERN_CVAR(Int, gl_satformula)
|
||||
EXTERN_CVAR(Int, gl_dither_bpc)
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -364,3 +368,4 @@ void FGLRenderer::PresentStereo()
|
|||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -34,6 +34,10 @@
|
|||
|
||||
CVAR(Bool, gl_custompost, true, 0)
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
||||
FCustomPostProcessShaders::FCustomPostProcessShaders()
|
||||
{
|
||||
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
||||
|
@ -242,3 +246,5 @@ void PostProcessShaderInstance::BindTextures()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
struct PostProcessShader;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
||||
class PostProcessShaderInstance
|
||||
{
|
||||
public:
|
||||
|
@ -40,3 +44,6 @@ private:
|
|||
FCustomPostProcessShaders(const FCustomPostProcessShaders &) = delete;
|
||||
FCustomPostProcessShaders &operator=(const FCustomPostProcessShaders &) = delete;
|
||||
};
|
||||
|
||||
|
||||
}
|
|
@ -43,6 +43,12 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
||||
extern TArray<UserShaderDesc> usershaders;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
||||
bool FShader::Load(const char * name, const char * vert_prog_lump, const char * frag_prog_lump, const char * proc_prog_lump, const char * light_fragprog, const char * defines)
|
||||
{
|
||||
static char buffer[10000];
|
||||
|
@ -465,8 +471,6 @@ static const FDefaultShader defaultshaders[]=
|
|||
{nullptr,nullptr,nullptr,nullptr}
|
||||
};
|
||||
|
||||
TArray<UserShaderDesc> usershaders;
|
||||
|
||||
struct FEffectShader
|
||||
{
|
||||
const char *ShaderName;
|
||||
|
@ -667,3 +671,4 @@ void gl_DestroyUserShaders()
|
|||
// todo
|
||||
}
|
||||
|
||||
}
|
|
@ -28,9 +28,12 @@
|
|||
|
||||
extern bool gl_shaderactive;
|
||||
|
||||
class FShaderCollection;
|
||||
struct HWViewpointUniforms;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
class FShaderCollection;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -341,5 +344,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
#include "hwrenderer/utility/hw_shaderpatcher.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
FShaderProgram::FShaderProgram()
|
||||
{
|
||||
for (int i = 0; i < NumShaderTypes; i++)
|
||||
|
@ -249,3 +252,5 @@ FString FShaderProgram::PatchShader(ShaderType type, const FString &code, const
|
|||
|
||||
return patchedCode;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,9 @@
|
|||
#include "gl_shader.h"
|
||||
#include "hwrenderer/postprocessing/hw_shaderprogram.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FShaderProgram : public IShaderProgram
|
||||
{
|
||||
public:
|
||||
|
@ -37,3 +40,5 @@ private:
|
|||
GLuint mShaders[NumShaderTypes];
|
||||
TArray<std::pair<FString, int>> samplerstobind;
|
||||
};
|
||||
|
||||
}
|
|
@ -28,6 +28,9 @@
|
|||
#include "gl_buffers.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// basic buffer implementation
|
||||
|
@ -211,3 +214,5 @@ void GLDataBuffer::BindBase()
|
|||
{
|
||||
glBindBufferBase(mUseType, mBindingPoint, mBufferId);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,9 @@
|
|||
#pragma warning(disable:4250)
|
||||
#endif
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class GLBuffer : virtual public IBuffer
|
||||
{
|
||||
protected:
|
||||
|
@ -66,3 +69,4 @@ public:
|
|||
void BindBase() override;
|
||||
};
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
CUSTOM_CVAR(Int, gl_debug_level, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (!FGLDebug::HasDebugApi())
|
||||
if (!OpenGLRenderer::FGLDebug::HasDebugApi())
|
||||
{
|
||||
Printf("No OpenGL debug support detected.\n");
|
||||
}
|
||||
|
@ -43,6 +43,9 @@ CUSTOM_CVAR(Int, gl_debug_level, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN
|
|||
|
||||
CVAR(Bool, gl_debug_breakpoint, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
bool gpuStatActive = false;
|
||||
|
@ -368,3 +371,5 @@ FString FGLDebug::SeverityToString(GLenum severity)
|
|||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,9 @@
|
|||
#include "r_defs.h"
|
||||
#include "v_video.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FGLDebug
|
||||
{
|
||||
public:
|
||||
|
@ -38,4 +41,5 @@ private:
|
|||
bool mBreakpointMode = false;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
#include "hwrenderer/data/flatvertices.h"
|
||||
|
||||
EXTERN_CVAR (Bool, vid_vsync)
|
||||
|
||||
FGLRenderer *GLRenderer;
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
EXTERN_CVAR(Int, gl_tonemap)
|
||||
|
||||
void gl_LoadExtensions();
|
||||
void gl_PrintStartupLog();
|
||||
|
@ -64,6 +64,10 @@ CUSTOM_CVAR(Int, vid_hwgamma, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITC
|
|||
if (screen != nullptr) screen->SetGamma();
|
||||
}
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
FGLRenderer *GLRenderer;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -235,9 +239,6 @@ sector_t *OpenGLFrameBuffer::RenderView(player_t *player)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
EXTERN_CVAR(Int, gl_tonemap)
|
||||
|
||||
uint32_t OpenGLFrameBuffer::GetCaps()
|
||||
{
|
||||
if (!V_IsHardwareRenderer())
|
||||
|
@ -537,3 +538,4 @@ FTexture *OpenGLFrameBuffer::WipeEndScreen()
|
|||
return tex;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,8 +5,10 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FHardwareTexture;
|
||||
class FSimpleVertexBuffer;
|
||||
class FGLDebug;
|
||||
|
||||
class OpenGLFrameBuffer : public SystemGLFrameBuffer
|
||||
|
@ -66,5 +68,6 @@ private:
|
|||
int camtexcount = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //__GL_FRAMEBUFFER
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/textures/gl_samplers.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
||||
TexFilter_s TexFilter[]={
|
||||
{GL_NEAREST, GL_NEAREST, false},
|
||||
|
@ -464,3 +467,4 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,6 +16,9 @@
|
|||
class FCanvasTexture;
|
||||
class AActor;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
||||
// For error catching while changing parameters.
|
||||
enum EInvalid
|
||||
|
@ -90,4 +93,5 @@ public:
|
|||
void CleanUnused(SpriteHits &usedtranslations);
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include "gl_samplers.h"
|
||||
#include "hwrenderer/textures/hw_material.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
extern TexFilter_s TexFilter[];
|
||||
|
||||
|
||||
|
@ -98,3 +101,4 @@ void FSamplerManager::SetTextureFilterMode()
|
|||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
#include "gl_hwtexture.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FSamplerManager
|
||||
{
|
||||
// We need 6 different samplers: 4 for the different clamping modes,
|
||||
|
@ -22,6 +25,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void AddLightDefaults(FLightDefaults *defaults, double attnFactor);
|
|||
void AddLightAssociation(const char *actor, const char *frame, const char *light);
|
||||
void InitializeActorLights(TArray<FLightAssociation> &LightAssociations);
|
||||
|
||||
extern TArray<UserShaderDesc> usershaders;
|
||||
TArray<UserShaderDesc> usershaders;
|
||||
extern TDeletingArray<FLightDefaults *> LightDefaults;
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#endif
|
||||
|
||||
CVAR(Bool, gl_interpolate_model_frames, true, CVAR_ARCHIVE)
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
EXTERN_CVAR (Bool, r_drawvoxels)
|
||||
|
||||
extern TDeletingArray<FVoxel *> Voxels;
|
||||
extern TDeletingArray<FVoxelDef *> VoxelDefs;
|
||||
|
|
|
@ -52,9 +52,6 @@
|
|||
#include "doomerrors.h"
|
||||
#include "win32glvideo.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
|
||||
extern HWND Window;
|
||||
|
||||
PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
|
||||
|
|
|
@ -90,7 +90,7 @@ DFrameBuffer *Win32GLVideo::CreateFrameBuffer()
|
|||
{
|
||||
SystemGLFrameBuffer *fb;
|
||||
|
||||
fb = new OpenGLFrameBuffer(m_hMonitor, fullscreen);
|
||||
fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, fullscreen);
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue