summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/Framebuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/Framebuffer.h')
-rw-r--r--src/3rdparty/angle/src/libANGLE/Framebuffer.h136
1 files changed, 98 insertions, 38 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/Framebuffer.h b/src/3rdparty/angle/src/libANGLE/Framebuffer.h
index 8b24cf984e..b07b59ac90 100644
--- a/src/3rdparty/angle/src/libANGLE/Framebuffer.h
+++ b/src/3rdparty/angle/src/libANGLE/Framebuffer.h
@@ -14,7 +14,9 @@
#include "common/angleutils.h"
#include "libANGLE/Constants.h"
+#include "libANGLE/Debug.h"
#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/RefCountObject.h"
namespace rx
@@ -22,7 +24,7 @@ namespace rx
class ImplFactory;
class FramebufferImpl;
class RenderbufferImpl;
-struct Workarounds;
+class SurfaceImpl;
}
namespace egl
@@ -32,7 +34,7 @@ class Surface;
namespace gl
{
-class FramebufferAttachment;
+class Context;
class Renderbuffer;
class State;
class Texture;
@@ -43,64 +45,89 @@ struct Extensions;
struct ImageIndex;
struct Rectangle;
-typedef std::vector<FramebufferAttachment *> AttachmentList;
-
-class Framebuffer
+class Framebuffer final : public LabeledObject
{
public:
class Data final : angle::NonCopyable
{
public:
+ explicit Data();
explicit Data(const Caps &caps);
~Data();
- FramebufferAttachment *getReadAttachment() const;
- FramebufferAttachment *getFirstColorAttachment() const;
- FramebufferAttachment *getDepthOrStencilAttachment() const;
+ const std::string &getLabel();
+
+ const FramebufferAttachment *getReadAttachment() const;
+ const FramebufferAttachment *getFirstColorAttachment() const;
+ const FramebufferAttachment *getDepthOrStencilAttachment() const;
+ const FramebufferAttachment *getColorAttachment(size_t colorAttachment) const;
+ const FramebufferAttachment *getDepthAttachment() const;
+ const FramebufferAttachment *getStencilAttachment() const;
+ const FramebufferAttachment *getDepthStencilAttachment() const;
+
+ const std::vector<GLenum> &getDrawBufferStates() const { return mDrawBufferStates; }
+ GLenum getReadBufferState() const { return mReadBufferState; }
+ const std::vector<FramebufferAttachment> &getColorAttachments() const { return mColorAttachments; }
+
+ bool attachmentsHaveSameDimensions() const;
- AttachmentList mColorAttachments;
- FramebufferAttachment *mDepthAttachment;
- FramebufferAttachment *mStencilAttachment;
+ private:
+ friend class Framebuffer;
+
+ std::string mLabel;
+
+ std::vector<FramebufferAttachment> mColorAttachments;
+ FramebufferAttachment mDepthAttachment;
+ FramebufferAttachment mStencilAttachment;
std::vector<GLenum> mDrawBufferStates;
GLenum mReadBufferState;
};
Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id);
+ Framebuffer(rx::SurfaceImpl *surface);
virtual ~Framebuffer();
+ void setLabel(const std::string &label) override;
+ const std::string &getLabel() const override;
+
const rx::FramebufferImpl *getImplementation() const { return mImpl; }
rx::FramebufferImpl *getImplementation() { return mImpl; }
GLuint id() const { return mId; }
- void setTextureAttachment(GLenum attachment, Texture *texture, const ImageIndex &imageIndex);
- void setRenderbufferAttachment(GLenum attachment, Renderbuffer *renderbuffer);
- void setNULLAttachment(GLenum attachment);
+ void setAttachment(GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource);
+ void resetAttachment(GLenum binding);
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;
+ const FramebufferAttachment *getColorbuffer(size_t colorAttachment) const;
+ const FramebufferAttachment *getDepthbuffer() const;
+ const FramebufferAttachment *getStencilbuffer() const;
+ const FramebufferAttachment *getDepthStencilBuffer() const;
+ const FramebufferAttachment *getDepthOrStencilbuffer() const;
+ const FramebufferAttachment *getReadColorbuffer() const;
GLenum getReadColorbufferType() const;
- FramebufferAttachment *getFirstColorbuffer() const;
+ const FramebufferAttachment *getFirstColorbuffer() const;
- FramebufferAttachment *getAttachment(GLenum attachment) const;
+ const FramebufferAttachment *getAttachment(GLenum attachment) const;
- GLenum getDrawBufferState(unsigned int colorAttachment) const;
+ size_t getDrawbufferStateCount() const;
+ GLenum getDrawBufferState(size_t drawBuffer) const;
void setDrawBuffers(size_t count, const GLenum *buffers);
+ const FramebufferAttachment *getDrawBuffer(size_t drawBuffer) const;
+ bool hasEnabledDrawBuffer() const;
GLenum getReadBufferState() const;
void setReadBuffer(GLenum buffer);
- bool isEnabledColorAttachment(unsigned int colorAttachment) const;
- bool hasEnabledColorAttachment() const;
+ size_t getNumColorBuffers() const;
+ bool hasDepth() const;
bool hasStencil() const;
int getSamples(const gl::Data &data) const;
bool usingExtendedDrawBuffers() const;
@@ -108,35 +135,68 @@ class Framebuffer
GLenum checkStatus(const gl::Data &data) const;
bool hasValidDepthStencil() const;
+ Error discard(size_t count, const GLenum *attachments);
Error invalidate(size_t count, const GLenum *attachments);
Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area);
Error clear(const gl::Data &data, GLbitfield mask);
- Error clearBufferfv(const State &state, GLenum buffer, GLint drawbuffer, const GLfloat *values);
- Error clearBufferuiv(const State &state, GLenum buffer, GLint drawbuffer, const GLuint *values);
- Error clearBufferiv(const State &state, GLenum buffer, GLint drawbuffer, const GLint *values);
- Error clearBufferfi(const State &state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+ Error clearBufferfv(const gl::Data &data,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *values);
+ Error clearBufferuiv(const gl::Data &data,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *values);
+ Error clearBufferiv(const gl::Data &data, GLenum buffer, GLint drawbuffer, const GLint *values);
+ Error clearBufferfi(const gl::Data &data,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
GLenum getImplementationColorReadFormat() const;
GLenum getImplementationColorReadType() const;
- Error readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const;
+ Error readPixels(const gl::State &state,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ GLvoid *pixels) const;
+
+ Error blit(const State &state,
+ const Rectangle &sourceArea,
+ const Rectangle &destArea,
+ GLbitfield mask,
+ GLenum filter,
+ const Framebuffer *sourceFramebuffer);
+
+ enum DirtyBitType
+ {
+ DIRTY_BIT_COLOR_ATTACHMENT_0,
+ DIRTY_BIT_COLOR_ATTACHMENT_MAX =
+ DIRTY_BIT_COLOR_ATTACHMENT_0 + gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS,
+ DIRTY_BIT_DEPTH_ATTACHMENT = DIRTY_BIT_COLOR_ATTACHMENT_MAX,
+ DIRTY_BIT_STENCIL_ATTACHMENT,
+ DIRTY_BIT_DRAW_BUFFERS,
+ DIRTY_BIT_READ_BUFFER,
+ DIRTY_BIT_UNKNOWN,
+ DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN,
+ };
+
+ typedef std::bitset<DIRTY_BIT_MAX> DirtyBits;
+ bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
- Error blit(const gl::State &state, const gl::Rectangle &sourceArea, const gl::Rectangle &destArea,
- GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer);
+ void syncState() const;
protected:
- void setAttachment(GLenum attachment, FramebufferAttachment *attachmentObj);
void detachResourceById(GLenum resourceType, GLuint resourceId);
Data mData;
rx::FramebufferImpl *mImpl;
GLuint mId;
-};
-class DefaultFramebuffer : public Framebuffer
-{
- public:
- DefaultFramebuffer(const gl::Caps &caps, rx::ImplFactory *factory, egl::Surface *surface);
+ // TODO(jmadill): See if we can make this non-mutable.
+ mutable DirtyBits mDirtyBits;
};
}