зеркало из https://github.com/AvaloniaUI/angle.git
D3D11: Fix reserved space with large dynamic buffers.
We would end up with a large reserved space even though the allocation failed. Insead set the reserved space size after the allocation succedes. This was showing up as angle_end2end_tests failures on Windows 7 due to display reuse and buffer allocation. Bug: chromium:944454 Change-Id: Idb3bd530fe7b9cc2fce9a579787684e632b1a637 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1534684 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
a88c1f9c8b
Коммит
eae464dd30
|
@ -159,6 +159,7 @@ angle::Result StreamingVertexBufferInterface::reserveSpace(const gl::Context *co
|
|||
mWritePosition = 0;
|
||||
}
|
||||
|
||||
mReservedSpace = size;
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
|
@ -181,7 +182,6 @@ angle::Result StreamingVertexBufferInterface::storeDynamicAttribute(
|
|||
checkedPosition += spaceRequired;
|
||||
ANGLE_CHECK_GL_ALLOC(GetImplAs<ContextD3D>(context), checkedPosition.IsValid());
|
||||
|
||||
ANGLE_TRY(reserveSpace(context, mReservedSpace));
|
||||
mReservedSpace = 0;
|
||||
|
||||
ANGLE_TRY(mVertexBuffer->storeVertexAttributes(context, attrib, binding, currentValueType,
|
||||
|
@ -215,7 +215,7 @@ angle::Result StreamingVertexBufferInterface::reserveVertexSpace(const gl::Conte
|
|||
// Protect against integer overflow
|
||||
ANGLE_CHECK_GL_ALLOC(GetImplAs<ContextD3D>(context), alignedRequiredSpace.IsValid());
|
||||
|
||||
mReservedSpace = alignedRequiredSpace.ValueOrDie();
|
||||
ANGLE_TRY(reserveSpace(context, alignedRequiredSpace.ValueOrDie()));
|
||||
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
|
|
@ -561,6 +561,19 @@ TEST_P(BufferDataOverflowTest, VertexBufferIntegerOverflow)
|
|||
EXPECT_GL_NO_ERROR();
|
||||
glDrawArrays(GL_TRIANGLES, 0, numItems);
|
||||
EXPECT_GL_ERROR(GL_OUT_OF_MEMORY);
|
||||
|
||||
// Test that a small draw still works.
|
||||
for (GLsizei bufferIndex = 0; bufferIndex < bufferCnt; ++bufferIndex)
|
||||
{
|
||||
std::stringstream attribNameStr;
|
||||
attribNameStr << "attrib" << bufferIndex;
|
||||
GLint attribLocation = glGetAttribLocation(program.get(), attribNameStr.str().c_str());
|
||||
ASSERT_NE(-1, attribLocation);
|
||||
glDisableVertexAttribArray(attribLocation);
|
||||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
EXPECT_GL_ERROR(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
// Tests a security bug in our CopyBufferSubData validation (integer overflow).
|
||||
|
|
Загрузка…
Ссылка в новой задаче