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/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 4f29d7d..33c3c08 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -366,7 +366,7 @@
return false;
}
- gl::Texture *texture = context->getTargetTexture(IsCubemapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+ gl::Texture *texture = context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
if (!texture)
{
context->recordError(Error(GL_INVALID_OPERATION));
@@ -865,13 +865,10 @@
const gl::Caps &caps = context->getCaps();
- gl::Texture *texture = NULL;
switch (target)
{
case GL_TEXTURE_2D:
{
- texture = context->getTexture2D();
-
if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
static_cast<GLuint>(height) > caps.max2DTextureSize)
{
@@ -883,8 +880,6 @@
case GL_TEXTURE_CUBE_MAP:
{
- texture = context->getTextureCubeMap();
-
if (width != height)
{
context->recordError(Error(GL_INVALID_VALUE));
@@ -901,8 +896,6 @@
case GL_TEXTURE_3D:
{
- texture = context->getTexture3D();
-
if (static_cast<GLuint>(width) > caps.max3DTextureSize ||
static_cast<GLuint>(height) > caps.max3DTextureSize ||
static_cast<GLuint>(depth) > caps.max3DTextureSize)
@@ -915,8 +908,6 @@
case GL_TEXTURE_2D_ARRAY:
{
- texture = context->getTexture2DArray();
-
if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
static_cast<GLuint>(height) > caps.max2DTextureSize ||
static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
@@ -932,6 +923,7 @@
return false;
}
+ gl::Texture *texture = context->getTargetTexture(target);
if (!texture || texture->id() == 0)
{
context->recordError(Error(GL_INVALID_OPERATION));