Merge all gl::Texture* classes.
The validation for sampler completeness had a lot of duplicated code.
The special cases have been merged into the base class by checking mTarget.
BUG=angle:681
Change-Id: I11d94c1432f8fc70a1edaaf8228bbc43c3c8fff3
Reviewed-on: https://chromium-review.googlesource.com/236932
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/libANGLE/renderer/d3d/TextureD3D.cpp
index b53ef6c..1f8f885 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -434,7 +434,7 @@
return true;
}
- if (!gl::IsCubemapTextureTarget(baseImage->getTarget()) && baseImage->getHeight() <= 0)
+ if (!gl::IsCubeMapTextureTarget(baseImage->getTarget()) && baseImage->getHeight() <= 0)
{
return true;
}
@@ -1213,7 +1213,7 @@
ASSERT(size.depth == 1);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
- int faceIndex = gl::TextureCubeMap::targetToLayerIndex(target);
+ size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
redefineImage(faceIndex, level, internalFormat, size);
@@ -1240,7 +1240,7 @@
gl::Error TextureD3D_Cube::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source)
{
- int faceIndex = gl::TextureCubeMap::targetToLayerIndex(target);
+ size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE);
gl::Extents size(sourceArea.width, sourceArea.height, 1);
@@ -1287,7 +1287,7 @@
gl::Error TextureD3D_Cube::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source)
{
- int faceIndex = gl::TextureCubeMap::targetToLayerIndex(target);
+ size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
@@ -1427,7 +1427,7 @@
gl::Error TextureD3D_Cube::getRenderTarget(const gl::ImageIndex &index, RenderTarget **outRT)
{
- ASSERT(gl::IsCubemapTextureTarget(index.type));
+ ASSERT(gl::IsCubeMapTextureTarget(index.type));
// ensure the underlying texture is created
gl::Error error = ensureRenderTarget();
@@ -1605,7 +1605,7 @@
if (image->isDirty())
{
- GLenum faceTarget = gl::TextureCubeMap::layerIndexToTarget(faceIndex);
+ GLenum faceTarget = gl::LayerIndexToCubeMapTextureTarget(faceIndex);
gl::ImageIndex index = gl::ImageIndex::MakeCube(faceTarget, level);
gl::Box region(0, 0, 0, image->getWidth(), image->getHeight(), 1);
gl::Error error = commitRegion(index, region);
@@ -1659,12 +1659,12 @@
gl::ImageIndex TextureD3D_Cube::getImageIndex(GLint mip, GLint layer) const
{
// The "layer" of the image index corresponds to the cube face
- return gl::ImageIndex::MakeCube(gl::TextureCubeMap::layerIndexToTarget(layer), mip);
+ return gl::ImageIndex::MakeCube(gl::LayerIndexToCubeMapTextureTarget(layer), mip);
}
bool TextureD3D_Cube::isValidIndex(const gl::ImageIndex &index) const
{
- return (mTexStorage && gl::IsCubemapTextureTarget(index.type) &&
+ return (mTexStorage && gl::IsCubeMapTextureTarget(index.type) &&
index.mipIndex >= 0 && index.mipIndex < mTexStorage->getLevelCount());
}