diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
| commit | 3570c7f03a2aa90aa634f96c0af1969af610f14d (patch) | |
| tree | 4252e03c0e853ba7cffe022937698c854ad0eaa9 /Source/Core/VideoBackends/OGL/FramebufferManager.h | |
| parent | 2115e8a4a6814e32107b5205ff5c95bbd3c6e99c (diff) | |
Reformat all the things. Have fun with merge conflicts.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/FramebufferManager.h')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/FramebufferManager.h | 142 |
1 files changed, 75 insertions, 67 deletions
diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.h b/Source/Core/VideoBackends/OGL/FramebufferManager.h index e9e53ec9db..5079cfe618 100644 --- a/Source/Core/VideoBackends/OGL/FramebufferManager.h +++ b/Source/Core/VideoBackends/OGL/FramebufferManager.h @@ -46,84 +46,92 @@ namespace OGL { - struct XFBSource : public XFBSourceBase { - XFBSource(GLuint tex, int layers) : texture(tex), m_layers(layers) {} - ~XFBSource(); + XFBSource(GLuint tex, int layers) : texture(tex), m_layers(layers) {} + ~XFBSource(); - void CopyEFB(float Gamma) override; - void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) override; + void CopyEFB(float Gamma) override; + void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) override; - const GLuint texture; - const int m_layers; + const GLuint texture; + const int m_layers; }; class FramebufferManager : public FramebufferManagerBase { public: - FramebufferManager(int targetWidth, int targetHeight, int msaaSamples); - ~FramebufferManager(); - - // To get the EFB in texture form, these functions may have to transfer - // the EFB to a resolved texture first. - static GLuint GetEFBColorTexture(const EFBRectangle& sourceRc); - static GLuint GetEFBDepthTexture(const EFBRectangle& sourceRc); - - static GLuint GetEFBFramebuffer(unsigned int layer = 0) { return (layer < m_EFBLayers) ? m_efbFramebuffer[layer] : m_efbFramebuffer.back(); } - static GLuint GetXFBFramebuffer() { return m_xfbFramebuffer; } - - // Resolved framebuffer is only used in MSAA mode. - static GLuint GetResolvedFramebuffer() { return m_resolvedFramebuffer[0]; } - - static void SetFramebuffer(GLuint fb); - static void FramebufferTexture(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - - // If in MSAA mode, this will perform a resolve of the specified rectangle, and return the resolve target as a texture ID. - // Thus, this call may be expensive. Don't repeat it unnecessarily. - // If not in MSAA mode, will just return the render target texture ID. - // After calling this, before you render anything else, you MUST bind the framebuffer you want to draw to. - static GLuint ResolveAndGetRenderTarget(const EFBRectangle &rect); - - // Same as above but for the depth Target. - // After calling this, before you render anything else, you MUST bind the framebuffer you want to draw to. - static GLuint ResolveAndGetDepthTarget(const EFBRectangle &rect); - - // Convert EFB content on pixel format change. - // convtype=0 -> rgb8->rgba6, convtype=2 -> rgba6->rgb8 - static void ReinterpretPixelData(unsigned int convtype); - - static void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points); + FramebufferManager(int targetWidth, int targetHeight, int msaaSamples); + ~FramebufferManager(); + + // To get the EFB in texture form, these functions may have to transfer + // the EFB to a resolved texture first. + static GLuint GetEFBColorTexture(const EFBRectangle& sourceRc); + static GLuint GetEFBDepthTexture(const EFBRectangle& sourceRc); + + static GLuint GetEFBFramebuffer(unsigned int layer = 0) + { + return (layer < m_EFBLayers) ? m_efbFramebuffer[layer] : m_efbFramebuffer.back(); + } + static GLuint GetXFBFramebuffer() { return m_xfbFramebuffer; } + // Resolved framebuffer is only used in MSAA mode. + static GLuint GetResolvedFramebuffer() { return m_resolvedFramebuffer[0]; } + static void SetFramebuffer(GLuint fb); + static void FramebufferTexture(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, + GLint level); + + // If in MSAA mode, this will perform a resolve of the specified rectangle, and return the resolve + // target as a texture ID. + // Thus, this call may be expensive. Don't repeat it unnecessarily. + // If not in MSAA mode, will just return the render target texture ID. + // After calling this, before you render anything else, you MUST bind the framebuffer you want to + // draw to. + static GLuint ResolveAndGetRenderTarget(const EFBRectangle& rect); + + // Same as above but for the depth Target. + // After calling this, before you render anything else, you MUST bind the framebuffer you want to + // draw to. + static GLuint ResolveAndGetDepthTarget(const EFBRectangle& rect); + + // Convert EFB content on pixel format change. + // convtype=0 -> rgb8->rgba6, convtype=2 -> rgba6->rgb8 + static void ReinterpretPixelData(unsigned int convtype); + + static void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points); private: - std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width, unsigned int target_height, unsigned int layers) override; - void GetTargetSize(unsigned int *width, unsigned int *height) override; - - void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma) override; - - static int m_targetWidth; - static int m_targetHeight; - static int m_msaaSamples; - - static GLenum m_textureType; - static std::vector<GLuint> m_efbFramebuffer; - static GLuint m_xfbFramebuffer; - static GLuint m_efbColor; - static GLuint m_efbDepth; - static GLuint m_efbColorSwap;// will be hot swapped with m_efbColor when reinterpreting EFB pixel formats - - // Only used in MSAA mode, TODO: try to avoid them - static std::vector<GLuint> m_resolvedFramebuffer; - static GLuint m_resolvedColorTexture; - static GLuint m_resolvedDepthTexture; - - // For pixel format draw - static SHADER m_pixel_format_shaders[2]; - - // For EFB pokes - static GLuint m_EfbPokes_VBO; - static GLuint m_EfbPokes_VAO; - static SHADER m_EfbPokes; + std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width, + unsigned int target_height, + unsigned int layers) override; + void GetTargetSize(unsigned int* width, unsigned int* height) override; + + void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc, + float Gamma) override; + + static int m_targetWidth; + static int m_targetHeight; + static int m_msaaSamples; + + static GLenum m_textureType; + static std::vector<GLuint> m_efbFramebuffer; + static GLuint m_xfbFramebuffer; + static GLuint m_efbColor; + static GLuint m_efbDepth; + static GLuint + m_efbColorSwap; // will be hot swapped with m_efbColor when reinterpreting EFB pixel formats + + // Only used in MSAA mode, TODO: try to avoid them + static std::vector<GLuint> m_resolvedFramebuffer; + static GLuint m_resolvedColorTexture; + static GLuint m_resolvedDepthTexture; + + // For pixel format draw + static SHADER m_pixel_format_shaders[2]; + + // For EFB pokes + static GLuint m_EfbPokes_VBO; + static GLuint m_EfbPokes_VAO; + static SHADER m_EfbPokes; }; } // namespace OGL |
