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// Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer 8// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105. 9 10#ifndef LIBGLESV2_FRAMEBUFFER_H_ 11#define LIBGLESV2_FRAMEBUFFER_H_ 12 13#define GL_APICALL 14#include <GLES2/gl2.h> 15#include <d3d9.h> 16 17#include "common/angleutils.h" 18#include "libGLESv2/RefCountObject.h" 19 20namespace gl 21{ 22class Renderbuffer; 23class Colorbuffer; 24class Depthbuffer; 25class Stencilbuffer; 26class DepthStencilbuffer; 27 28class Framebuffer 29{ 30 public: 31 Framebuffer(); 32 33 virtual ~Framebuffer(); 34 35 void setColorbuffer(GLenum type, GLuint colorbuffer); 36 void setDepthbuffer(GLenum type, GLuint depthbuffer); 37 void setStencilbuffer(GLenum type, GLuint stencilbuffer); 38 39 void detachTexture(GLuint texture); 40 void detachRenderbuffer(GLuint renderbuffer); 41 42 IDirect3DSurface9 *getRenderTarget(); 43 IDirect3DSurface9 *getDepthStencil(); 44 45 unsigned int getRenderTargetSerial(); 46 unsigned int getDepthbufferSerial(); 47 unsigned int getStencilbufferSerial(); 48 49 Colorbuffer *getColorbuffer(); 50 DepthStencilbuffer *getDepthbuffer(); 51 DepthStencilbuffer *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 bool isMultisample(); 63 int getSamples(); 64 65 virtual GLenum completeness(); 66 67 protected: 68 GLenum mColorbufferType; 69 BindingPointer<Renderbuffer> mColorbufferPointer; 70 71 GLenum mDepthbufferType; 72 BindingPointer<Renderbuffer> mDepthbufferPointer; 73 74 GLenum mStencilbufferType; 75 BindingPointer<Renderbuffer> mStencilbufferPointer; 76 77 private: 78 DISALLOW_COPY_AND_ASSIGN(Framebuffer); 79 80 Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const; 81}; 82 83class DefaultFramebuffer : public Framebuffer 84{ 85 public: 86 DefaultFramebuffer(Colorbuffer *color, DepthStencilbuffer *depthStencil); 87 88 virtual GLenum completeness(); 89 90 private: 91 DISALLOW_COPY_AND_ASSIGN(DefaultFramebuffer); 92}; 93 94} 95 96#endif // LIBGLESV2_FRAMEBUFFER_H_ 97