From 092b2953ea74cb31668789fc0edbf57e623827c6 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 3 Jul 2018 23:31:40 +0200 Subject: [PATCH] - add GL to OpenGL specific postprocess classes to make it more clear which belongs to the generic hw interface and which belong to the OpenGL implementation --- src/gl/renderer/gl_renderbuffers.cpp | 40 ++++++++--------- src/gl/renderer/gl_renderbuffers.h | 66 ++++++++++++++-------------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/gl/renderer/gl_renderbuffers.cpp b/src/gl/renderer/gl_renderbuffers.cpp index 7f6cc8836..b1dcb85e7 100644 --- a/src/gl/renderer/gl_renderbuffers.cpp +++ b/src/gl/renderer/gl_renderbuffers.cpp @@ -104,21 +104,21 @@ void FGLRenderBuffers::ClearEyeBuffers() mEyeFBs.Clear(); } -void FGLRenderBuffers::DeleteTexture(PPTexture &tex) +void FGLRenderBuffers::DeleteTexture(PPGLTexture &tex) { if (tex.handle != 0) glDeleteTextures(1, &tex.handle); tex.handle = 0; } -void FGLRenderBuffers::DeleteRenderBuffer(PPRenderBuffer &buf) +void FGLRenderBuffers::DeleteRenderBuffer(PPGLRenderBuffer &buf) { if (buf.handle != 0) glDeleteRenderbuffers(1, &buf.handle); buf.handle = 0; } -void FGLRenderBuffers::DeleteFrameBuffer(PPFrameBuffer &fb) +void FGLRenderBuffers::DeleteFrameBuffer(PPGLFrameBuffer &fb) { if (fb.handle != 0) glDeleteFramebuffers(1, &fb.handle); @@ -263,7 +263,7 @@ void FGLRenderBuffers::CreateEyeBuffers(int eye) while (mEyeFBs.Size() <= unsigned(eye)) { - PPTexture texture = Create2DTexture("EyeTexture", GL_RGBA16F, mWidth, mHeight); + PPGLTexture texture = Create2DTexture("EyeTexture", GL_RGBA16F, mWidth, mHeight); mEyeTextures.Push(texture); mEyeFBs.Push(CreateFrameBuffer("EyeFB", texture)); } @@ -279,9 +279,9 @@ void FGLRenderBuffers::CreateEyeBuffers(int eye) // //========================================================================== -PPTexture FGLRenderBuffers::Create2DTexture(const char *name, GLuint format, int width, int height, const void *data) +PPGLTexture FGLRenderBuffers::Create2DTexture(const char *name, GLuint format, int width, int height, const void *data) { - PPTexture tex; + PPGLTexture tex; tex.Width = width; tex.Height = height; glGenTextures(1, &tex.handle); @@ -315,9 +315,9 @@ PPTexture FGLRenderBuffers::Create2DTexture(const char *name, GLuint format, int return tex; } -PPTexture FGLRenderBuffers::Create2DMultisampleTexture(const char *name, GLuint format, int width, int height, int samples, bool fixedSampleLocations) +PPGLTexture FGLRenderBuffers::Create2DMultisampleTexture(const char *name, GLuint format, int width, int height, int samples, bool fixedSampleLocations) { - PPTexture tex; + PPGLTexture tex; tex.Width = width; tex.Height = height; glGenTextures(1, &tex.handle); @@ -334,9 +334,9 @@ PPTexture FGLRenderBuffers::Create2DMultisampleTexture(const char *name, GLuint // //========================================================================== -PPRenderBuffer FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint format, int width, int height) +PPGLRenderBuffer FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint format, int width, int height) { - PPRenderBuffer buf; + PPGLRenderBuffer buf; glGenRenderbuffers(1, &buf.handle); glBindRenderbuffer(GL_RENDERBUFFER, buf.handle); FGLDebug::LabelObject(GL_RENDERBUFFER, buf.handle, name); @@ -344,12 +344,12 @@ PPRenderBuffer FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint for return buf; } -PPRenderBuffer FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint format, int width, int height, int samples) +PPGLRenderBuffer FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint format, int width, int height, int samples) { if (samples <= 1) return CreateRenderBuffer(name, format, width, height); - PPRenderBuffer buf; + PPGLRenderBuffer buf; glGenRenderbuffers(1, &buf.handle); glBindRenderbuffer(GL_RENDERBUFFER, buf.handle); FGLDebug::LabelObject(GL_RENDERBUFFER, buf.handle, name); @@ -363,9 +363,9 @@ PPRenderBuffer FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint for // //========================================================================== -PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPTexture colorbuffer) +PPGLFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPGLTexture colorbuffer) { - PPFrameBuffer fb; + PPGLFrameBuffer fb; glGenFramebuffers(1, &fb.handle); glBindFramebuffer(GL_FRAMEBUFFER, fb.handle); FGLDebug::LabelObject(GL_FRAMEBUFFER, fb.handle, name); @@ -375,9 +375,9 @@ PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPTexture co return fb; } -PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPTexture colorbuffer, PPRenderBuffer depthstencil) +PPGLFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPGLTexture colorbuffer, PPGLRenderBuffer depthstencil) { - PPFrameBuffer fb; + PPGLFrameBuffer fb; glGenFramebuffers(1, &fb.handle); glBindFramebuffer(GL_FRAMEBUFFER, fb.handle); FGLDebug::LabelObject(GL_FRAMEBUFFER, fb.handle, name); @@ -388,9 +388,9 @@ PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPTexture co return fb; } -PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPRenderBuffer colorbuffer, PPRenderBuffer depthstencil) +PPGLFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPGLRenderBuffer colorbuffer, PPGLRenderBuffer depthstencil) { - PPFrameBuffer fb; + PPGLFrameBuffer fb; glGenFramebuffers(1, &fb.handle); glBindFramebuffer(GL_FRAMEBUFFER, fb.handle); FGLDebug::LabelObject(GL_FRAMEBUFFER, fb.handle, name); @@ -401,9 +401,9 @@ PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPRenderBuff return fb; } -PPFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPTexture colorbuffer0, PPTexture colorbuffer1, PPTexture colorbuffer2, PPTexture depthstencil, bool multisample) +PPGLFrameBuffer FGLRenderBuffers::CreateFrameBuffer(const char *name, PPGLTexture colorbuffer0, PPGLTexture colorbuffer1, PPGLTexture colorbuffer2, PPGLTexture depthstencil, bool multisample) { - PPFrameBuffer fb; + PPGLFrameBuffer fb; glGenFramebuffers(1, &fb.handle); glBindFramebuffer(GL_FRAMEBUFFER, fb.handle); FGLDebug::LabelObject(GL_FRAMEBUFFER, fb.handle, name); diff --git a/src/gl/renderer/gl_renderbuffers.h b/src/gl/renderer/gl_renderbuffers.h index 70057e558..f9145648f 100644 --- a/src/gl/renderer/gl_renderbuffers.h +++ b/src/gl/renderer/gl_renderbuffers.h @@ -4,7 +4,7 @@ #include "gl/shaders/gl_shader.h" #include "hwrenderer/postprocessing/hw_postprocess.h" -class PPTexture +class PPGLTexture { public: void Bind(int index, int filter = GL_NEAREST, int wrap = GL_CLAMP_TO_EDGE) @@ -28,7 +28,7 @@ private: friend class FGLRenderBuffers; }; -class PPFrameBuffer +class PPGLFrameBuffer { public: void Bind() @@ -44,7 +44,7 @@ private: friend class FGLRenderBuffers; }; -class PPRenderBuffer +class PPGLRenderBuffer { private: GLuint handle = 0; @@ -68,8 +68,8 @@ public: void CompileEffectShaders(); void RenderEffect(const FString &name); - TMap GLTextures; - TMap GLTextureFBs; + TMap GLTextures; + TMap GLTextureFBs; TMap> GLShaders; void BindSceneFB(bool sceneData); @@ -84,7 +84,7 @@ public: void BindNextFB(); void NextTexture(); - PPFrameBuffer GetCurrentFB() const { return mPipelineFB[mCurrentPipelineTexture]; } + PPGLFrameBuffer GetCurrentFB() const { return mPipelineFB[mCurrentPipelineTexture]; } void BindOutputFB(); @@ -111,19 +111,19 @@ private: void CreateEyeBuffers(int eye); void CreateShadowMap(); - PPTexture Create2DTexture(const char *name, GLuint format, int width, int height, const void *data = nullptr); - PPTexture Create2DMultisampleTexture(const char *name, GLuint format, int width, int height, int samples, bool fixedSampleLocations); - PPRenderBuffer CreateRenderBuffer(const char *name, GLuint format, int width, int height); - PPRenderBuffer CreateRenderBuffer(const char *name, GLuint format, int width, int height, int samples); - PPFrameBuffer CreateFrameBuffer(const char *name, PPTexture colorbuffer); - PPFrameBuffer CreateFrameBuffer(const char *name, PPTexture colorbuffer, PPRenderBuffer depthstencil); - PPFrameBuffer CreateFrameBuffer(const char *name, PPRenderBuffer colorbuffer, PPRenderBuffer depthstencil); - PPFrameBuffer CreateFrameBuffer(const char *name, PPTexture colorbuffer0, PPTexture colorbuffer1, PPTexture colorbuffer2, PPTexture depthstencil, bool multisample); + PPGLTexture Create2DTexture(const char *name, GLuint format, int width, int height, const void *data = nullptr); + PPGLTexture Create2DMultisampleTexture(const char *name, GLuint format, int width, int height, int samples, bool fixedSampleLocations); + PPGLRenderBuffer CreateRenderBuffer(const char *name, GLuint format, int width, int height); + PPGLRenderBuffer CreateRenderBuffer(const char *name, GLuint format, int width, int height, int samples); + PPGLFrameBuffer CreateFrameBuffer(const char *name, PPGLTexture colorbuffer); + PPGLFrameBuffer CreateFrameBuffer(const char *name, PPGLTexture colorbuffer, PPGLRenderBuffer depthstencil); + PPGLFrameBuffer CreateFrameBuffer(const char *name, PPGLRenderBuffer colorbuffer, PPGLRenderBuffer depthstencil); + PPGLFrameBuffer CreateFrameBuffer(const char *name, PPGLTexture colorbuffer0, PPGLTexture colorbuffer1, PPGLTexture colorbuffer2, PPGLTexture depthstencil, bool multisample); bool CheckFrameBufferCompleteness(); void ClearFrameBuffer(bool stencil, bool depth); - void DeleteTexture(PPTexture &handle); - void DeleteRenderBuffer(PPRenderBuffer &handle); - void DeleteFrameBuffer(PPFrameBuffer &handle); + void DeleteTexture(PPGLTexture &handle); + void DeleteRenderBuffer(PPGLRenderBuffer &handle); + void DeleteFrameBuffer(PPGLFrameBuffer &handle); int mWidth = 0; int mHeight = 0; @@ -136,29 +136,29 @@ private: int mCurrentPipelineTexture = 0; // Buffers for the scene - PPTexture mSceneMultisampleTex; - PPTexture mSceneDepthStencilTex; - PPTexture mSceneFogTex; - PPTexture mSceneNormalTex; - PPRenderBuffer mSceneMultisampleBuf; - PPRenderBuffer mSceneDepthStencilBuf; - PPRenderBuffer mSceneFogBuf; - PPRenderBuffer mSceneNormalBuf; - PPFrameBuffer mSceneFB; - PPFrameBuffer mSceneDataFB; + PPGLTexture mSceneMultisampleTex; + PPGLTexture mSceneDepthStencilTex; + PPGLTexture mSceneFogTex; + PPGLTexture mSceneNormalTex; + PPGLRenderBuffer mSceneMultisampleBuf; + PPGLRenderBuffer mSceneDepthStencilBuf; + PPGLRenderBuffer mSceneFogBuf; + PPGLRenderBuffer mSceneNormalBuf; + PPGLFrameBuffer mSceneFB; + PPGLFrameBuffer mSceneDataFB; bool mSceneUsesTextures = false; // Effect/HUD buffers - PPTexture mPipelineTexture[NumPipelineTextures]; - PPFrameBuffer mPipelineFB[NumPipelineTextures]; + PPGLTexture mPipelineTexture[NumPipelineTextures]; + PPGLFrameBuffer mPipelineFB[NumPipelineTextures]; // Eye buffers - TArray mEyeTextures; - TArray mEyeFBs; + TArray mEyeTextures; + TArray mEyeFBs; // Shadow map texture - PPTexture mShadowMapTexture; - PPFrameBuffer mShadowMapFB; + PPGLTexture mShadowMapTexture; + PPGLFrameBuffer mShadowMapFB; int mCurrentShadowMapSize = 0; static bool FailedCreate;