Hash :
e261b44a
Author :
Date :
2014-06-25T12:42:21
Remove obsolete Renderbuffer types. RenderbufferProxySet and FramebufferTextureBindingPointer aren't necessary any more with our refactored renderbuffer classes and ownership of attachments by the Framebuffer. We can also consolidate the FramebufferAttachment and implementation to a single class, and no longer need to store ref counted objects in the Framebuffer class directly. BUG=angle:660 Change-Id: Idcc06dfb42b47242b33494e797a0ba06d6669511 Reviewed-on: https://chromium-review.googlesource.com/201838 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
//
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
#ifndef LIBGLESV2_FRAMEBUFFER_H_
#define LIBGLESV2_FRAMEBUFFER_H_
#include "common/angleutils.h"
#include "common/RefCountObject.h"
#include "constants.h"
namespace rx
{
class Renderer;
}
namespace gl
{
class FramebufferAttachment;
class Colorbuffer;
class Depthbuffer;
class Stencilbuffer;
class DepthStencilbuffer;
class Framebuffer
{
public:
explicit Framebuffer(rx::Renderer *renderer);
virtual ~Framebuffer();
void setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer);
void setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer);
void setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer);
void setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer);
void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer);
FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
FramebufferAttachment *getDepthbuffer() const;
FramebufferAttachment *getStencilbuffer() const;
FramebufferAttachment *getDepthStencilBuffer() const;
FramebufferAttachment *getDepthOrStencilbuffer() const;
FramebufferAttachment *getReadColorbuffer() const;
GLenum getReadColorbufferType() const;
FramebufferAttachment *getFirstColorbuffer() const;
GLenum getColorbufferType(unsigned int colorAttachment) const;
GLenum getDepthbufferType() const;
GLenum getStencilbufferType() const;
GLenum getDepthStencilbufferType() const;
GLuint getColorbufferHandle(unsigned int colorAttachment) const;
GLuint getDepthbufferHandle() const;
GLuint getStencilbufferHandle() const;
GLuint getDepthStencilbufferHandle() const;
GLint getColorbufferMipLevel(unsigned int colorAttachment) const;
GLint getDepthbufferMipLevel() const;
GLint getStencilbufferMipLevel() const;
GLint getDepthStencilbufferMipLevel() const;
GLint getColorbufferLayer(unsigned int colorAttachment) const;
GLint getDepthbufferLayer() const;
GLint getStencilbufferLayer() const;
GLint getDepthStencilbufferLayer() const;
GLenum getDrawBufferState(unsigned int colorAttachment) const;
void setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer);
bool isEnabledColorAttachment(unsigned int colorAttachment) const;
bool hasEnabledColorAttachment() const;
bool hasStencil() const;
int getSamples() const;
bool usingExtendedDrawBuffers() const;
virtual GLenum completeness() const;
protected:
rx::Renderer *mRenderer;
FramebufferAttachment *mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
GLenum mDrawBufferStates[IMPLEMENTATION_MAX_DRAW_BUFFERS];
GLenum mReadBufferState;
FramebufferAttachment *mDepthbuffer;
FramebufferAttachment *mStencilbuffer;
bool hasValidDepthStencil() const;
private:
DISALLOW_COPY_AND_ASSIGN(Framebuffer);
FramebufferAttachment *createAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const;
};
class DefaultFramebuffer : public Framebuffer
{
public:
DefaultFramebuffer(rx::Renderer *Renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil);
virtual GLenum completeness() const;
private:
DISALLOW_COPY_AND_ASSIGN(DefaultFramebuffer);
};
}
#endif // LIBGLESV2_FRAMEBUFFER_H_