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 |
|
| 15 | #ifndef LIBGLESV2_FRAMEBUFFER_H_
|
| 16 | #define LIBGLESV2_FRAMEBUFFER_H_
|
| 17 |
|
| 18 | #include "RefCountObject.h"
|
| 19 | #include "Image.hpp"
|
| 20 |
|
| 21 | #define GL_APICALL
|
| 22 | #include <GLES2/gl2.h>
|
| 23 |
|
| 24 | namespace gl
|
| 25 | {
|
| 26 | class Renderbuffer;
|
| 27 | class Colorbuffer;
|
| 28 | class Depthbuffer;
|
| 29 | class Stencilbuffer;
|
| 30 | class DepthStencilbuffer;
|
| 31 |
|
| 32 | class Framebuffer
|
| 33 | {
|
| 34 | public:
|
| 35 | Framebuffer();
|
| 36 |
|
| 37 | virtual ~Framebuffer();
|
| 38 |
|
| 39 | void setColorbuffer(GLenum type, GLuint colorbuffer);
|
| 40 | void setDepthbuffer(GLenum type, GLuint depthbuffer);
|
| 41 | void setStencilbuffer(GLenum type, GLuint stencilbuffer);
|
| 42 |
|
| 43 | void detachTexture(GLuint texture);
|
| 44 | void detachRenderbuffer(GLuint renderbuffer);
|
| 45 |
|
| 46 | Image *getRenderTarget();
|
| 47 | Image *getDepthStencil();
|
| 48 |
|
| 49 | Renderbuffer *getColorbuffer();
|
| 50 | Renderbuffer *getDepthbuffer();
|
| 51 | Renderbuffer *getStencilbuffer();
|
| 52 |
|
| 53 | GLenum getColorbufferType();
|
| 54 | GLenum getDepthbufferType();
|
| 55 | GLenum getStencilbufferType();
|
| 56 |
|
| 57 | GLuint getColorbufferHandle();
|
| 58 | GLuint getDepthbufferHandle();
|
| 59 | GLuint getStencilbufferHandle();
|
| 60 |
|
| 61 | bool hasStencil();
|
| 62 |
|
| 63 | virtual GLenum completeness();
|
| 64 | GLenum completeness(int &width, int &height, int &samples);
|
| 65 |
|
| 66 | protected:
|
| 67 | GLenum mColorbufferType;
|
| 68 | BindingPointer<Renderbuffer> mColorbufferPointer;
|
| 69 |
|
| 70 | GLenum mDepthbufferType;
|
| 71 | BindingPointer<Renderbuffer> mDepthbufferPointer;
|
| 72 |
|
| 73 | GLenum mStencilbufferType;
|
| 74 | BindingPointer<Renderbuffer> mStencilbufferPointer;
|
| 75 |
|
| 76 | private:
|
| 77 | Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
|
| 78 | };
|
| 79 |
|
| 80 | class DefaultFramebuffer : public Framebuffer
|
| 81 | {
|
| 82 | public:
|
| 83 | DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil);
|
| 84 |
|
| 85 | virtual GLenum completeness();
|
| 86 | };
|
| 87 |
|
| 88 | }
|
| 89 |
|
| 90 | #endif // LIBGLESV2_FRAMEBUFFER_H_
|