Add object label in glBindTexture() error message

Bug: chromium:1288391
Change-Id: Ic1d1e96c33d5fde7659107735846dbf2c3ce9360
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3399244
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
Peng Huang 2022-01-19 11:11:20 -05:00 коммит произвёл Angle LUCI CQ
Родитель b536079817
Коммит e5c9b38596
4 изменённых файлов: 33 добавлений и 1 удалений

Просмотреть файл

@ -8,7 +8,10 @@
// rendering operations. It is the GLES2 specific implementation of EGLContext.
#include "libANGLE/Context.inl.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <iterator>
#include <sstream>
#include <vector>
@ -2771,6 +2774,28 @@ void Context::validationError(angle::EntryPoint entryPoint,
const_cast<Context *>(this)->mErrors.validationError(entryPoint, errorCode, message);
}
void Context::validationErrorF(angle::EntryPoint entryPoint,
GLenum errorCode,
const char *format,
...) const
{
va_list vargs;
va_start(vargs, format);
constexpr size_t kMessageSize = 256;
char message[kMessageSize];
int r = vsnprintf(message, kMessageSize, format, vargs);
va_end(vargs);
if (r > 0)
{
validationError(entryPoint, errorCode, message);
}
else
{
validationError(entryPoint, errorCode, format);
}
}
// Get one of the recorded errors and clear its flag, if any.
// [OpenGL ES 2.0.24] section 2.5 page 13.
GLenum Context::getError()

Просмотреть файл

@ -455,6 +455,10 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
unsigned int line);
void validationError(angle::EntryPoint entryPoint, GLenum errorCode, const char *message) const;
void validationErrorF(angle::EntryPoint entryPoint,
GLenum errorCode,
const char *format,
...) const;
void markContextLost(GraphicsResetStatus status);

Просмотреть файл

@ -521,6 +521,7 @@ MSG kTextureNotPow2 = "The texture is a non-power-of-two texture.";
MSG kTextureRectangleNotSupported = "Context does not support GL_ANGLE_texture_rectangle";
MSG kTextureSizeTooSmall = "Texture dimensions must all be greater than zero.";
MSG kTextureTargetMismatch = "Textarget must match the texture target type.";
MSG kTextureTargetMismatchWithLabel = "Textarget must match the texture target type. label: %s";
MSG kTextureTargetRequiresES31 = "Texture target requires at least OpenGL ES 3.1.";
MSG kTextureTypeConflict = "Two textures of different types use the same sampler location.";
MSG kTextureTypeMismatch = "Passed in texture type must match the one originally used to define the texture.";

Просмотреть файл

@ -158,7 +158,9 @@ ANGLE_INLINE bool ValidateBindTexture(const Context *context,
Texture *textureObject = context->getTexture(texture);
if (textureObject && textureObject->getType() != target)
{
context->validationError(entryPoint, GL_INVALID_OPERATION, err::kTextureTargetMismatch);
context->validationErrorF(entryPoint, GL_INVALID_OPERATION,
err::kTextureTargetMismatchWithLabel,
textureObject->getLabel().c_str());
return false;
}