From 3385e28611f9e39fe9263bb6c2ebbf0192125086 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 12 Jun 2018 10:58:32 +0200 Subject: [PATCH] Make it compile --- src/gl/data/gl_uniformbuffer.cpp | 2 +- src/gl/data/gl_uniformbuffer.h | 5 ++--- src/gl/system/gl_framebuffer.cpp | 5 +++++ src/gl/system/gl_framebuffer.h | 2 ++ src/v_video.h | 4 ++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gl/data/gl_uniformbuffer.cpp b/src/gl/data/gl_uniformbuffer.cpp index a63456c437..3952b6352b 100644 --- a/src/gl/data/gl_uniformbuffer.cpp +++ b/src/gl/data/gl_uniformbuffer.cpp @@ -68,6 +68,6 @@ void GLUniformBuffer::SetData(const void *data) if (mBufferId != 0) { glBindBuffer(GL_UNIFORM_BUFFER, mBufferId); - glBufferData(GL_UNIFORM_BUFFER, size, data, mStaticDraw? GL_STATIC_DRAW : GL_STREAM_DRAW); + glBufferData(GL_UNIFORM_BUFFER, mSize, data, mStaticDraw? GL_STATIC_DRAW : GL_STREAM_DRAW); } } diff --git a/src/gl/data/gl_uniformbuffer.h b/src/gl/data/gl_uniformbuffer.h index 2b0a7fe520..36c4144288 100644 --- a/src/gl/data/gl_uniformbuffer.h +++ b/src/gl/data/gl_uniformbuffer.h @@ -9,11 +9,10 @@ class GLUniformBuffer : public IUniformBuffer unsigned mBufferId; bool mStaticDraw; -protected: +public: GLUniformBuffer(size_t size, bool staticdraw = false); ~GLUniformBuffer(); - void Bind() override; void SetData(const void *data) override; unsigned ID() const @@ -21,4 +20,4 @@ protected: return mBufferId; } -} +}; diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 02326afd16..2411170b3e 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -38,6 +38,7 @@ #include "gl/textures/gl_samplers.h" #include "hwrenderer/utility/hw_clock.h" #include "gl/data/gl_vertexbuffer.h" +#include "gl/data/gl_uniformbuffer.h" #include "gl/models/gl_models.h" #include "gl/stereo3d/gl_stereo3d.h" #include "gl_debug.h" @@ -355,6 +356,10 @@ FModelRenderer *OpenGLFrameBuffer::CreateModelRenderer(int mli) return new FGLModelRenderer(mli); } +IUniformBuffer *OpenGLFrameBuffer::CreateUniformBuffer(size_t size, bool staticuse) +{ + return new GLUniformBuffer(size, staticuse); +} void OpenGLFrameBuffer::UnbindTexUnit(int no) { diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index 9a92c1f441..2ae1d2e967 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -44,6 +44,8 @@ public: bool RenderBuffersEnabled() override; void SetViewportRects(IntRect *bounds) override; void BlurScene(float amount) override; + IUniformBuffer *CreateUniformBuffer(size_t size, bool staticuse = false) override; + // Retrieves a buffer containing image data for a screenshot. // Hint: Pitch can be negative for upside-down images, in which case buffer diff --git a/src/v_video.h b/src/v_video.h index 66e38fca5b..48f40f5d04 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -319,6 +319,7 @@ public: class FUniquePalette; class IHardwareTexture; class FTexture; +class IUniformBuffer; // A canvas that represents the actual display. The video code is responsible // for actually implementing this. Built on top of SimpleCanvas, because it @@ -412,6 +413,9 @@ public: virtual int GetClientHeight() = 0; virtual bool RenderBuffersEnabled() { return false; }; virtual void BlurScene(float amount) {} + + // Interface to hardware rendering resources + virtual IUniformBuffer *CreateUniformBuffer(size_t size, bool staticuse = false) { return nullptr; } // Begin 2D drawing operations. // Returns true if hardware-accelerated 2D has been entered, false if not.