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/263487
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Texture.cpp b/src/libANGLE/Texture.cpp
index 2d68bec..2db6b4a 100644
--- a/src/libANGLE/Texture.cpp
+++ b/src/libANGLE/Texture.cpp
@@ -7,14 +7,14 @@
// Texture.cpp: Implements the gl::Texture class. [OpenGL ES 2.0.24] section 3.7 page 63.
#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/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
{
@@ -49,7 +49,7 @@
unsigned int Texture::mCurrentTextureSerial = 1;
Texture::Texture(rx::TextureImpl *impl, GLuint id, GLenum target)
- : RefCountObject(id),
+ : FramebufferAttachmentObject(id),
mTexture(impl),
mTextureSerial(issueTextureSerial()),
mUsage(GL_NONE),
@@ -570,4 +570,25 @@
{
}
+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;
+}
+
}