Commit e65f564a by Nicolas Capens Committed by Nicolas Capens

Replace GL_NONE with GL_NO_ERROR when used as error.

GL_NONE is primarily a renderbuffer format, and GL_NO_ERROR more clearly conveys the meaning when used as a validation return code. Also, GL_NONE is not defined in OpenGL ES 1.1 (but GL_NONE_OES is, as a renderbuffer format). Change-Id: Ie1c00009c30c8d2717de15c7e27db295ecd9de1e Reviewed-on: https://swiftshader-review.googlesource.com/17489Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 135e2400
......@@ -242,7 +242,7 @@ RenderbufferStorage::RenderbufferStorage()
{
mWidth = 0;
mHeight = 0;
format = GL_NONE;
format = GL_NONE_OES;
mSamples = 0;
}
......
......@@ -1882,7 +1882,7 @@ void GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params)
case GL_RENDERBUFFER_INTERNAL_FORMAT_OES:
{
GLint internalformat = renderbuffer->getFormat();
*params = (internalformat == GL_NONE) ? GL_RGBA4_OES : internalformat;
*params = (internalformat == GL_NONE_OES) ? GL_RGBA4_OES : internalformat;
}
break;
case GL_RENDERBUFFER_RED_SIZE_OES: *params = renderbuffer->getRedSize(); break;
......
......@@ -1589,7 +1589,7 @@ GLenum Context::getPixels(const GLvoid **data, GLenum type, GLsizei imageSize) c
*data = static_cast<const unsigned char*>(mState.pixelUnpackBuffer->data()) + (ptrdiff_t)(*data);
}
return GL_NONE;
return GL_NO_ERROR;
}
bool Context::getBuffer(GLenum target, es2::Buffer **buffer) const
......
......@@ -795,7 +795,7 @@ void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLs
}
GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -865,7 +865,7 @@ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yo
}
GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -875,7 +875,7 @@ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yo
es2::Texture2D *texture = context->getTexture2D(target);
GLenum validationError = ValidateSubImageParams(true, false, target, level, xoffset, yoffset, width, height, format, GL_NONE, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -887,7 +887,7 @@ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yo
es2::TextureCubeMap *texture = context->getTextureCubeMap();
GLenum validationError = ValidateSubImageParams(true, false, target, level, xoffset, yoffset, width, height, format, GL_NONE, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -1072,7 +1072,7 @@ void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
else UNREACHABLE(target);
GLenum validationError = ValidateSubImageParams(false, true, target, level, xoffset, yoffset, width, height, GL_NONE, GL_NONE, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -4958,7 +4958,7 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
}
GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -5002,7 +5002,7 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -5373,13 +5373,13 @@ void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLs
es2::Texture2D *texture = context->getTexture2D(target);
GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, width, height, format, type, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -5391,13 +5391,13 @@ void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLs
es2::TextureCubeMap *texture = context->getTextureCubeMap();
GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, width, height, format, type, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -6206,7 +6206,7 @@ void TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei wi
}
GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target, egl::getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -6239,7 +6239,7 @@ void TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei wi
}
GLenum validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -6281,13 +6281,13 @@ void TexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset,
es2::Texture3D *texture = context->getTexture3D();
GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -6336,7 +6336,7 @@ void CopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffs
es2::Texture3D *texture = context->getTexture3D();
GLenum validationError = ValidateSubImageParams(false, true, target, level, xoffset, yoffset, zoffset, width, height, 1, GL_NONE, GL_NONE, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -6393,7 +6393,7 @@ void CompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat,
GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -6449,7 +6449,7 @@ void CompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint
}
GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......
......@@ -369,7 +369,7 @@ GL_APICALL void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint inter
if(context)
{
GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -382,7 +382,7 @@ GL_APICALL void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint inter
}
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -419,19 +419,19 @@ GL_APICALL void GL_APIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xo
}
es2::Context *context = es2::getContext();
if(context)
{
es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -487,7 +487,7 @@ GL_APICALL void GL_APIENTRY glCopyTexSubImage3D(GLenum target, GLint level, GLin
es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
GLenum validationError = ValidateSubImageParams(false, true, target, level, xoffset, yoffset, zoffset, width, height, 1, GL_NONE, GL_NONE, texture, context->getClientVersion());
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -551,7 +551,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexImage3D(GLenum target, GLint level, G
}
GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......@@ -638,7 +638,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D(GLenum target, GLint level
}
GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return error(validationError);
}
......
......@@ -468,7 +468,7 @@ namespace es2
else if(!copy) // CopyTexSubImage doesn't have format/type parameters.
{
GLenum validationError = ValidateTextureFormatType(format, type, sizedInternalFormat, target, clientVersion);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return validationError;
}
......@@ -489,7 +489,7 @@ namespace es2
return GL_INVALID_VALUE;
}
return GL_NONE;
return GL_NO_ERROR;
}
GLenum ValidateSubImageParams(bool compressed, bool copy, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
......@@ -510,7 +510,7 @@ namespace es2
GLenum sizedInternalFormat = texture->getFormat(target, level);
GLenum validationError = ValidateTextureFormatType(format, type, sizedInternalFormat, target, clientVersion);
if(validationError != GL_NONE)
if(validationError != GL_NO_ERROR)
{
return validationError;
}
......@@ -533,7 +533,7 @@ namespace es2
return GL_INVALID_VALUE;
}
return GL_NONE;
return GL_NO_ERROR;
}
bool ValidateCopyFormats(GLenum textureFormat, GLenum colorbufferFormat)
......@@ -943,7 +943,7 @@ namespace es2
return GL_INVALID_ENUM;
}
return GL_NONE;
return GL_NO_ERROR;
}
// Validate format, type, and sized internalformat combinations [OpenGL ES 3.0 Table 3.2]
......@@ -1117,7 +1117,7 @@ namespace es2
return GL_INVALID_OPERATION;
}
return GL_NONE;
return GL_NO_ERROR;
}
GLsizei GetTypeSize(GLenum type)
......
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