Commit c4832968 by Tim Van Patten Committed by Commit Bot

Check noopDraw() before prepareForDraw()

To support drawing without a Program or PPO bound, ANGLE needs to check noopDraw() as early as possible to prevent accessing null pointers while attempting to draw. Bug: chromium:1079312 Test: gpu_swangle_passthrough_fuzzer Change-Id: I85d6cab923ce42d93fa93e1792f342ce3c5baa8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197946Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
parent 9a78f6cf
...@@ -5794,14 +5794,14 @@ void Context::drawArraysInstancedBaseInstance(PrimitiveMode mode, ...@@ -5794,14 +5794,14 @@ void Context::drawArraysInstancedBaseInstance(PrimitiveMode mode,
GLsizei instanceCount, GLsizei instanceCount,
GLuint baseInstance) GLuint baseInstance)
{ {
ANGLE_CONTEXT_TRY(prepareForDraw(mode));
Program *programObject = mState.getLinkedProgram(this);
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
return; return;
} }
ANGLE_CONTEXT_TRY(prepareForDraw(mode));
Program *programObject = mState.getLinkedProgram(this);
const bool hasBaseInstance = programObject && programObject->hasBaseInstanceUniform(); const bool hasBaseInstance = programObject && programObject->hasBaseInstanceUniform();
if (hasBaseInstance) if (hasBaseInstance)
{ {
...@@ -5826,14 +5826,14 @@ void Context::drawElementsInstancedBaseVertexBaseInstance(PrimitiveMode mode, ...@@ -5826,14 +5826,14 @@ void Context::drawElementsInstancedBaseVertexBaseInstance(PrimitiveMode mode,
GLint baseVertex, GLint baseVertex,
GLuint baseInstance) GLuint baseInstance)
{ {
ANGLE_CONTEXT_TRY(prepareForDraw(mode));
Program *programObject = mState.getLinkedProgram(this);
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
return; return;
} }
ANGLE_CONTEXT_TRY(prepareForDraw(mode));
Program *programObject = mState.getLinkedProgram(this);
const bool hasBaseVertex = programObject && programObject->hasBaseVertexUniform(); const bool hasBaseVertex = programObject && programObject->hasBaseVertexUniform();
if (hasBaseVertex) if (hasBaseVertex)
{ {
......
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