Commit 79481d65 by Jamie Madill

Add FramebufferAttachmentObject base class.

This lets us share objects (Textures/RBs/Surface) in the attachment class. It will let us squash the attachment classes into one type, which will in turn let us store them by-value, instead of by-pointer. BUG=angleproject:963 Change-Id: Ia9a43dbc3b99475c00f6bc2ed5475deef55addc3 Reviewed-on: https://chromium-review.googlesource.com/263487Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent a825fdce
...@@ -20,13 +20,33 @@ ...@@ -20,13 +20,33 @@
namespace gl namespace gl
{ {
////// FramebufferAttachment::Target Implementation //////
FramebufferAttachment::Target::Target(GLenum binding, const ImageIndex &imageIndex)
: mBinding(binding),
mTextureIndex(imageIndex)
{
}
FramebufferAttachment::Target::Target(const Target &other)
: mBinding(other.mBinding),
mTextureIndex(other.mTextureIndex)
{
}
FramebufferAttachment::Target &FramebufferAttachment::Target::operator=(const Target &other)
{
this->mBinding = other.mBinding;
this->mTextureIndex = other.mTextureIndex;
return *this;
}
////// FramebufferAttachment Implementation ////// ////// FramebufferAttachment Implementation //////
FramebufferAttachment::FramebufferAttachment(GLenum binding, FramebufferAttachment::FramebufferAttachment(GLenum binding,
const ImageIndex &textureIndex, const ImageIndex &textureIndex,
RefCountObject *resource) FramebufferAttachmentObject *resource)
: mBinding(binding), : mTarget(binding, textureIndex)
mTextureIndex(textureIndex)
{ {
mResource.set(resource); mResource.set(resource);
} }
...@@ -79,60 +99,65 @@ GLenum FramebufferAttachment::getColorEncoding() const ...@@ -79,60 +99,65 @@ GLenum FramebufferAttachment::getColorEncoding() const
const ImageIndex &FramebufferAttachment::getTextureImageIndex() const const ImageIndex &FramebufferAttachment::getTextureImageIndex() const
{ {
ASSERT(type() == GL_TEXTURE); ASSERT(type() == GL_TEXTURE);
return mTextureIndex; return mTarget.textureIndex();
} }
GLenum FramebufferAttachment::cubeMapFace() const GLenum FramebufferAttachment::cubeMapFace() const
{ {
ASSERT(type() == GL_TEXTURE); ASSERT(type() == GL_TEXTURE);
return IsCubeMapTextureTarget(mTextureIndex.type) ? mTextureIndex.type : GL_NONE;
const auto &index = mTarget.textureIndex();
return IsCubeMapTextureTarget(index.type) ? index.type : GL_NONE;
} }
GLint FramebufferAttachment::mipLevel() const GLint FramebufferAttachment::mipLevel() const
{ {
ASSERT(type() == GL_TEXTURE); ASSERT(type() == GL_TEXTURE);
return mTextureIndex.mipIndex; return mTarget.textureIndex().mipIndex;
} }
GLint FramebufferAttachment::layer() const GLint FramebufferAttachment::layer() const
{ {
ASSERT(type() == GL_TEXTURE); ASSERT(type() == GL_TEXTURE);
if (mTextureIndex.type == GL_TEXTURE_2D_ARRAY || mTextureIndex.type == GL_TEXTURE_3D)
const auto &index = mTarget.textureIndex();
if (index.type == GL_TEXTURE_2D_ARRAY || index.type == GL_TEXTURE_3D)
{ {
return mTextureIndex.layerIndex; return index.layerIndex;
} }
return 0; return 0;
} }
///// TextureAttachment Implementation //////// GLsizei FramebufferAttachment::getWidth() const
TextureAttachment::TextureAttachment(GLenum binding, Texture *texture, const ImageIndex &index)
: FramebufferAttachment(binding, index, texture)
{ {
return mResource->getAttachmentWidth(mTarget);
} }
TextureAttachment::~TextureAttachment() GLsizei FramebufferAttachment::getHeight() const
{ {
return mResource->getAttachmentHeight(mTarget);
} }
GLsizei TextureAttachment::getSamples() const GLenum FramebufferAttachment::getInternalFormat() const
{ {
return 0; return mResource->getAttachmentInternalFormat(mTarget);
} }
GLsizei TextureAttachment::getWidth() const GLsizei FramebufferAttachment::getSamples() const
{ {
return getTexture()->getWidth(mTextureIndex.type, mTextureIndex.mipIndex); return mResource->getAttachmentSamples(mTarget);
} }
GLsizei TextureAttachment::getHeight() const ///// TextureAttachment Implementation ////////
TextureAttachment::TextureAttachment(GLenum binding, Texture *texture, const ImageIndex &index)
: FramebufferAttachment(binding, index, texture)
{ {
return getTexture()->getHeight(mTextureIndex.type, mTextureIndex.mipIndex);
} }
GLenum TextureAttachment::getInternalFormat() const TextureAttachment::~TextureAttachment()
{ {
return getTexture()->getInternalFormat(mTextureIndex.type, mTextureIndex.mipIndex);
} }
GLenum TextureAttachment::type() const GLenum TextureAttachment::type() const
...@@ -146,6 +171,11 @@ Renderbuffer *TextureAttachment::getRenderbuffer() const ...@@ -146,6 +171,11 @@ Renderbuffer *TextureAttachment::getRenderbuffer() const
return nullptr; return nullptr;
} }
Texture *TextureAttachment::getTexture() const
{
return rx::GetAs<Texture>(mResource.get());
}
////// RenderbufferAttachment Implementation ////// ////// RenderbufferAttachment Implementation //////
RenderbufferAttachment::RenderbufferAttachment(GLenum binding, Renderbuffer *renderbuffer) RenderbufferAttachment::RenderbufferAttachment(GLenum binding, Renderbuffer *renderbuffer)
...@@ -158,26 +188,6 @@ RenderbufferAttachment::~RenderbufferAttachment() ...@@ -158,26 +188,6 @@ RenderbufferAttachment::~RenderbufferAttachment()
{ {
} }
GLsizei RenderbufferAttachment::getWidth() const
{
return getRenderbuffer()->getWidth();
}
GLsizei RenderbufferAttachment::getHeight() const
{
return getRenderbuffer()->getHeight();
}
GLenum RenderbufferAttachment::getInternalFormat() const
{
return getRenderbuffer()->getInternalFormat();
}
GLsizei RenderbufferAttachment::getSamples() const
{
return getRenderbuffer()->getSamples();
}
GLenum RenderbufferAttachment::type() const GLenum RenderbufferAttachment::type() const
{ {
return GL_RENDERBUFFER; return GL_RENDERBUFFER;
...@@ -189,35 +199,18 @@ Texture *RenderbufferAttachment::getTexture() const ...@@ -189,35 +199,18 @@ Texture *RenderbufferAttachment::getTexture() const
return nullptr; return nullptr;
} }
DefaultAttachment::DefaultAttachment(GLenum binding, egl::Surface *surface) Renderbuffer *RenderbufferAttachment::getRenderbuffer() const
: FramebufferAttachment(binding, ImageIndex::MakeInvalid(), surface)
{ {
return rx::GetAs<Renderbuffer>(mResource.get());
} }
DefaultAttachment::~DefaultAttachment() DefaultAttachment::DefaultAttachment(GLenum binding, egl::Surface *surface)
{ : FramebufferAttachment(binding, ImageIndex::MakeInvalid(), surface)
}
GLsizei DefaultAttachment::getWidth() const
{
return getSurface()->getWidth();
}
GLsizei DefaultAttachment::getHeight() const
{
return getSurface()->getHeight();
}
GLenum DefaultAttachment::getInternalFormat() const
{ {
const egl::Config *config = getSurface()->getConfig();
return (getBinding() == GL_BACK ? config->renderTargetFormat : config->depthStencilFormat);
} }
GLsizei DefaultAttachment::getSamples() const DefaultAttachment::~DefaultAttachment()
{ {
const egl::Config *config = getSurface()->getConfig();
return config->samples;
} }
GLenum DefaultAttachment::type() const GLenum DefaultAttachment::type() const
...@@ -237,4 +230,9 @@ Renderbuffer *DefaultAttachment::getRenderbuffer() const ...@@ -237,4 +230,9 @@ Renderbuffer *DefaultAttachment::getRenderbuffer() const
return nullptr; return nullptr;
} }
const egl::Surface *DefaultAttachment::getSurface() const
{
return rx::GetAs<egl::Surface>(mResource.get());
}
} }
...@@ -12,13 +12,19 @@ ...@@ -12,13 +12,19 @@
#include "angle_gl.h" #include "angle_gl.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Texture.h" #include "libANGLE/ImageIndex.h"
#include "libANGLE/Renderbuffer.h" #include "libANGLE/RefCountObject.h"
#include "libANGLE/Surface.h"
namespace egl
{
class Surface;
}
namespace gl namespace gl
{ {
class FramebufferAttachmentObject;
class Renderbuffer; class Renderbuffer;
class Texture;
// FramebufferAttachment implements a GL framebuffer attachment. // FramebufferAttachment implements a GL framebuffer attachment.
// Attachments are "light" containers, which store pointers to ref-counted GL objects. // Attachments are "light" containers, which store pointers to ref-counted GL objects.
...@@ -31,9 +37,30 @@ class FramebufferAttachment : angle::NonCopyable ...@@ -31,9 +37,30 @@ class FramebufferAttachment : angle::NonCopyable
public: public:
FramebufferAttachment(GLenum binding, FramebufferAttachment(GLenum binding,
const ImageIndex &textureIndex, const ImageIndex &textureIndex,
RefCountObject *resource); FramebufferAttachmentObject *resource);
virtual ~FramebufferAttachment(); virtual ~FramebufferAttachment();
// A framebuffer attachment points to one of three types of resources: Renderbuffers,
// Textures and egl::Surface. The "Target" struct indicates which part of the
// object an attachment references. For the three types:
// - a Renderbuffer has a unique renderable target, and needs no target index
// - a Texture has targets for every image and uses an ImageIndex
// - a Surface has targets for Color and Depth/Stencil, and uses the attachment binding
class Target
{
public:
Target(GLenum binding, const ImageIndex &imageIndex);
Target(const Target &other);
Target &operator=(const Target &other);
GLenum binding() const { return mBinding; }
const ImageIndex &textureIndex() const { return mTextureIndex; }
private:
GLenum mBinding;
ImageIndex mTextureIndex;
};
// Helper methods // Helper methods
GLuint getRedSize() const; GLuint getRedSize() const;
GLuint getGreenSize() const; GLuint getGreenSize() const;
...@@ -47,7 +74,7 @@ class FramebufferAttachment : angle::NonCopyable ...@@ -47,7 +74,7 @@ class FramebufferAttachment : angle::NonCopyable
bool isTextureWithId(GLuint textureId) const { return type() == GL_TEXTURE && id() == textureId; } bool isTextureWithId(GLuint textureId) const { return type() == GL_TEXTURE && id() == textureId; }
bool isRenderbufferWithId(GLuint renderbufferId) const { return type() == GL_RENDERBUFFER && id() == renderbufferId; } bool isRenderbufferWithId(GLuint renderbufferId) const { return type() == GL_RENDERBUFFER && id() == renderbufferId; }
GLenum getBinding() const { return mBinding; } GLenum getBinding() const { return mTarget.binding(); }
GLuint id() const { return mResource.id(); } GLuint id() const { return mResource.id(); }
// These methods are only legal to call on Texture attachments // These methods are only legal to call on Texture attachments
...@@ -56,21 +83,20 @@ class FramebufferAttachment : angle::NonCopyable ...@@ -56,21 +83,20 @@ class FramebufferAttachment : angle::NonCopyable
GLint mipLevel() const; GLint mipLevel() const;
GLint layer() const; GLint layer() const;
// Child class interface GLsizei getWidth() const;
virtual GLsizei getWidth() const = 0; GLsizei getHeight() const;
virtual GLsizei getHeight() const = 0; GLenum getInternalFormat() const;
virtual GLenum getInternalFormat() const = 0; GLsizei getSamples() const;
virtual GLsizei getSamples() const = 0;
// Child class interface
virtual GLenum type() const = 0; virtual GLenum type() const = 0;
virtual Texture *getTexture() const = 0; virtual Texture *getTexture() const = 0;
virtual Renderbuffer *getRenderbuffer() const = 0; virtual Renderbuffer *getRenderbuffer() const = 0;
protected: protected:
GLenum mBinding; Target mTarget;
ImageIndex mTextureIndex; BindingPointer<FramebufferAttachmentObject> mResource;
BindingPointer<RefCountObject> mResource;
}; };
class TextureAttachment : public FramebufferAttachment class TextureAttachment : public FramebufferAttachment
...@@ -79,20 +105,11 @@ class TextureAttachment : public FramebufferAttachment ...@@ -79,20 +105,11 @@ class TextureAttachment : public FramebufferAttachment
TextureAttachment(GLenum binding, Texture *texture, const ImageIndex &index); TextureAttachment(GLenum binding, Texture *texture, const ImageIndex &index);
virtual ~TextureAttachment(); virtual ~TextureAttachment();
virtual GLsizei getSamples() const;
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLenum getInternalFormat() const;
virtual GLenum type() const; virtual GLenum type() const;
virtual Renderbuffer *getRenderbuffer() const; virtual Renderbuffer *getRenderbuffer() const;
Texture *getTexture() const override Texture *getTexture() const override;
{
return rx::GetAs<Texture>(mResource.get());
}
}; };
class RenderbufferAttachment : public FramebufferAttachment class RenderbufferAttachment : public FramebufferAttachment
...@@ -102,19 +119,11 @@ class RenderbufferAttachment : public FramebufferAttachment ...@@ -102,19 +119,11 @@ class RenderbufferAttachment : public FramebufferAttachment
virtual ~RenderbufferAttachment(); virtual ~RenderbufferAttachment();
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLenum getInternalFormat() const;
virtual GLsizei getSamples() const;
virtual GLenum type() const; virtual GLenum type() const;
virtual Texture *getTexture() const; virtual Texture *getTexture() const;
Renderbuffer *getRenderbuffer() const override Renderbuffer *getRenderbuffer() const override;
{
return rx::GetAs<Renderbuffer>(mResource.get());
}
}; };
class DefaultAttachment : public FramebufferAttachment class DefaultAttachment : public FramebufferAttachment
...@@ -124,20 +133,24 @@ class DefaultAttachment : public FramebufferAttachment ...@@ -124,20 +133,24 @@ class DefaultAttachment : public FramebufferAttachment
virtual ~DefaultAttachment(); virtual ~DefaultAttachment();
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLenum getInternalFormat() const;
virtual GLsizei getSamples() const;
virtual GLenum type() const; virtual GLenum type() const;
virtual Texture *getTexture() const; virtual Texture *getTexture() const;
virtual Renderbuffer *getRenderbuffer() const; virtual Renderbuffer *getRenderbuffer() const;
const egl::Surface *getSurface() const const egl::Surface *getSurface() const;
{ };
return rx::GetAs<egl::Surface>(mResource.get());
} // A base class for objects that FBO Attachments may point to.
class FramebufferAttachmentObject : public RefCountObject
{
public:
FramebufferAttachmentObject(GLuint id) : RefCountObject(id) {}
virtual GLsizei getAttachmentWidth(const FramebufferAttachment::Target &target) const = 0;
virtual GLsizei getAttachmentHeight(const FramebufferAttachment::Target &target) const = 0;
virtual GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &target) const = 0;
virtual GLsizei getAttachmentSamples(const FramebufferAttachment::Target &target) const = 0;
}; };
} }
......
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
namespace gl namespace gl
{ {
Renderbuffer::Renderbuffer(rx::RenderbufferImpl *impl, GLuint id) Renderbuffer::Renderbuffer(rx::RenderbufferImpl *impl, GLuint id)
: RefCountObject(id), : FramebufferAttachmentObject(id),
mRenderbuffer(impl), mRenderbuffer(impl),
mWidth(0), mWidth(0),
mHeight(0), mHeight(0),
......
...@@ -12,11 +12,9 @@ ...@@ -12,11 +12,9 @@
#define LIBANGLE_RENDERBUFFER_H_ #define LIBANGLE_RENDERBUFFER_H_
#include "angle_gl.h" #include "angle_gl.h"
#include "libANGLE/Error.h"
#include "libANGLE/RefCountObject.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h"
namespace rx namespace rx
{ {
...@@ -25,14 +23,12 @@ class RenderbufferImpl; ...@@ -25,14 +23,12 @@ class RenderbufferImpl;
namespace gl namespace gl
{ {
class FramebufferAttachment;
// A GL renderbuffer object is usually used as a depth or stencil buffer attachment // A GL renderbuffer object is usually used as a depth or stencil buffer attachment
// for a framebuffer object. The renderbuffer itself is a distinct GL object, see // for a framebuffer object. The renderbuffer itself is a distinct GL object, see
// FramebufferAttachment and Framebuffer for how they are applied to an FBO via an // FramebufferAttachment and Framebuffer for how they are applied to an FBO via an
// attachment point. // attachment point.
class Renderbuffer : public RefCountObject class Renderbuffer : public FramebufferAttachmentObject
{ {
public: public:
Renderbuffer(rx::RenderbufferImpl *impl, GLuint id); Renderbuffer(rx::RenderbufferImpl *impl, GLuint id);
...@@ -55,6 +51,12 @@ class Renderbuffer : public RefCountObject ...@@ -55,6 +51,12 @@ class Renderbuffer : public RefCountObject
GLuint getDepthSize() const; GLuint getDepthSize() const;
GLuint getStencilSize() const; GLuint getStencilSize() const;
// FramebufferAttachmentObject Impl
GLsizei getAttachmentWidth(const FramebufferAttachment::Target &/*target*/) const override { return getWidth(); }
GLsizei getAttachmentHeight(const FramebufferAttachment::Target &/*target*/) const override { return getHeight(); }
GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &/*target*/) const override { return getInternalFormat(); }
GLsizei getAttachmentSamples(const FramebufferAttachment::Target &/*target*/) const override { return getSamples(); }
private: private:
rx::RenderbufferImpl *mRenderbuffer; rx::RenderbufferImpl *mRenderbuffer;
......
...@@ -20,7 +20,7 @@ namespace egl ...@@ -20,7 +20,7 @@ namespace egl
{ {
Surface::Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes) Surface::Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes)
: RefCountObject(0), // id unused : FramebufferAttachmentObject(0), // id unused
mImplementation(impl), mImplementation(impl),
mType(surfaceType), mType(surfaceType),
mConfig(config), mConfig(config),
...@@ -163,4 +163,15 @@ Error Surface::releaseTexImage(EGLint buffer) ...@@ -163,4 +163,15 @@ Error Surface::releaseTexImage(EGLint buffer)
return mImplementation->releaseTexImage(buffer); return mImplementation->releaseTexImage(buffer);
} }
GLenum Surface::getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &target) const
{
const egl::Config *config = getConfig();
return (target.binding() == GL_BACK ? config->renderTargetFormat : config->depthStencilFormat);
}
GLsizei Surface::getAttachmentSamples(const gl::FramebufferAttachment::Target &target) const
{
return getConfig()->samples;
}
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/RefCountObject.h" #include "libANGLE/FramebufferAttachment.h"
namespace gl namespace gl
{ {
...@@ -33,7 +33,7 @@ class AttributeMap; ...@@ -33,7 +33,7 @@ class AttributeMap;
class Display; class Display;
struct Config; struct Config;
class Surface final : public RefCountObject class Surface final : public gl::FramebufferAttachmentObject
{ {
public: public:
Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes); Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes);
...@@ -68,6 +68,12 @@ class Surface final : public RefCountObject ...@@ -68,6 +68,12 @@ class Surface final : public RefCountObject
EGLint isFixedSize() const; EGLint isFixedSize() const;
// FramebufferAttachmentObject implementation
GLsizei getAttachmentWidth(const gl::FramebufferAttachment::Target &/*target*/) const override { return getWidth(); }
GLsizei getAttachmentHeight(const gl::FramebufferAttachment::Target &/*target*/) const override { return getHeight(); }
GLenum getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &target) const override;
GLsizei getAttachmentSamples(const gl::FramebufferAttachment::Target &target) const override;
private: private:
virtual ~Surface(); virtual ~Surface();
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
// Texture.cpp: Implements the gl::Texture class. [OpenGL ES 2.0.24] section 3.7 page 63. // Texture.cpp: Implements the gl::Texture class. [OpenGL ES 2.0.24] section 3.7 page 63.
#include "libANGLE/Texture.h" #include "libANGLE/Texture.h"
#include "libANGLE/Data.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/Config.h"
#include "libANGLE/Surface.h"
#include "common/mathutil.h" #include "common/mathutil.h"
#include "common/utilities.h" #include "common/utilities.h"
#include "libANGLE/Config.h"
#include "libANGLE/Data.h"
#include "libANGLE/Surface.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/TextureImpl.h"
namespace gl namespace gl
{ {
...@@ -49,7 +49,7 @@ static size_t GetImageDescIndex(GLenum target, size_t level) ...@@ -49,7 +49,7 @@ static size_t GetImageDescIndex(GLenum target, size_t level)
unsigned int Texture::mCurrentTextureSerial = 1; unsigned int Texture::mCurrentTextureSerial = 1;
Texture::Texture(rx::TextureImpl *impl, GLuint id, GLenum target) Texture::Texture(rx::TextureImpl *impl, GLuint id, GLenum target)
: RefCountObject(id), : FramebufferAttachmentObject(id),
mTexture(impl), mTexture(impl),
mTextureSerial(issueTextureSerial()), mTextureSerial(issueTextureSerial()),
mUsage(GL_NONE), mUsage(GL_NONE),
...@@ -570,4 +570,25 @@ Texture::SamplerCompletenessCache::SamplerCompletenessCache() ...@@ -570,4 +570,25 @@ Texture::SamplerCompletenessCache::SamplerCompletenessCache()
{ {
} }
GLsizei Texture::getAttachmentWidth(const gl::FramebufferAttachment::Target &target) const
{
return getWidth(target.textureIndex().type, target.textureIndex().mipIndex);
}
GLsizei Texture::getAttachmentHeight(const gl::FramebufferAttachment::Target &target) const
{
return getHeight(target.textureIndex().type, target.textureIndex().mipIndex);
}
GLenum Texture::getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &target) const
{
return getInternalFormat(target.textureIndex().type, target.textureIndex().mipIndex);
}
GLsizei Texture::getAttachmentSamples(const gl::FramebufferAttachment::Target &/*target*/) const
{
// Multisample textures not currently supported
return 0;
}
} }
...@@ -9,23 +9,27 @@ ...@@ -9,23 +9,27 @@
#ifndef LIBANGLE_TEXTURE_H_ #ifndef LIBANGLE_TEXTURE_H_
#define LIBANGLE_TEXTURE_H_ #define LIBANGLE_TEXTURE_H_
#include "common/debug.h"
#include "libANGLE/RefCountObject.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/Constants.h"
#include "libANGLE/renderer/TextureImpl.h"
#include "libANGLE/Caps.h"
#include "angle_gl.h"
#include <vector> #include <vector>
#include <map> #include <map>
#include "angle_gl.h"
#include "common/debug.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Constants.h"
#include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/angletypes.h"
namespace egl namespace egl
{ {
class Surface; class Surface;
} }
namespace rx
{
class TextureImpl;
}
namespace gl namespace gl
{ {
class Framebuffer; class Framebuffer;
...@@ -33,7 +37,7 @@ struct Data; ...@@ -33,7 +37,7 @@ struct Data;
bool IsMipmapFiltered(const gl::SamplerState &samplerState); bool IsMipmapFiltered(const gl::SamplerState &samplerState);
class Texture final : public RefCountObject class Texture final : public FramebufferAttachmentObject
{ {
public: public:
Texture(rx::TextureImpl *impl, GLuint id, GLenum target); Texture(rx::TextureImpl *impl, GLuint id, GLenum target);
...@@ -90,6 +94,12 @@ class Texture final : public RefCountObject ...@@ -90,6 +94,12 @@ class Texture final : public RefCountObject
static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager. static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
// FramebufferAttachmentObject implementation
GLsizei getAttachmentWidth(const FramebufferAttachment::Target &target) const override;
GLsizei getAttachmentHeight(const FramebufferAttachment::Target &target) const override;
GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &target) const override;
GLsizei getAttachmentSamples(const FramebufferAttachment::Target &target) const override;
private: private:
static unsigned int issueTextureSerial(); static unsigned int issueTextureSerial();
......
...@@ -10,10 +10,8 @@ ...@@ -10,10 +10,8 @@
#define LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_ #define LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
#include "angle_gl.h" #include "angle_gl.h"
#include "libANGLE/Error.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h"
namespace rx namespace rx
{ {
......
...@@ -9,14 +9,12 @@ ...@@ -9,14 +9,12 @@
#ifndef LIBANGLE_RENDERER_TEXTUREIMPL_H_ #ifndef LIBANGLE_RENDERER_TEXTUREIMPL_H_
#define LIBANGLE_RENDERER_TEXTUREIMPL_H_ #define LIBANGLE_RENDERER_TEXTUREIMPL_H_
#include "libANGLE/Error.h" #include <stdint.h>
#include "libANGLE/ImageIndex.h"
#include "common/angleutils.h"
#include "angle_gl.h" #include "angle_gl.h"
#include "common/angleutils.h"
#include <stdint.h> #include "libANGLE/Error.h"
#include "libANGLE/ImageIndex.h"
namespace egl namespace egl
{ {
...@@ -40,7 +38,8 @@ namespace rx ...@@ -40,7 +38,8 @@ namespace rx
class TextureImpl : angle::NonCopyable class TextureImpl : angle::NonCopyable
{ {
public: public:
virtual ~TextureImpl() {}; TextureImpl() {}
virtual ~TextureImpl() {}
virtual void setUsage(GLenum usage) = 0; virtual void setUsage(GLenum usage) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment