Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 1 | // SwiftShader Software Renderer
|
| 2 | //
|
| 3 | // Copyright(c) 2005-2013 TransGaming Inc.
|
| 4 | //
|
| 5 | // All rights reserved. No part of this software may be copied, distributed, transmitted,
|
| 6 | // transcribed, stored in a retrieval system, translated into any human or computer
|
| 7 | // language by any means, or disclosed to third parties without the explicit written
|
| 8 | // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
|
| 9 | // or implied, including but not limited to any patent rights, are granted to you.
|
| 10 | //
|
| 11 |
|
| 12 | // Framebuffer.h: Defines the Framebuffer class. Implements GL framebuffer
|
| 13 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
|
| 14 |
|
Nicolas Capens | 1115782 | 2014-10-23 23:00:29 -0400 | [diff] [blame] | 15 | #ifndef LIBGLES_CM_FRAMEBUFFER_H_
|
| 16 | #define LIBGLES_CM_FRAMEBUFFER_H_
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 17 |
|
Nicolas Capens | fa0cc04 | 2014-12-10 10:17:07 -0500 | [diff] [blame] | 18 | #include "common/Object.hpp"
|
Nicolas Capens | deda34b | 2015-04-28 15:21:53 -0700 | [diff] [blame] | 19 | #include "common/Image.hpp"
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 20 |
|
Nicolas Capens | 1115782 | 2014-10-23 23:00:29 -0400 | [diff] [blame] | 21 | #include <GLES/gl.h>
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 22 |
|
Nicolas Capens | 14ee762 | 2014-10-28 23:48:41 -0400 | [diff] [blame] | 23 | namespace es1
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 24 | {
|
| 25 | class Renderbuffer;
|
| 26 | class Colorbuffer;
|
| 27 | class Depthbuffer;
|
| 28 | class Stencilbuffer;
|
| 29 | class DepthStencilbuffer;
|
| 30 |
|
| 31 | class Framebuffer
|
| 32 | {
|
| 33 | public:
|
| 34 | Framebuffer();
|
| 35 |
|
| 36 | virtual ~Framebuffer();
|
| 37 |
|
| 38 | void setColorbuffer(GLenum type, GLuint colorbuffer);
|
| 39 | void setDepthbuffer(GLenum type, GLuint depthbuffer);
|
| 40 | void setStencilbuffer(GLenum type, GLuint stencilbuffer);
|
| 41 |
|
| 42 | void detachTexture(GLuint texture);
|
| 43 | void detachRenderbuffer(GLuint renderbuffer);
|
| 44 |
|
Nicolas Capens | ead7ac5 | 2014-10-27 23:56:02 -0400 | [diff] [blame] | 45 | egl::Image *getRenderTarget();
|
| 46 | egl::Image *getDepthStencil();
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 47 |
|
| 48 | Renderbuffer *getColorbuffer();
|
| 49 | Renderbuffer *getDepthbuffer();
|
| 50 | Renderbuffer *getStencilbuffer();
|
| 51 |
|
| 52 | GLenum getColorbufferType();
|
| 53 | GLenum getDepthbufferType();
|
| 54 | GLenum getStencilbufferType();
|
| 55 |
|
Nicolas Capens | 7cc75e1 | 2015-01-29 14:44:24 -0500 | [diff] [blame] | 56 | GLuint getColorbufferName();
|
| 57 | GLuint getDepthbufferName();
|
| 58 | GLuint getStencilbufferName();
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 59 |
|
| 60 | bool hasStencil();
|
| 61 |
|
| 62 | virtual GLenum completeness();
|
| 63 | GLenum completeness(int &width, int &height, int &samples);
|
| 64 |
|
Nicolas Capens | dddc4ab | 2015-01-13 15:49:15 -0500 | [diff] [blame] | 65 | GLenum getImplementationColorReadFormat();
|
| 66 | GLenum getImplementationColorReadType();
|
| 67 |
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 68 | protected:
|
| 69 | GLenum mColorbufferType;
|
Nicolas Capens | fa0cc04 | 2014-12-10 10:17:07 -0500 | [diff] [blame] | 70 | gl::BindingPointer<Renderbuffer> mColorbufferPointer;
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 71 |
|
| 72 | GLenum mDepthbufferType;
|
Nicolas Capens | fa0cc04 | 2014-12-10 10:17:07 -0500 | [diff] [blame] | 73 | gl::BindingPointer<Renderbuffer> mDepthbufferPointer;
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 74 |
|
| 75 | GLenum mStencilbufferType;
|
Nicolas Capens | fa0cc04 | 2014-12-10 10:17:07 -0500 | [diff] [blame] | 76 | gl::BindingPointer<Renderbuffer> mStencilbufferPointer;
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 77 |
|
| 78 | private:
|
| 79 | Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
|
| 80 | };
|
| 81 |
|
| 82 | class DefaultFramebuffer : public Framebuffer
|
| 83 | {
|
| 84 | public:
|
| 85 | DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil);
|
Nicolas Capens | dbf6fc8 | 2014-10-23 13:33:20 -0400 | [diff] [blame] | 86 | };
|
| 87 |
|
| 88 | }
|
| 89 |
|
Nicolas Capens | 1115782 | 2014-10-23 23:00:29 -0400 | [diff] [blame] | 90 | #endif // LIBGLES_CM_FRAMEBUFFER_H_
|