Commit 894858a5 by Nicolas Capens Committed by Nicolas Capens

Don't upload array texture images six times.

Change-Id: I5be0cc629477b6cfb3ede6b4484f067d1c30b0ec Reviewed-on: https://swiftshader-review.googlesource.com/17929Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 16a2a922
......@@ -4249,7 +4249,7 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
return error(GL_INVALID_VALUE);
}
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
es1::Context *context = es1::getContext();
......
......@@ -925,7 +925,7 @@ void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x,
{
return error(GL_INVALID_VALUE);
}
// Fall through
// Fall through to GL_TEXTURE_2D case.
case GL_TEXTURE_2D:
if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
......@@ -4971,7 +4971,7 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
}
}
GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target, context->getClientVersion());
GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target, clientVersion);
if(validationError != GL_NO_ERROR)
{
return error(validationError);
......@@ -4989,7 +4989,7 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
{
return error(GL_INVALID_VALUE); // Defining level other than 0 is not allowed
}
// Fall through
// Fall through to GL_TEXTURE_2D case.
case GL_TEXTURE_2D:
if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
......@@ -5018,14 +5018,14 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
return error(GL_INVALID_ENUM);
}
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
{
es2::Texture2D *texture = context->getTexture2D(target);
......@@ -6267,7 +6267,7 @@ void TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei wi
return error(validationError);
}
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
texture->setImage(level, width, height, depth, sizedInternalFormat, format, type, context->getUnpackParameters(), data);
}
}
......
......@@ -387,7 +387,7 @@ GL_APICALL void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint inter
return error(validationError);
}
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
texture->setImage(level, width, height, depth, sizedInternalFormat, format, type, context->getUnpackParameters(), data);
}
}
......@@ -3621,6 +3621,7 @@ GL_APICALL void GL_APIENTRY glTexStorage2D(GLenum target, GLsizei levels, GLenum
{
return error(GL_INVALID_ENUM);
}
// Fall through to GL_TEXTURE_2D case.
case GL_TEXTURE_2D:
{
if((width > es2::IMPLEMENTATION_MAX_TEXTURE_SIZE) ||
......@@ -3735,10 +3736,8 @@ GL_APICALL void GL_APIENTRY glTexStorage3D(GLenum target, GLsizei levels, GLenum
for(int level = 0; level < levels; level++)
{
for(int face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; face++)
{
texture->setImage(level, width, height, depth, internalformat, GL_NONE, GL_NONE, context->getUnpackParameters(), nullptr);
}
width = std::max(1, (width / 2));
height = std::max(1, (height / 2));
}
......
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