Add error check on resuming XFB with deleted buffer.

Bug: chromium:1305190
Change-Id: I22c6f6400b05ca32c922fba9a3b9d4b5841ca8b8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3578378
Auto-Submit: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2022-04-11 12:29:00 -04:00 коммит произвёл Angle LUCI CQ
Родитель a947c5f56c
Коммит 5c85fd4e11
2 изменённых файлов: 32 добавлений и 0 удалений

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

@ -4377,6 +4377,13 @@ bool ValidateResumeTransformFeedback(const Context *context, angle::EntryPoint e
return false;
}
if (!ValidateProgramExecutableXFBBuffersPresent(context,
context->getState().getProgramExecutable()))
{
context->validationError(entryPoint, GL_INVALID_OPERATION, kTransformFeedbackBufferMissing);
return false;
}
return true;
}

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

@ -4080,6 +4080,31 @@ TEST_P(TransformFeedbackTest, BaseInstance)
EXPECT_GL_NO_ERROR();
}
// Tests that deleting a buffer then resuming transform feedback produces an error.
TEST_P(TransformFeedbackTest, ResumingTransformFeedbackAfterDeletebuffer)
{
ANGLE_GL_PROGRAM_TRANSFORM_FEEDBACK(testProgram, essl1_shaders::vs::Simple(),
essl1_shaders::fs::Green(), {"gl_Position"},
GL_INTERLEAVED_ATTRIBS);
glUseProgram(testProgram);
std::vector<uint8_t> bufData(100, 0);
GLBuffer buf;
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buf);
glBufferData(GL_PIXEL_UNPACK_BUFFER, bufData.size(), bufData.data(), GL_DYNAMIC_COPY);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
glBeginTransformFeedback(GL_POINTS);
glPauseTransformFeedback();
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
buf.reset();
ASSERT_GL_NO_ERROR();
// Should produce an error because of a missing buffer binding.
glResumeTransformFeedback();
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TransformFeedbackTest);
ANGLE_INSTANTIATE_TEST_ES3(TransformFeedbackTest);