summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp')
-rw-r--r--src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp385
1 files changed, 60 insertions, 325 deletions
diff --git a/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp b/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
index 5855301c97..540ede1cd2 100644
--- a/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -9,21 +8,22 @@
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
#include "libGLESv2/FramebufferAttachment.h"
-#include "libGLESv2/renderer/RenderTarget.h"
-
#include "libGLESv2/Texture.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/renderer/RenderTarget.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/d3d/TextureStorage.h"
+
#include "common/utilities.h"
-#include "libGLESv2/formatutils.h"
-#include "libGLESv2/Renderbuffer.h"
namespace gl
{
////// FramebufferAttachment Implementation //////
-FramebufferAttachment::FramebufferAttachment()
+FramebufferAttachment::FramebufferAttachment(GLenum binding)
+ : mBinding(binding)
{
}
@@ -33,42 +33,42 @@ FramebufferAttachment::~FramebufferAttachment()
GLuint FramebufferAttachment::getRedSize() const
{
- return (gl::GetRedBits(getInternalFormat()) > 0) ? gl::GetRedBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).redBits > 0) ? GetInternalFormatInfo(getActualFormat()).redBits : 0;
}
GLuint FramebufferAttachment::getGreenSize() const
{
- return (gl::GetGreenBits(getInternalFormat()) > 0) ? gl::GetGreenBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).greenBits > 0) ? GetInternalFormatInfo(getActualFormat()).greenBits : 0;
}
GLuint FramebufferAttachment::getBlueSize() const
{
- return (gl::GetBlueBits(getInternalFormat()) > 0) ? gl::GetBlueBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).blueBits > 0) ? GetInternalFormatInfo(getActualFormat()).blueBits : 0;
}
GLuint FramebufferAttachment::getAlphaSize() const
{
- return (gl::GetAlphaBits(getInternalFormat()) > 0) ? gl::GetAlphaBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).alphaBits > 0) ? GetInternalFormatInfo(getActualFormat()).alphaBits : 0;
}
GLuint FramebufferAttachment::getDepthSize() const
{
- return (gl::GetDepthBits(getInternalFormat()) > 0) ? gl::GetDepthBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).depthBits > 0) ? GetInternalFormatInfo(getActualFormat()).depthBits : 0;
}
GLuint FramebufferAttachment::getStencilSize() const
{
- return (gl::GetStencilBits(getInternalFormat()) > 0) ? gl::GetStencilBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).stencilBits > 0) ? GetInternalFormatInfo(getActualFormat()).stencilBits : 0;
}
GLenum FramebufferAttachment::getComponentType() const
{
- return gl::GetComponentType(getActualFormat());
+ return GetInternalFormatInfo(getActualFormat()).componentType;
}
GLenum FramebufferAttachment::getColorEncoding() const
{
- return gl::GetColorEncoding(getActualFormat());
+ return GetInternalFormatInfo(getActualFormat()).colorEncoding;
}
bool FramebufferAttachment::isTexture() const
@@ -76,340 +76,85 @@ bool FramebufferAttachment::isTexture() const
return (type() != GL_RENDERBUFFER);
}
-///// Texture2DAttachment Implementation ////////
-
-Texture2DAttachment::Texture2DAttachment(Texture2D *texture, GLint level) : mLevel(level)
-{
- mTexture2D.set(texture);
-}
-
-Texture2DAttachment::~Texture2DAttachment()
-{
- mTexture2D.set(NULL);
-}
-
-rx::RenderTarget *Texture2DAttachment::getRenderTarget()
-{
- return mTexture2D->getRenderTarget(mLevel);
-}
-
-rx::RenderTarget *Texture2DAttachment::getDepthStencil()
-{
- return mTexture2D->getDepthSencil(mLevel);
-}
-
-rx::TextureStorage *Texture2DAttachment::getTextureStorage()
-{
- return mTexture2D->getNativeTexture()->getStorageInstance();
-}
-
-GLsizei Texture2DAttachment::getWidth() const
-{
- return mTexture2D->getWidth(mLevel);
-}
-
-GLsizei Texture2DAttachment::getHeight() const
-{
- return mTexture2D->getHeight(mLevel);
-}
-
-GLenum Texture2DAttachment::getInternalFormat() const
-{
- return mTexture2D->getInternalFormat(mLevel);
-}
-
-GLenum Texture2DAttachment::getActualFormat() const
-{
- return mTexture2D->getActualFormat(mLevel);
-}
-
-GLsizei Texture2DAttachment::getSamples() const
-{
- return 0;
-}
-
-unsigned int Texture2DAttachment::getSerial() const
-{
- return mTexture2D->getRenderTargetSerial(mLevel);
-}
-
-GLuint Texture2DAttachment::id() const
-{
- return mTexture2D->id();
-}
-
-GLenum Texture2DAttachment::type() const
-{
- return GL_TEXTURE_2D;
-}
-
-GLint Texture2DAttachment::mipLevel() const
-{
- return mLevel;
-}
-
-GLint Texture2DAttachment::layer() const
-{
- return 0;
-}
-
-unsigned int Texture2DAttachment::getTextureSerial() const
-{
- return mTexture2D->getTextureSerial();
-}
-
-///// TextureCubeMapAttachment Implementation ////////
-
-TextureCubeMapAttachment::TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level)
- : mFaceTarget(faceTarget), mLevel(level)
-{
- mTextureCubeMap.set(texture);
-}
-
-TextureCubeMapAttachment::~TextureCubeMapAttachment()
-{
- mTextureCubeMap.set(NULL);
-}
-
-rx::RenderTarget *TextureCubeMapAttachment::getRenderTarget()
-{
- return mTextureCubeMap->getRenderTarget(mFaceTarget, mLevel);
-}
-
-rx::RenderTarget *TextureCubeMapAttachment::getDepthStencil()
-{
- return mTextureCubeMap->getDepthStencil(mFaceTarget, mLevel);
-}
-
-rx::TextureStorage *TextureCubeMapAttachment::getTextureStorage()
-{
- return mTextureCubeMap->getNativeTexture()->getStorageInstance();
-}
-
-GLsizei TextureCubeMapAttachment::getWidth() const
-{
- return mTextureCubeMap->getWidth(mFaceTarget, mLevel);
-}
-
-GLsizei TextureCubeMapAttachment::getHeight() const
-{
- return mTextureCubeMap->getHeight(mFaceTarget, mLevel);
-}
-
-GLenum TextureCubeMapAttachment::getInternalFormat() const
-{
- return mTextureCubeMap->getInternalFormat(mFaceTarget, mLevel);
-}
-
-GLenum TextureCubeMapAttachment::getActualFormat() const
-{
- return mTextureCubeMap->getActualFormat(mFaceTarget, mLevel);
-}
-
-GLsizei TextureCubeMapAttachment::getSamples() const
-{
- return 0;
-}
-
-unsigned int TextureCubeMapAttachment::getSerial() const
-{
- return mTextureCubeMap->getRenderTargetSerial(mFaceTarget, mLevel);
-}
-
-GLuint TextureCubeMapAttachment::id() const
-{
- return mTextureCubeMap->id();
-}
-
-GLenum TextureCubeMapAttachment::type() const
-{
- return mFaceTarget;
-}
-
-GLint TextureCubeMapAttachment::mipLevel() const
-{
- return mLevel;
-}
-
-GLint TextureCubeMapAttachment::layer() const
-{
- return 0;
-}
-
-unsigned int TextureCubeMapAttachment::getTextureSerial() const
-{
- return mTextureCubeMap->getTextureSerial();
-}
-
-///// Texture3DAttachment Implementation ////////
-
-Texture3DAttachment::Texture3DAttachment(Texture3D *texture, GLint level, GLint layer)
- : mLevel(level), mLayer(layer)
-{
- mTexture3D.set(texture);
-}
-
-Texture3DAttachment::~Texture3DAttachment()
-{
- mTexture3D.set(NULL);
-}
-
-rx::RenderTarget *Texture3DAttachment::getRenderTarget()
-{
- return mTexture3D->getRenderTarget(mLevel, mLayer);
-}
-
-rx::RenderTarget *Texture3DAttachment::getDepthStencil()
-{
- return mTexture3D->getDepthStencil(mLevel, mLayer);
-}
-
-rx::TextureStorage *Texture3DAttachment::getTextureStorage()
-{
- return mTexture3D->getNativeTexture()->getStorageInstance();
-}
-
-GLsizei Texture3DAttachment::getWidth() const
-{
- return mTexture3D->getWidth(mLevel);
-}
-
-GLsizei Texture3DAttachment::getHeight() const
-{
- return mTexture3D->getHeight(mLevel);
-}
+///// TextureAttachment Implementation ////////
-GLenum Texture3DAttachment::getInternalFormat() const
+TextureAttachment::TextureAttachment(GLenum binding, Texture *texture, const ImageIndex &index)
+ : FramebufferAttachment(binding),
+ mIndex(index)
{
- return mTexture3D->getInternalFormat(mLevel);
+ mTexture.set(texture);
}
-GLenum Texture3DAttachment::getActualFormat() const
+TextureAttachment::~TextureAttachment()
{
- return mTexture3D->getActualFormat(mLevel);
+ mTexture.set(NULL);
}
-GLsizei Texture3DAttachment::getSamples() const
+GLsizei TextureAttachment::getSamples() const
{
return 0;
}
-unsigned int Texture3DAttachment::getSerial() const
-{
- return mTexture3D->getRenderTargetSerial(mLevel, mLayer);
-}
-
-GLuint Texture3DAttachment::id() const
-{
- return mTexture3D->id();
-}
-
-GLenum Texture3DAttachment::type() const
-{
- return GL_TEXTURE_3D;
-}
-
-GLint Texture3DAttachment::mipLevel() const
-{
- return mLevel;
-}
-
-GLint Texture3DAttachment::layer() const
-{
- return mLayer;
-}
-
-unsigned int Texture3DAttachment::getTextureSerial() const
-{
- return mTexture3D->getTextureSerial();
-}
-
-////// Texture2DArrayAttachment Implementation //////
-
-Texture2DArrayAttachment::Texture2DArrayAttachment(Texture2DArray *texture, GLint level, GLint layer)
- : mLevel(level), mLayer(layer)
-{
- mTexture2DArray.set(texture);
-}
-
-Texture2DArrayAttachment::~Texture2DArrayAttachment()
-{
- mTexture2DArray.set(NULL);
-}
-
-rx::RenderTarget *Texture2DArrayAttachment::getRenderTarget()
+GLuint TextureAttachment::id() const
{
- return mTexture2DArray->getRenderTarget(mLevel, mLayer);
+ return mTexture->id();
}
-rx::RenderTarget *Texture2DArrayAttachment::getDepthStencil()
+GLsizei TextureAttachment::getWidth() const
{
- return mTexture2DArray->getDepthStencil(mLevel, mLayer);
+ return mTexture->getWidth(mIndex);
}
-rx::TextureStorage *Texture2DArrayAttachment::getTextureStorage()
+GLsizei TextureAttachment::getHeight() const
{
- return mTexture2DArray->getNativeTexture()->getStorageInstance();
+ return mTexture->getHeight(mIndex);
}
-GLsizei Texture2DArrayAttachment::getWidth() const
+GLenum TextureAttachment::getInternalFormat() const
{
- return mTexture2DArray->getWidth(mLevel);
+ return mTexture->getInternalFormat(mIndex);
}
-GLsizei Texture2DArrayAttachment::getHeight() const
+GLenum TextureAttachment::getActualFormat() const
{
- return mTexture2DArray->getHeight(mLevel);
+ return mTexture->getActualFormat(mIndex);
}
-GLenum Texture2DArrayAttachment::getInternalFormat() const
+GLenum TextureAttachment::type() const
{
- return mTexture2DArray->getInternalFormat(mLevel);
+ return mIndex.type;
}
-GLenum Texture2DArrayAttachment::getActualFormat() const
+GLint TextureAttachment::mipLevel() const
{
- return mTexture2DArray->getActualFormat(mLevel);
+ return mIndex.mipIndex;
}
-GLsizei Texture2DArrayAttachment::getSamples() const
+GLint TextureAttachment::layer() const
{
- return 0;
-}
-
-unsigned int Texture2DArrayAttachment::getSerial() const
-{
- return mTexture2DArray->getRenderTargetSerial(mLevel, mLayer);
-}
-
-GLuint Texture2DArrayAttachment::id() const
-{
- return mTexture2DArray->id();
-}
-
-GLenum Texture2DArrayAttachment::type() const
-{
- return GL_TEXTURE_2D_ARRAY;
+ return mIndex.layerIndex;
}
-GLint Texture2DArrayAttachment::mipLevel() const
+Texture *TextureAttachment::getTexture()
{
- return mLevel;
+ return mTexture.get();
}
-GLint Texture2DArrayAttachment::layer() const
+const ImageIndex *TextureAttachment::getTextureImageIndex() const
{
- return mLayer;
+ return &mIndex;
}
-unsigned int Texture2DArrayAttachment::getTextureSerial() const
+Renderbuffer *TextureAttachment::getRenderbuffer()
{
- return mTexture2DArray->getTextureSerial();
+ UNREACHABLE();
+ return NULL;
}
////// RenderbufferAttachment Implementation //////
-RenderbufferAttachment::RenderbufferAttachment(Renderbuffer *renderbuffer)
+RenderbufferAttachment::RenderbufferAttachment(GLenum binding, Renderbuffer *renderbuffer)
+ : FramebufferAttachment(binding)
{
ASSERT(renderbuffer);
mRenderbuffer.set(renderbuffer);
@@ -420,22 +165,6 @@ RenderbufferAttachment::~RenderbufferAttachment()
mRenderbuffer.set(NULL);
}
-rx::RenderTarget *RenderbufferAttachment::getRenderTarget()
-{
- return mRenderbuffer->getStorage()->getRenderTarget();
-}
-
-rx::RenderTarget *RenderbufferAttachment::getDepthStencil()
-{
- return mRenderbuffer->getStorage()->getDepthStencil();
-}
-
-rx::TextureStorage *RenderbufferAttachment::getTextureStorage()
-{
- UNREACHABLE();
- return NULL;
-}
-
GLsizei RenderbufferAttachment::getWidth() const
{
return mRenderbuffer->getWidth();
@@ -461,11 +190,6 @@ GLsizei RenderbufferAttachment::getSamples() const
return mRenderbuffer->getStorage()->getSamples();
}
-unsigned int RenderbufferAttachment::getSerial() const
-{
- return mRenderbuffer->getStorage()->getSerial();
-}
-
GLuint RenderbufferAttachment::id() const
{
return mRenderbuffer->id();
@@ -486,10 +210,21 @@ GLint RenderbufferAttachment::layer() const
return 0;
}
-unsigned int RenderbufferAttachment::getTextureSerial() const
+Texture *RenderbufferAttachment::getTexture()
{
UNREACHABLE();
- return 0;
+ return NULL;
+}
+
+const ImageIndex *RenderbufferAttachment::getTextureImageIndex() const
+{
+ UNREACHABLE();
+ return NULL;
+}
+
+Renderbuffer *RenderbufferAttachment::getRenderbuffer()
+{
+ return mRenderbuffer.get();
}
}