Commit 8f57f60f by Cody Northrop Committed by Commit Bot

Add ES 3.1 check to ValidateBindImageTexture

This fixes a crash that occured in the Lego trace when run with an ES 3.0 context. * At the end of each frame it unbinds all the image units using glBindImageTexture, which is an ES 3.1 call. * During validation, we verify things using ANGLE's internals, but they are only set up when the context is >= ES 3.1. * This led to a crash. * The fix is to check the ES context early and bail, which aligns with other entry points. Test: LEGO MEC Bug: b/161716126 Bug: angleproject:4048 Change-Id: I9aee2ee173436f5de5062758a70e0909f6fc9a7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462163Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
parent babce049
...@@ -3390,6 +3390,8 @@ void State::setImageUnit(const Context *context, ...@@ -3390,6 +3390,8 @@ void State::setImageUnit(const Context *context,
GLenum access, GLenum access,
GLenum format) GLenum format)
{ {
ASSERT(!mImageUnits.empty());
ImageUnit &imageUnit = mImageUnits[unit]; ImageUnit &imageUnit = mImageUnits[unit];
if (texture) if (texture)
......
...@@ -1448,6 +1448,12 @@ bool ValidateBindImageTexture(const Context *context, ...@@ -1448,6 +1448,12 @@ bool ValidateBindImageTexture(const Context *context,
GLenum access, GLenum access,
GLenum format) GLenum format)
{ {
if (context->getClientVersion() < ES_3_1)
{
context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
GLuint maxImageUnits = static_cast<GLuint>(context->getCaps().maxImageUnits); GLuint maxImageUnits = static_cast<GLuint>(context->getCaps().maxImageUnits);
if (unit >= maxImageUnits) if (unit >= maxImageUnits)
{ {
......
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