Commit 85c86567 by Tim Van Patten Committed by Commit Bot

Handle null ProgramExecutable in ValidateDrawInstancedANGLE()

It's possible for a user to call glDrawArraysInstancedANGLE() without a Program or PPO bound, which would lead to no ProgramExecutable being active and causes a null pointer to be returned in ValidateDrawInstancedANGLE(). To handle this, ValidateDrawInstancedANGLE() should return 'true' and not signal an error since it's undefined behavior to draw without a Program/PPO bound, but it's not an error. Bug: chromium:1079336 Test: gpu_angle_passthrough_fuzzer Change-Id: I90d9e99c63411d8388f4d8cf57ed46aec605ee68 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197943 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarTobin Ehlis <tobine@google.com>
parent 66d7490c
...@@ -757,6 +757,16 @@ bool ValidateDrawInstancedANGLE(const Context *context) ...@@ -757,6 +757,16 @@ bool ValidateDrawInstancedANGLE(const Context *context)
const State &state = context->getState(); const State &state = context->getState();
const ProgramExecutable *executable = state.getProgramExecutable(); const ProgramExecutable *executable = state.getProgramExecutable();
if (!executable)
{
// No executable means there is no Program/PPO bound, which is undefined behavior, but isn't
// an error.
context->getState().getDebug().insertMessage(
GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, 0, GL_DEBUG_SEVERITY_HIGH,
std::string("Attempting to draw without a program"), gl::LOG_WARN);
return true;
}
const auto &attribs = state.getVertexArray()->getVertexAttributes(); const auto &attribs = state.getVertexArray()->getVertexAttributes();
const auto &bindings = state.getVertexArray()->getVertexBindings(); const auto &bindings = state.getVertexArray()->getVertexBindings();
for (size_t attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++) for (size_t attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
......
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