зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Remove inUseAndRespecifiedWithoutData from BufferVk
BufferVk::setDataWithMemoryType() has one optimization that it tries to detect glBufferData(target, size, nullptr, usage) and if existing storage is busy, it immediately reallocate storage. With the optimization in previous CL (crrev.com/c/4317488), the storage reuse logic should detect if we can reuse the storage or not. If the size matches the existing storage's size, then there is no reason we can not reuse existing storage. Later on when glBufferSubData or glMapBufferRange is called, there are optimization in those calls that will detect if we should reallocate storage or not as the further optimization. This CL removes this check and replies on the other optimization to handle the storage reallocate (shadowing) if necessary. This simplifies code and also potentially avoids storage reallocation in certain usage cases. This CL also fixes a test bug in BufferDataTestES3.BufferDataWithNullFollowedByMap that was calling glMapBufferRange with MAP_UNSYNCHRONIZED_BIT but incorrectly expecting GL to do synchronization. Bug: b/271915956 Change-Id: I7901687b3e3e262e77699f14eb8602d8a57eda3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4322048 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
This commit is contained in:
Родитель
c3ffae10aa
Коммит
755bfe471d
|
@ -417,13 +417,9 @@ angle::Result BufferVk::setDataWithMemoryType(const gl::Context *context,
|
|||
}
|
||||
else
|
||||
{
|
||||
const bool inUseAndRespecifiedWithoutData = (data == nullptr && isCurrentlyInUse(renderer));
|
||||
// Optimization: Lets figure out if we can reuse the existing storage.
|
||||
bool redefineStorage = shouldRedefineStorage(renderer, usage, memoryPropertyFlags, size);
|
||||
|
||||
// The entire buffer is being respecified, possibly with null data.
|
||||
// Release and init a new mBuffer with requested size.
|
||||
if (redefineStorage || inUseAndRespecifiedWithoutData)
|
||||
if (redefineStorage)
|
||||
{
|
||||
// Release and re-create the memory and buffer.
|
||||
release(contextVk);
|
||||
|
|
|
@ -1219,8 +1219,7 @@ TEST_P(BufferDataTestES3, BufferDataWithNullFollowedByMap)
|
|||
const std::vector<GLfloat> kZeros(6, 0.0f);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * kZeros.size(), nullptr, GL_STATIC_DRAW);
|
||||
uint8_t *mapPtr = reinterpret_cast<uint8_t *>(
|
||||
glMapBufferRange(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * kZeros.size(),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT));
|
||||
glMapBufferRange(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * kZeros.size(), GL_MAP_WRITE_BIT));
|
||||
ASSERT_NE(nullptr, mapPtr);
|
||||
ASSERT_GL_NO_ERROR();
|
||||
memcpy(mapPtr, kZeros.data(), sizeof(GLfloat) * kZeros.size());
|
||||
|
|
Загрузка…
Ссылка в новой задаче