daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // Renderbuffer.h: Defines the virtual gl::Renderbuffer class and its derived |
| 8 | // classes Colorbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer |
| 9 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108. |
| 10 | |
| 11 | #ifndef LIBGLESV2_RENDERBUFFER_H_ |
| 12 | #define LIBGLESV2_RENDERBUFFER_H_ |
| 13 | |
| 14 | #define GL_APICALL |
| 15 | #include <GLES2/gl2.h> |
| 16 | #include <d3d9.h> |
| 17 | |
alokp@chromium.org | ea0e1af | 2010-03-22 19:33:14 +0000 | [diff] [blame] | 18 | #include "common/angleutils.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 19 | |
| 20 | namespace gl |
| 21 | { |
| 22 | class Renderbuffer |
| 23 | { |
| 24 | public: |
| 25 | Renderbuffer(); |
| 26 | |
| 27 | virtual ~Renderbuffer(); |
| 28 | |
| 29 | virtual bool isColorbuffer(); |
| 30 | virtual bool isDepthbuffer(); |
| 31 | virtual bool isStencilbuffer(); |
| 32 | |
| 33 | virtual IDirect3DSurface9 *getRenderTarget(); |
| 34 | virtual IDirect3DSurface9 *getDepthStencil(); |
| 35 | |
| 36 | int getWidth(); |
| 37 | int getHeight(); |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 38 | GLenum getFormat(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 39 | |
| 40 | protected: |
| 41 | int mWidth; |
| 42 | int mHeight; |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 43 | GLenum mFormat; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 44 | |
| 45 | private: |
| 46 | DISALLOW_COPY_AND_ASSIGN(Renderbuffer); |
| 47 | }; |
| 48 | |
| 49 | class Colorbuffer : public Renderbuffer |
| 50 | { |
| 51 | public: |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 52 | explicit Colorbuffer(IDirect3DSurface9 *renderTarget); |
| 53 | Colorbuffer(int width, int height, GLenum format); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 54 | |
| 55 | ~Colorbuffer(); |
| 56 | |
| 57 | bool isColorbuffer(); |
| 58 | |
| 59 | GLuint getRedSize(); |
| 60 | GLuint getGreenSize(); |
| 61 | GLuint getBlueSize(); |
| 62 | GLuint getAlphaSize(); |
| 63 | |
| 64 | IDirect3DSurface9 *getRenderTarget(); |
| 65 | |
| 66 | protected: |
| 67 | IDirect3DSurface9 *mRenderTarget; |
| 68 | |
| 69 | private: |
| 70 | DISALLOW_COPY_AND_ASSIGN(Colorbuffer); |
| 71 | }; |
| 72 | |
| 73 | class Depthbuffer : public Renderbuffer |
| 74 | { |
| 75 | public: |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 76 | explicit Depthbuffer(IDirect3DSurface9 *depthStencil); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 77 | Depthbuffer(int width, int height); |
| 78 | |
| 79 | ~Depthbuffer(); |
| 80 | |
| 81 | bool isDepthbuffer(); |
| 82 | |
| 83 | GLuint getDepthSize(); |
| 84 | |
| 85 | IDirect3DSurface9 *getDepthStencil(); |
| 86 | |
| 87 | private: |
| 88 | DISALLOW_COPY_AND_ASSIGN(Depthbuffer); |
| 89 | IDirect3DSurface9 *mDepthStencil; |
| 90 | }; |
| 91 | |
| 92 | class Stencilbuffer : public Renderbuffer |
| 93 | { |
| 94 | public: |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 95 | explicit Stencilbuffer(IDirect3DSurface9 *depthStencil); |
daniel@transgaming.com | 4a9d65c | 2010-03-08 21:30:56 +0000 | [diff] [blame] | 96 | Stencilbuffer(int width, int height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 97 | |
| 98 | ~Stencilbuffer(); |
| 99 | |
| 100 | bool isStencilbuffer(); |
| 101 | |
| 102 | GLuint getStencilSize(); |
| 103 | |
| 104 | IDirect3DSurface9 *getDepthStencil(); |
| 105 | |
| 106 | private: |
| 107 | DISALLOW_COPY_AND_ASSIGN(Stencilbuffer); |
| 108 | IDirect3DSurface9 *mDepthStencil; |
| 109 | }; |
| 110 | } |
| 111 | |
| 112 | #endif // LIBGLESV2_RENDERBUFFER_H_ |