Commit 2a19c59f by Geoff Lang Committed by Commit Bot

GL: Check for errors around GL calls.

Add a macro to check for GL errors after each GL call to catch errors as they happen even if the debug callbacks are unavailable. GL errors are only checked when asserts are enabled unless explicitly requested with the ANGLE_GL_TRY_ALWAYS_CHECK macro to verify GL calls that may allocate memory. Updated TextureGL to use the macro. BUG=angleproject:3020 Change-Id: I7678b204899e940824b010ab4be7e7f159bee6de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1764476Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 5c81d94f
......@@ -558,10 +558,10 @@ angle::Result BlitGL::copySubTexture(const gl::Context *context,
}
GLint swizzle[4] = {luminance, luminance, luminance, alpha};
source->setSwizzle(context, swizzle);
ANGLE_TRY(source->setSwizzle(context, swizzle));
}
source->setMinFilter(context, GL_NEAREST);
source->setMagFilter(context, GL_NEAREST);
ANGLE_TRY(source->setMinFilter(context, GL_NEAREST));
ANGLE_TRY(source->setMagFilter(context, GL_NEAREST));
ANGLE_TRY(source->setBaseLevel(context, static_cast<GLuint>(sourceLevel)));
// Render to the destination texture, sampling from the source texture
......
......@@ -169,7 +169,8 @@ angle::Result TextureGL::setImage(const gl::Context *context,
{
// The rows overlap in unpack memory. Upload the texture row by row to work around
// driver bug.
reserveTexImageToBeFilled(context, target, level, internalFormat, size, format, type);
ANGLE_TRY(
reserveTexImageToBeFilled(context, target, level, internalFormat, size, format, type));
if (size.width == 0 || size.height == 0 || size.depth == 0)
{
......@@ -192,7 +193,8 @@ angle::Result TextureGL::setImage(const gl::Context *context,
// by uploading the last row (and last level if 3D) separately.
if (apply)
{
reserveTexImageToBeFilled(context, target, level, internalFormat, size, format, type);
ANGLE_TRY(reserveTexImageToBeFilled(context, target, level, internalFormat, size,
format, type));
if (size.width == 0 || size.height == 0 || size.depth == 0)
{
......@@ -205,19 +207,19 @@ angle::Result TextureGL::setImage(const gl::Context *context,
}
}
setImageHelper(context, target, level, internalFormat, size, format, type, pixels);
ANGLE_TRY(setImageHelper(context, target, level, internalFormat, size, format, type, pixels));
return angle::Result::Continue;
}
void TextureGL::setImageHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const uint8_t *pixels)
angle::Result TextureGL::setImageHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const uint8_t *pixels)
{
ASSERT(TextureTargetToType(target) == getType());
......@@ -239,33 +241,39 @@ void TextureGL::setImageHelper(const gl::Context *context,
if (nativegl::UseTexImage2D(getType()))
{
ASSERT(size.depth == 1);
functions->texImage2D(ToGLenum(target), static_cast<GLint>(level),
texImageFormat.internalFormat, size.width, size.height, 0,
texImageFormat.format, texImageFormat.type, pixels);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texImage2D(ToGLenum(target), static_cast<GLint>(level),
texImageFormat.internalFormat, size.width, size.height,
0, texImageFormat.format, texImageFormat.type, pixels));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->texImage3D(ToGLenum(target), static_cast<GLint>(level),
texImageFormat.internalFormat, size.width, size.height, size.depth, 0,
texImageFormat.format, texImageFormat.type, pixels);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texImage3D(ToGLenum(target), static_cast<GLint>(level),
texImageFormat.internalFormat, size.width, size.height,
size.depth, 0, texImageFormat.format,
texImageFormat.type, pixels));
}
setLevelInfo(context, target, level, 1,
GetLevelInfo(internalFormat, texImageFormat.internalFormat));
return angle::Result::Continue;
}
void TextureGL::reserveTexImageToBeFilled(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type)
angle::Result TextureGL::reserveTexImageToBeFilled(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type)
{
StateManagerGL *stateManager = GetStateManagerGL(context);
stateManager->setPixelUnpackBuffer(nullptr);
setImageHelper(context, target, level, internalFormat, size, format, type, nullptr);
ANGLE_TRY(setImageHelper(context, target, level, internalFormat, size, format, type, nullptr));
return angle::Result::Continue;
}
angle::Result TextureGL::setSubImage(const gl::Context *context,
......@@ -321,16 +329,18 @@ angle::Result TextureGL::setSubImage(const gl::Context *context,
if (nativegl::UseTexImage2D(getType()))
{
ASSERT(area.z == 0 && area.depth == 1);
functions->texSubImage2D(ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.width, area.height, texSubImageFormat.format,
texSubImageFormat.type, pixels);
ANGLE_GL_TRY(context, functions->texSubImage2D(ToGLenum(target), static_cast<GLint>(level),
area.x, area.y, area.width, area.height,
texSubImageFormat.format,
texSubImageFormat.type, pixels));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.z, area.width, area.height, area.depth,
texSubImageFormat.format, texSubImageFormat.type, pixels);
ANGLE_GL_TRY(context, functions->texSubImage3D(
ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.z, area.width, area.height, area.depth,
texSubImageFormat.format, texSubImageFormat.type, pixels));
}
return angle::Result::Continue;
......@@ -378,9 +388,10 @@ angle::Result TextureGL::setSubImageRowByRowWorkaround(const gl::Context *contex
{
GLint byteOffset = imageByteOffset + row * rowBytes;
const GLubyte *rowPixels = pixelsWithSkip + byteOffset;
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x,
row + area.y, image + area.z, area.width, 1, 1, format,
type, rowPixels);
ANGLE_GL_TRY(context,
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level),
area.x, row + area.y, image + area.z,
area.width, 1, 1, format, type, rowPixels));
}
}
}
......@@ -391,8 +402,9 @@ angle::Result TextureGL::setSubImageRowByRowWorkaround(const gl::Context *contex
{
GLint byteOffset = row * rowBytes;
const GLubyte *rowPixels = pixelsWithSkip + byteOffset;
functions->texSubImage2D(ToGLenum(target), static_cast<GLint>(level), area.x,
row + area.y, area.width, 1, format, type, rowPixels);
ANGLE_GL_TRY(context, functions->texSubImage2D(
ToGLenum(target), static_cast<GLint>(level), area.x,
row + area.y, area.width, 1, format, type, rowPixels));
}
}
return angle::Result::Continue;
......@@ -435,9 +447,10 @@ angle::Result TextureGL::setSubImagePaddingWorkaround(const gl::Context *context
// Upload all but the last slice
if (area.depth > 1)
{
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.z, area.width, area.height, area.depth - 1, format, type,
pixels);
ANGLE_GL_TRY(context,
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level),
area.x, area.y, area.z, area.width, area.height,
area.depth - 1, format, type, pixels));
}
// Upload the last slice but its last row
......@@ -447,9 +460,10 @@ angle::Result TextureGL::setSubImagePaddingWorkaround(const gl::Context *context
// the driver
GLint lastImageOffset = (area.depth - 1) * imageBytes;
const GLubyte *lastImagePixels = pixels + lastImageOffset;
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.z + area.depth - 1, area.width, area.height - 1, 1,
format, type, lastImagePixels);
ANGLE_GL_TRY(context, functions->texSubImage3D(
ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.z + area.depth - 1, area.width, area.height - 1, 1,
format, type, lastImagePixels));
}
// Upload the last row of the last slice "manually"
......@@ -458,9 +472,10 @@ angle::Result TextureGL::setSubImagePaddingWorkaround(const gl::Context *context
GLint lastRowOffset =
skipBytes + (area.depth - 1) * imageBytes + (area.height - 1) * rowBytes;
const GLubyte *lastRowPixels = pixels + lastRowOffset;
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x,
area.y + area.height - 1, area.z + area.depth - 1, area.width, 1,
1, format, type, lastRowPixels);
ANGLE_GL_TRY(context,
functions->texSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x,
area.y + area.height - 1, area.z + area.depth - 1,
area.width, 1, 1, format, type, lastRowPixels));
}
else
{
......@@ -469,8 +484,9 @@ angle::Result TextureGL::setSubImagePaddingWorkaround(const gl::Context *context
// Upload all but the last row
if (area.height > 1)
{
functions->texSubImage2D(ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.width, area.height - 1, format, type, pixels);
ANGLE_GL_TRY(context, functions->texSubImage2D(
ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.width, area.height - 1, format, type, pixels));
}
// Upload the last row "manually"
......@@ -478,9 +494,9 @@ angle::Result TextureGL::setSubImagePaddingWorkaround(const gl::Context *context
GLint lastRowOffset = skipBytes + (area.height - 1) * rowBytes;
const GLubyte *lastRowPixels = pixels + lastRowOffset;
functions->texSubImage2D(ToGLenum(target), static_cast<GLint>(level), area.x,
area.y + area.height - 1, area.width, 1, format, type,
lastRowPixels);
ANGLE_GL_TRY(context, functions->texSubImage2D(ToGLenum(target), static_cast<GLint>(level),
area.x, area.y + area.height - 1, area.width,
1, format, type, lastRowPixels));
}
return angle::Result::Continue;
......@@ -509,16 +525,20 @@ angle::Result TextureGL::setCompressedImage(const gl::Context *context,
if (nativegl::UseTexImage2D(getType()))
{
ASSERT(size.depth == 1);
functions->compressedTexImage2D(ToGLenum(target), static_cast<GLint>(level),
compressedTexImageFormat.internalFormat, size.width,
size.height, 0, static_cast<GLsizei>(imageSize), pixels);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->compressedTexImage2D(ToGLenum(target), static_cast<GLint>(level),
compressedTexImageFormat.internalFormat,
size.width, size.height, 0,
static_cast<GLsizei>(imageSize), pixels));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->compressedTexImage3D(
ToGLenum(target), static_cast<GLint>(level), compressedTexImageFormat.internalFormat,
size.width, size.height, size.depth, 0, static_cast<GLsizei>(imageSize), pixels);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->compressedTexImage3D(ToGLenum(target), static_cast<GLint>(level),
compressedTexImageFormat.internalFormat,
size.width, size.height, size.depth, 0,
static_cast<GLsizei>(imageSize), pixels));
}
LevelInfoGL levelInfo = GetLevelInfo(internalFormat, compressedTexImageFormat.internalFormat);
......@@ -551,17 +571,19 @@ angle::Result TextureGL::setCompressedSubImage(const gl::Context *context,
if (nativegl::UseTexImage2D(getType()))
{
ASSERT(area.z == 0 && area.depth == 1);
functions->compressedTexSubImage2D(
ToGLenum(target), static_cast<GLint>(level), area.x, area.y, area.width, area.height,
compressedTexSubImageFormat.format, static_cast<GLsizei>(imageSize), pixels);
ANGLE_GL_TRY(context, functions->compressedTexSubImage2D(
ToGLenum(target), static_cast<GLint>(level), area.x, area.y,
area.width, area.height, compressedTexSubImageFormat.format,
static_cast<GLsizei>(imageSize), pixels));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->compressedTexSubImage3D(ToGLenum(target), static_cast<GLint>(level), area.x,
area.y, area.z, area.width, area.height, area.depth,
compressedTexSubImageFormat.format,
static_cast<GLsizei>(imageSize), pixels);
ANGLE_GL_TRY(context,
functions->compressedTexSubImage3D(
ToGLenum(target), static_cast<GLint>(level), area.x, area.y, area.z,
area.width, area.height, area.depth, compressedTexSubImageFormat.format,
static_cast<GLsizei>(imageSize), pixels));
}
ASSERT(!getLevelInfo(target, level).lumaWorkaround.enabled &&
......@@ -621,10 +643,12 @@ angle::Result TextureGL::copyImage(const gl::Context *context,
stateManager->setPixelUnpackState(unpack);
stateManager->setPixelUnpackBuffer(nullptr);
functions->texImage2D(
ToGLenum(target), static_cast<GLint>(level), copyTexImageFormat.internalFormat,
sourceArea.width, sourceArea.height, 0,
gl::GetUnsizedFormat(copyTexImageFormat.internalFormat), type, zero->data());
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texImage2D(ToGLenum(target), static_cast<GLint>(level),
copyTexImageFormat.internalFormat, sourceArea.width,
sourceArea.height, 0,
gl::GetUnsizedFormat(copyTexImageFormat.internalFormat),
type, zero->data()));
}
// Clip source area to framebuffer and copy if remaining area is not empty.
......@@ -679,15 +703,18 @@ angle::Result TextureGL::copyImage(const gl::Context *context,
sourceFramebufferGL->getFramebufferID());
if (requiresInitialization)
{
functions->copyTexSubImage2D(ToGLenum(target), static_cast<GLint>(level),
destOffset.x, destOffset.y, clippedArea.x,
clippedArea.y, clippedArea.width, clippedArea.height);
ANGLE_GL_TRY(context, functions->copyTexSubImage2D(
ToGLenum(target), static_cast<GLint>(level), destOffset.x,
destOffset.y, clippedArea.x, clippedArea.y,
clippedArea.width, clippedArea.height));
}
else
{
functions->copyTexImage2D(ToGLenum(target), static_cast<GLint>(level),
copyTexImageFormat.internalFormat, clippedArea.x,
clippedArea.y, clippedArea.width, clippedArea.height, 0);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->copyTexImage2D(ToGLenum(target), static_cast<GLint>(level),
copyTexImageFormat.internalFormat,
clippedArea.x, clippedArea.y,
clippedArea.width, clippedArea.height, 0));
}
}
setLevelInfo(context, target, level, 1, levelInfo);
......@@ -736,17 +763,18 @@ angle::Result TextureGL::copySubImage(const gl::Context *context,
if (nativegl::UseTexImage2D(getType()))
{
ASSERT(clippedOffset.z == 0);
functions->copyTexSubImage2D(ToGLenum(target), static_cast<GLint>(level),
clippedOffset.x, clippedOffset.y, clippedArea.x,
clippedArea.y, clippedArea.width, clippedArea.height);
ANGLE_GL_TRY(context, functions->copyTexSubImage2D(
ToGLenum(target), static_cast<GLint>(level), clippedOffset.x,
clippedOffset.y, clippedArea.x, clippedArea.y,
clippedArea.width, clippedArea.height));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->copyTexSubImage3D(ToGLenum(target), static_cast<GLint>(level),
clippedOffset.x, clippedOffset.y, clippedOffset.z,
clippedArea.x, clippedArea.y, clippedArea.width,
clippedArea.height);
ANGLE_GL_TRY(context, functions->copyTexSubImage3D(
ToGLenum(target), static_cast<GLint>(level), clippedOffset.x,
clippedOffset.y, clippedOffset.z, clippedArea.x,
clippedArea.y, clippedArea.width, clippedArea.height));
}
}
......@@ -770,8 +798,9 @@ angle::Result TextureGL::copyTexture(const gl::Context *context,
sourceGL->mState.getImageDesc(NonCubeTextureTypeToTarget(source->getType()), sourceLevel);
gl::Rectangle sourceArea(0, 0, sourceImageDesc.size.width, sourceImageDesc.size.height);
reserveTexImageToBeFilled(context, target, level, internalFormat, sourceImageDesc.size,
gl::GetUnsizedFormat(internalFormat), type);
ANGLE_TRY(reserveTexImageToBeFilled(context, target, level, internalFormat,
sourceImageDesc.size, gl::GetUnsizedFormat(internalFormat),
type));
const gl::InternalFormat &destFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
return copySubTextureHelper(context, target, level, gl::Offset(0, 0, 0), sourceLevel,
......@@ -895,8 +924,10 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
ASSERT(size.depth == 1);
if (functions->texStorage2D)
{
functions->texStorage2D(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->texStorage2D(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height));
}
else
{
......@@ -926,10 +957,12 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
ANGLE_CHECK_GL_MATH(
contextGL,
internalFormatInfo.computeCompressedImageSize(levelSize, &dataSize));
functions->compressedTexImage2D(ToGLenum(type), static_cast<GLint>(level),
compressedTexImageFormat.format,
levelSize.width, levelSize.height, 0,
static_cast<GLsizei>(dataSize), nullptr);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->compressedTexImage2D(
ToGLenum(type), static_cast<GLint>(level),
compressedTexImageFormat.format, levelSize.width, levelSize.height,
0, static_cast<GLsizei>(dataSize), nullptr));
}
else
{
......@@ -937,10 +970,12 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
functions, features, internalFormat, internalFormatInfo.format,
internalFormatInfo.type);
functions->texImage2D(ToGLenum(type), static_cast<GLint>(level),
texImageFormat.internalFormat, levelSize.width,
levelSize.height, 0, texImageFormat.format,
texImageFormat.type, nullptr);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->texImage2D(ToGLenum(type), static_cast<GLint>(level),
texImageFormat.internalFormat, levelSize.width,
levelSize.height, 0, texImageFormat.format,
texImageFormat.type, nullptr));
}
}
else
......@@ -958,10 +993,12 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
ANGLE_CHECK_GL_MATH(contextGL,
internalFormatInfo.computeCompressedImageSize(
levelSize, &dataSize));
functions->compressedTexImage2D(
ToGLenum(face), static_cast<GLint>(level),
compressedTexImageFormat.format, levelSize.width, levelSize.height,
0, static_cast<GLsizei>(dataSize), nullptr);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->compressedTexImage2D(
ToGLenum(face), static_cast<GLint>(level),
compressedTexImageFormat.format, levelSize.width,
levelSize.height, 0, static_cast<GLsizei>(dataSize), nullptr));
}
else
{
......@@ -969,10 +1006,12 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
functions, features, internalFormat, internalFormatInfo.format,
internalFormatInfo.type);
functions->texImage2D(ToGLenum(face), static_cast<GLint>(level),
texImageFormat.internalFormat, levelSize.width,
levelSize.height, 0, texImageFormat.format,
texImageFormat.type, nullptr);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texImage2D(
ToGLenum(face), static_cast<GLint>(level),
texImageFormat.internalFormat, levelSize.width,
levelSize.height, 0, texImageFormat.format,
texImageFormat.type, nullptr));
}
}
}
......@@ -984,9 +1023,10 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
ASSERT(nativegl::UseTexImage3D(getType()));
if (functions->texStorage3D)
{
functions->texStorage3D(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height,
size.depth);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texStorage3D(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width,
size.height, size.depth));
}
else
{
......@@ -1014,10 +1054,11 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
GLuint dataSize = 0;
ANGLE_CHECK_GL_MATH(contextGL, internalFormatInfo.computeCompressedImageSize(
levelSize, &dataSize));
functions->compressedTexImage3D(
ToGLenum(type), i, compressedTexImageFormat.format, levelSize.width,
levelSize.height, levelSize.depth, 0, static_cast<GLsizei>(dataSize),
nullptr);
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->compressedTexImage3D(
ToGLenum(type), i, compressedTexImageFormat.format,
levelSize.width, levelSize.height, levelSize.depth, 0,
static_cast<GLsizei>(dataSize), nullptr));
}
else
{
......@@ -1025,9 +1066,11 @@ angle::Result TextureGL::setStorage(const gl::Context *context,
functions, features, internalFormat, internalFormatInfo.format,
internalFormatInfo.type);
functions->texImage3D(ToGLenum(type), i, texImageFormat.internalFormat,
levelSize.width, levelSize.height, levelSize.depth, 0,
texImageFormat.format, texImageFormat.type, nullptr);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->texImage3D(ToGLenum(type), i, texImageFormat.internalFormat,
levelSize.width, levelSize.height, levelSize.depth, 0,
texImageFormat.format, texImageFormat.type, nullptr));
}
}
}
......@@ -1080,26 +1123,29 @@ angle::Result TextureGL::setStorageMultisample(const gl::Context *context,
ASSERT(size.depth == 1);
if (functions->texStorage2DMultisample)
{
functions->texStorage2DMultisample(
ToGLenum(type), samples, texStorageFormat.internalFormat, size.width, size.height,
gl::ConvertToGLBoolean(fixedSampleLocations));
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texStorage2DMultisample(
ToGLenum(type), samples, texStorageFormat.internalFormat, size.width,
size.height, gl::ConvertToGLBoolean(fixedSampleLocations)));
}
else
{
// texImage2DMultisample is similar to texStorage2DMultisample of es 3.1 core feature,
// On macos and some old drivers which doesn't support OpenGL ES 3.1, the function can
// be supported by ARB_texture_multisample or OpenGL 3.2 core feature.
functions->texImage2DMultisample(
ToGLenum(type), samples, texStorageFormat.internalFormat, size.width, size.height,
gl::ConvertToGLBoolean(fixedSampleLocations));
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texImage2DMultisample(
ToGLenum(type), samples, texStorageFormat.internalFormat, size.width,
size.height, gl::ConvertToGLBoolean(fixedSampleLocations)));
}
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->texStorage3DMultisample(ToGLenum(type), samples, texStorageFormat.internalFormat,
size.width, size.height, size.depth,
gl::ConvertToGLBoolean(fixedSampleLocations));
ANGLE_GL_TRY_ALWAYS_CHECK(
context, functions->texStorage3DMultisample(
ToGLenum(type), samples, texStorageFormat.internalFormat, size.width,
size.height, size.depth, gl::ConvertToGLBoolean(fixedSampleLocations)));
}
setLevelInfo(context, type, 0, 1,
......@@ -1128,16 +1174,20 @@ angle::Result TextureGL::setStorageExternalMemory(const gl::Context *context,
stateManager->bindTexture(getType(), mTextureID);
if (nativegl::UseTexImage2D(getType()))
{
functions->texStorageMem2DEXT(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height,
memoryObjectGL->getMemoryObjectID(), offset);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->texStorageMem2DEXT(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height,
memoryObjectGL->getMemoryObjectID(), offset));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->texStorageMem3DEXT(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height,
size.depth, memoryObjectGL->getMemoryObjectID(), offset);
ANGLE_GL_TRY_ALWAYS_CHECK(
context,
functions->texStorageMem3DEXT(ToGLenum(type), static_cast<GLsizei>(levels),
texStorageFormat.internalFormat, size.width, size.height,
size.depth, memoryObjectGL->getMemoryObjectID(), offset));
}
setLevelInfo(context, type, 0, levels,
......@@ -1161,7 +1211,7 @@ angle::Result TextureGL::generateMipmap(const gl::Context *context)
StateManagerGL *stateManager = GetStateManagerGL(context);
stateManager->bindTexture(getType(), mTextureID);
functions->generateMipmap(ToGLenum(getType()));
ANGLE_GL_TRY_ALWAYS_CHECK(context, functions->generateMipmap(ToGLenum(getType())));
const GLuint effectiveBaseLevel = mState.getEffectiveBaseLevel();
const GLuint maxLevel = mState.getMipmapMaxLevel();
......@@ -1203,8 +1253,8 @@ angle::Result TextureGL::releaseTexImage(const gl::Context *context)
stateManager->bindTexture(getType(), mTextureID);
ASSERT(nativegl::UseTexImage2D(getType()));
functions->texImage2D(ToGLenum(getType()), 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE,
nullptr);
ANGLE_GL_TRY(context, functions->texImage2D(ToGLenum(getType()), 0, GL_RGBA, 0, 0, 0,
GL_RGBA, GL_UNSIGNED_BYTE, nullptr));
}
return angle::Result::Continue;
......@@ -1256,58 +1306,69 @@ angle::Result TextureGL::syncState(const gl::Context *context,
{
case gl::Texture::DIRTY_BIT_MIN_FILTER:
mAppliedSampler.setMinFilter(mState.getSamplerState().getMinFilter());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MIN_FILTER,
mAppliedSampler.getMinFilter());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MIN_FILTER,
mAppliedSampler.getMinFilter()));
break;
case gl::Texture::DIRTY_BIT_MAG_FILTER:
mAppliedSampler.setMagFilter(mState.getSamplerState().getMagFilter());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAG_FILTER,
mAppliedSampler.getMagFilter());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAG_FILTER,
mAppliedSampler.getMagFilter()));
break;
case gl::Texture::DIRTY_BIT_WRAP_S:
mAppliedSampler.setWrapS(mState.getSamplerState().getWrapS());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_WRAP_S,
mAppliedSampler.getWrapS());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_WRAP_S,
mAppliedSampler.getWrapS()));
break;
case gl::Texture::DIRTY_BIT_WRAP_T:
mAppliedSampler.setWrapT(mState.getSamplerState().getWrapT());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_WRAP_T,
mAppliedSampler.getWrapT());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_WRAP_T,
mAppliedSampler.getWrapT()));
break;
case gl::Texture::DIRTY_BIT_WRAP_R:
mAppliedSampler.setWrapR(mState.getSamplerState().getWrapR());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_WRAP_R,
mAppliedSampler.getWrapR());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_WRAP_R,
mAppliedSampler.getWrapR()));
break;
case gl::Texture::DIRTY_BIT_MAX_ANISOTROPY:
mAppliedSampler.setMaxAnisotropy(mState.getSamplerState().getMaxAnisotropy());
functions->texParameterf(ToGLenum(getType()), GL_TEXTURE_MAX_ANISOTROPY_EXT,
mAppliedSampler.getMaxAnisotropy());
ANGLE_GL_TRY(context, functions->texParameterf(ToGLenum(getType()),
GL_TEXTURE_MAX_ANISOTROPY_EXT,
mAppliedSampler.getMaxAnisotropy()));
break;
case gl::Texture::DIRTY_BIT_MIN_LOD:
mAppliedSampler.setMinLod(mState.getSamplerState().getMinLod());
functions->texParameterf(ToGLenum(getType()), GL_TEXTURE_MIN_LOD,
mAppliedSampler.getMinLod());
ANGLE_GL_TRY(context,
functions->texParameterf(ToGLenum(getType()), GL_TEXTURE_MIN_LOD,
mAppliedSampler.getMinLod()));
break;
case gl::Texture::DIRTY_BIT_MAX_LOD:
mAppliedSampler.setMaxLod(mState.getSamplerState().getMaxLod());
functions->texParameterf(ToGLenum(getType()), GL_TEXTURE_MAX_LOD,
mAppliedSampler.getMaxLod());
ANGLE_GL_TRY(context,
functions->texParameterf(ToGLenum(getType()), GL_TEXTURE_MAX_LOD,
mAppliedSampler.getMaxLod()));
break;
case gl::Texture::DIRTY_BIT_COMPARE_MODE:
mAppliedSampler.setCompareMode(mState.getSamplerState().getCompareMode());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_COMPARE_MODE,
mAppliedSampler.getCompareMode());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_COMPARE_MODE,
mAppliedSampler.getCompareMode()));
break;
case gl::Texture::DIRTY_BIT_COMPARE_FUNC:
mAppliedSampler.setCompareFunc(mState.getSamplerState().getCompareFunc());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_COMPARE_FUNC,
mAppliedSampler.getCompareFunc());
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_COMPARE_FUNC,
mAppliedSampler.getCompareFunc()));
break;
case gl::Texture::DIRTY_BIT_SRGB_DECODE:
mAppliedSampler.setSRGBDecode(mState.getSamplerState().getSRGBDecode());
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_SRGB_DECODE_EXT,
mAppliedSampler.getSRGBDecode());
ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
GL_TEXTURE_SRGB_DECODE_EXT,
mAppliedSampler.getSRGBDecode()));
break;
case gl::Texture::DIRTY_BIT_BORDER_COLOR:
{
......@@ -1316,16 +1377,19 @@ angle::Result TextureGL::syncState(const gl::Context *context,
switch (borderColor.type)
{
case angle::ColorGeneric::Type::Float:
functions->texParameterfv(ToGLenum(getType()), GL_TEXTURE_BORDER_COLOR,
&borderColor.colorF.red);
ANGLE_GL_TRY(context, functions->texParameterfv(ToGLenum(getType()),
GL_TEXTURE_BORDER_COLOR,
&borderColor.colorF.red));
break;
case angle::ColorGeneric::Type::Int:
functions->texParameterIiv(ToGLenum(getType()), GL_TEXTURE_BORDER_COLOR,
&borderColor.colorI.red);
ANGLE_GL_TRY(context, functions->texParameterIiv(ToGLenum(getType()),
GL_TEXTURE_BORDER_COLOR,
&borderColor.colorI.red));
break;
case angle::ColorGeneric::Type::UInt:
functions->texParameterIuiv(ToGLenum(getType()), GL_TEXTURE_BORDER_COLOR,
&borderColor.colorUI.red);
ANGLE_GL_TRY(context, functions->texParameterIuiv(
ToGLenum(getType()), GL_TEXTURE_BORDER_COLOR,
&borderColor.colorUI.red));
break;
default:
UNREACHABLE();
......@@ -1336,40 +1400,43 @@ angle::Result TextureGL::syncState(const gl::Context *context,
// Texture state
case gl::Texture::DIRTY_BIT_SWIZZLE_RED:
syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_R,
mState.getSwizzleState().swizzleRed,
&mAppliedSwizzle.swizzleRed);
ANGLE_TRY(syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_R,
mState.getSwizzleState().swizzleRed,
&mAppliedSwizzle.swizzleRed));
break;
case gl::Texture::DIRTY_BIT_SWIZZLE_GREEN:
syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_G,
mState.getSwizzleState().swizzleGreen,
&mAppliedSwizzle.swizzleGreen);
ANGLE_TRY(syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_G,
mState.getSwizzleState().swizzleGreen,
&mAppliedSwizzle.swizzleGreen));
break;
case gl::Texture::DIRTY_BIT_SWIZZLE_BLUE:
syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_B,
mState.getSwizzleState().swizzleBlue,
&mAppliedSwizzle.swizzleBlue);
ANGLE_TRY(syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_B,
mState.getSwizzleState().swizzleBlue,
&mAppliedSwizzle.swizzleBlue));
break;
case gl::Texture::DIRTY_BIT_SWIZZLE_ALPHA:
syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_A,
mState.getSwizzleState().swizzleAlpha,
&mAppliedSwizzle.swizzleAlpha);
ANGLE_TRY(syncTextureStateSwizzle(context, functions, GL_TEXTURE_SWIZZLE_A,
mState.getSwizzleState().swizzleAlpha,
&mAppliedSwizzle.swizzleAlpha));
break;
case gl::Texture::DIRTY_BIT_BASE_LEVEL:
mAppliedBaseLevel = mState.getEffectiveBaseLevel();
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_BASE_LEVEL,
mAppliedBaseLevel);
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_BASE_LEVEL,
mAppliedBaseLevel));
break;
case gl::Texture::DIRTY_BIT_MAX_LEVEL:
mAppliedMaxLevel = mState.getEffectiveMaxLevel();
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAX_LEVEL,
mAppliedMaxLevel);
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAX_LEVEL,
mAppliedMaxLevel));
break;
case gl::Texture::DIRTY_BIT_DEPTH_STENCIL_TEXTURE_MODE:
{
GLenum mDepthStencilTextureMode = mState.getDepthStencilTextureMode();
functions->texParameteri(ToGLenum(getType()), GL_DEPTH_STENCIL_TEXTURE_MODE,
mDepthStencilTextureMode);
ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
GL_DEPTH_STENCIL_TEXTURE_MODE,
mDepthStencilTextureMode));
break;
}
case gl::Texture::DIRTY_BIT_USAGE:
......@@ -1410,7 +1477,8 @@ angle::Result TextureGL::setBaseLevel(const gl::Context *context, GLuint baseLev
onStateChange(angle::SubjectMessage::SubjectChanged);
stateManager->bindTexture(getType(), mTextureID);
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_BASE_LEVEL, baseLevel);
ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_BASE_LEVEL,
baseLevel));
}
return angle::Result::Continue;
}
......@@ -1429,12 +1497,13 @@ angle::Result TextureGL::setMaxLevel(const gl::Context *context, GLuint maxLevel
onStateChange(angle::SubjectMessage::SubjectChanged);
stateManager->bindTexture(getType(), mTextureID);
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAX_LEVEL, maxLevel);
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAX_LEVEL, maxLevel));
}
return angle::Result::Continue;
}
void TextureGL::setMinFilter(const gl::Context *context, GLenum filter)
angle::Result TextureGL::setMinFilter(const gl::Context *context, GLenum filter)
{
if (filter != mAppliedSampler.getMinFilter())
{
......@@ -1448,10 +1517,12 @@ void TextureGL::setMinFilter(const gl::Context *context, GLenum filter)
onStateChange(angle::SubjectMessage::SubjectChanged);
stateManager->bindTexture(getType(), mTextureID);
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MIN_FILTER, filter);
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MIN_FILTER, filter));
}
return angle::Result::Continue;
}
void TextureGL::setMagFilter(const gl::Context *context, GLenum filter)
angle::Result TextureGL::setMagFilter(const gl::Context *context, GLenum filter)
{
if (filter != mAppliedSampler.getMagFilter())
{
......@@ -1465,11 +1536,13 @@ void TextureGL::setMagFilter(const gl::Context *context, GLenum filter)
onStateChange(angle::SubjectMessage::SubjectChanged);
stateManager->bindTexture(getType(), mTextureID);
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAG_FILTER, filter);
ANGLE_GL_TRY(context,
functions->texParameteri(ToGLenum(getType()), GL_TEXTURE_MAG_FILTER, filter));
}
return angle::Result::Continue;
}
void TextureGL::setSwizzle(const gl::Context *context, GLint swizzle[4])
angle::Result TextureGL::setSwizzle(const gl::Context *context, GLint swizzle[4])
{
gl::SwizzleState resultingSwizzle =
gl::SwizzleState(swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
......@@ -1489,8 +1562,10 @@ void TextureGL::setSwizzle(const gl::Context *context, GLint swizzle[4])
onStateChange(angle::SubjectMessage::SubjectChanged);
stateManager->bindTexture(getType(), mTextureID);
functions->texParameteriv(ToGLenum(getType()), GL_TEXTURE_SWIZZLE_RGBA, swizzle);
ANGLE_GL_TRY(context, functions->texParameteriv(ToGLenum(getType()),
GL_TEXTURE_SWIZZLE_RGBA, swizzle));
}
return angle::Result::Continue;
}
GLenum TextureGL::getNativeInternalFormat(const gl::ImageIndex &index) const
......@@ -1504,11 +1579,11 @@ bool TextureGL::hasEmulatedAlphaChannel(const gl::ImageIndex &index) const
.emulatedAlphaChannel;
}
void TextureGL::syncTextureStateSwizzle(const gl::Context *context,
const FunctionsGL *functions,
GLenum name,
GLenum value,
GLenum *outValue)
angle::Result TextureGL::syncTextureStateSwizzle(const gl::Context *context,
const FunctionsGL *functions,
GLenum name,
GLenum value,
GLenum *outValue)
{
const LevelInfoGL &levelInfo = getBaseLevelInfo();
GLenum resultSwizzle = value;
......@@ -1620,7 +1695,9 @@ void TextureGL::syncTextureStateSwizzle(const gl::Context *context,
}
*outValue = resultSwizzle;
functions->texParameteri(ToGLenum(getType()), name, resultSwizzle);
ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()), name, resultSwizzle));
return angle::Result::Continue;
}
void TextureGL::setLevelInfo(const gl::Context *context,
......@@ -1748,17 +1825,18 @@ angle::Result TextureGL::initializeContents(const gl::Context *context,
// not result in zero color data.
if (nativegl::UseTexImage2D(getType()))
{
functions->compressedTexSubImage2D(
ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(), 0, 0, desc.size.width,
desc.size.height, nativeSubImageFormat.format, imageSize, zero->data());
ANGLE_GL_TRY(context, functions->compressedTexSubImage2D(
ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(),
0, 0, desc.size.width, desc.size.height,
nativeSubImageFormat.format, imageSize, zero->data()));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->compressedTexSubImage3D(
ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(), 0, 0, 0,
desc.size.width, desc.size.height, desc.size.depth, nativeSubImageFormat.format,
imageSize, zero->data());
ANGLE_GL_TRY(context, functions->compressedTexSubImage3D(
ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(),
0, 0, 0, desc.size.width, desc.size.height, desc.size.depth,
nativeSubImageFormat.format, imageSize, zero->data()));
}
}
else
......@@ -1776,18 +1854,20 @@ angle::Result TextureGL::initializeContents(const gl::Context *context,
if (nativegl::UseTexImage2D(getType()))
{
functions->texSubImage2D(ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(),
0, 0, desc.size.width, desc.size.height,
nativeSubImageFormat.format, nativeSubImageFormat.type,
zero->data());
ANGLE_GL_TRY(context,
functions->texSubImage2D(ToGLenum(imageIndex.getTarget()),
imageIndex.getLevelIndex(), 0, 0, desc.size.width,
desc.size.height, nativeSubImageFormat.format,
nativeSubImageFormat.type, zero->data()));
}
else
{
ASSERT(nativegl::UseTexImage3D(getType()));
functions->texSubImage3D(ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(),
0, 0, 0, desc.size.width, desc.size.height, desc.size.depth,
nativeSubImageFormat.format, nativeSubImageFormat.type,
zero->data());
ANGLE_GL_TRY(context,
functions->texSubImage3D(
ToGLenum(imageIndex.getTarget()), imageIndex.getLevelIndex(), 0, 0, 0,
desc.size.width, desc.size.height, desc.size.depth,
nativeSubImageFormat.format, nativeSubImageFormat.type, zero->data()));
}
}
......
......@@ -198,31 +198,31 @@ class TextureGL : public TextureImpl
angle::Result initializeContents(const gl::Context *context,
const gl::ImageIndex &imageIndex) override;
void setMinFilter(const gl::Context *context, GLenum filter);
void setMagFilter(const gl::Context *context, GLenum filter);
angle::Result setMinFilter(const gl::Context *context, GLenum filter);
angle::Result setMagFilter(const gl::Context *context, GLenum filter);
void setSwizzle(const gl::Context *context, GLint swizzle[4]);
angle::Result setSwizzle(const gl::Context *context, GLint swizzle[4]);
GLenum getNativeInternalFormat(const gl::ImageIndex &index) const;
bool hasEmulatedAlphaChannel(const gl::ImageIndex &index) const;
private:
void setImageHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const uint8_t *pixels);
angle::Result setImageHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const uint8_t *pixels);
// This changes the current pixel unpack state that will have to be reapplied.
void reserveTexImageToBeFilled(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type);
angle::Result reserveTexImageToBeFilled(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type);
angle::Result setSubImageRowByRowWorkaround(const gl::Context *context,
gl::TextureTarget target,
size_t level,
......@@ -243,11 +243,11 @@ class TextureGL : public TextureImpl
const gl::Buffer *unpackBuffer,
const uint8_t *pixels);
void syncTextureStateSwizzle(const gl::Context *context,
const FunctionsGL *functions,
GLenum name,
GLenum value,
GLenum *outValue);
angle::Result syncTextureStateSwizzle(const gl::Context *context,
const FunctionsGL *functions,
GLenum name,
GLenum value,
GLenum *outValue);
void setLevelInfo(const gl::Context *context,
gl::TextureTarget target,
......
......@@ -1693,6 +1693,52 @@ const angle::FeaturesGL &GetFeaturesGL(const gl::Context *context)
return GetImplAs<ContextGL>(context)->getFeaturesGL();
}
void ClearErrors(const gl::Context *context,
const char *file,
const char *function,
unsigned int line)
{
const FunctionsGL *functions = GetFunctionsGL(context);
GLenum error = functions->getError();
while (error != GL_NO_ERROR)
{
ERR() << "Preexisting GL error " << gl::FmtHex(error) << " as of " << file << ", "
<< function << ":" << line << ". ";
error = functions->getError();
}
}
angle::Result CheckError(const gl::Context *context,
const char *call,
const char *file,
const char *function,
unsigned int line)
{
const FunctionsGL *functions = GetFunctionsGL(context);
GLenum error = functions->getError();
if (ANGLE_UNLIKELY(error != GL_NO_ERROR))
{
ContextGL *contextGL = GetImplAs<ContextGL>(context);
contextGL->handleError(error, "Unexpected driver error.", file, function, line);
ERR() << "GL call " << call << " generated error " << gl::FmtHex(error) << " in " << file
<< ", " << function << ":" << line << ". ";
// Check that only one GL error was generated, ClearErrors should have been called first
GLenum nextError = functions->getError();
while (nextError != GL_NO_ERROR)
{
ERR() << "Additional GL error " << gl::FmtHex(nextError) << " generated.";
nextError = functions->getError();
}
return angle::Result::Stop;
}
return angle::Result::Continue;
}
bool CanMapBufferForRead(const FunctionsGL *functions)
{
return (functions->mapBufferRange != nullptr) ||
......
......@@ -10,6 +10,7 @@
#ifndef LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_
#define LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_
#include "common/debug.h"
#include "libANGLE/Error.h"
#include "libANGLE/Version.h"
#include "libANGLE/angletypes.h"
......@@ -55,6 +56,29 @@ BlitGL *GetBlitGL(const gl::Context *context);
ClearMultiviewGL *GetMultiviewClearer(const gl::Context *context);
const angle::FeaturesGL &GetFeaturesGL(const gl::Context *context);
// Clear all errors on the stored context, emits console warnings
void ClearErrors(const gl::Context *context,
const char *file,
const char *function,
unsigned int line);
// Check for a single error
angle::Result CheckError(const gl::Context *context,
const char *call,
const char *file,
const char *function,
unsigned int line);
#define ANGLE_GL_TRY_ALWAYS_CHECK(context, call) \
(ClearErrors(context, __FILE__, __FUNCTION__, __LINE__), (call)); \
ANGLE_TRY(CheckError(context, #call, __FILE__, __FUNCTION__, __LINE__))
#if defined(ANGLE_ENABLE_ASSERTS)
# define ANGLE_GL_TRY(context, call) ANGLE_GL_TRY_ALWAYS_CHECK(context, call)
#else
# define ANGLE_GL_TRY(context, call) call
#endif
namespace nativegl_gl
{
......
......@@ -262,6 +262,9 @@ TEST_P(FramebufferMultiviewTest, CopyTex)
{
ANGLE_SKIP_TEST_IF(!requestMultiviewExtension());
// glCopyTexImage2D generates GL_INVALID_FRAMEBUFFER_OPERATION. http://anglebug.com/3857
ANGLE_SKIP_TEST_IF(IsWindows() && IsOpenGL());
GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
......
......@@ -173,6 +173,9 @@ TEST_P(StateChangeTest, FramebufferIncompleteWithTexStorage)
// Test that caching works when color attachments change with CompressedTexImage2D.
TEST_P(StateChangeTestES3, FramebufferIncompleteWithCompressedTex)
{
// ETC texture formats are not supported on Mac OpenGL. http://anglebug.com/3853
ANGLE_SKIP_TEST_IF(IsOSX() && IsDesktopOpenGL());
glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
......
......@@ -2983,11 +2983,8 @@ TEST_P(Texture2DTestES3, TextureRGB9E5ImplicitAlpha1)
// ES 3.0.4 table 3.24
TEST_P(Texture2DTestES3, TextureCOMPRESSEDRGB8ETC2ImplicitAlpha1)
{
// Seems to fail on OSX 10.12 Intel.
ANGLE_SKIP_TEST_IF(IsOSX() && IsIntel() && IsOpenGL());
// http://anglebug.com/2190
ANGLE_SKIP_TEST_IF(IsOSX() && IsNVIDIA() && IsDesktopOpenGL());
// ETC texture formats are not supported on Mac OpenGL. http://anglebug.com/3853
ANGLE_SKIP_TEST_IF(IsOSX() && IsDesktopOpenGL());
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
......@@ -3003,11 +3000,8 @@ TEST_P(Texture2DTestES3, TextureCOMPRESSEDRGB8ETC2ImplicitAlpha1)
// ES 3.0.4 table 3.24
TEST_P(Texture2DTestES3, TextureCOMPRESSEDSRGB8ETC2ImplicitAlpha1)
{
// Seems to fail on OSX 10.12 Intel.
ANGLE_SKIP_TEST_IF(IsOSX() && IsIntel() && IsOpenGL());
// http://anglebug.com/2190
ANGLE_SKIP_TEST_IF(IsOSX() && IsNVIDIA() && IsDesktopOpenGL());
// ETC texture formats are not supported on Mac OpenGL. http://anglebug.com/3853
ANGLE_SKIP_TEST_IF(IsOSX() && IsDesktopOpenGL());
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
......
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