Hash :
5df85793
Author :
Date :
2025-06-23T11:08:49
Revert "Vulkan: Avoid some loops in VertexArray::onBufferChanged" This reverts commit 8d6d127acc1072488e5b57ba4e7e93da2d94bfda. Reason for revert: https://issues.chromium.org/427064102 Bug: angleproject:400711938 Original change's description: > Vulkan: Avoid some loops in VertexArray::onBufferChanged > > Before this CL, VertexArray::onBufferChanged() loops over > bufferBindingMask bits and calls onSubjectStateChange. In this CL, > VertexArray::onSubjectStateChange is embedded into > VertexArray::onBufferChanged(). DIRTY_BIT_ELEMENT_ARRAY_BUFFER and > DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA is re-arranged so that we can map > bufferBindingMask directly to VertexArray::mDirtyBits. This especially > useful when one buffer is bound to multiple indices in the VertexArray. > > This CL also removes angle::ObserverInterface from VertexArray, since it > no longer observes anything. > > ASSERT is added in gl::Buffer::mContentsObservers to ensure it only > contains BufferTexture, since vertexArray is no longer using the > subject/observer. > > Bug: angleproject:400711938 > Change-Id: Ie6e7159d7a89f0da5e1b7ca0a9dbe60a1e6c682f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6569638 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:400711938 Change-Id: I3b8e77db7b3d06b9ed875bfe7787904ac753da11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6664161 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Unit tests for VertexArray and related classes.
//
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "common/bitset_utils.h"
#include "common/utilities.h"
#include "libANGLE/VertexArray.h"
using namespace gl;
// Tests that function GetIndexFromDirtyBit computes the index properly.
TEST(VertexArrayTest, VerifyGetIndexFromDirtyBit)
{
VertexArray::DirtyBits dirtyBits;
constexpr size_t bits[] = {2, 4, 9, 16, 25, 35};
constexpr GLint count = sizeof(bits) / sizeof(size_t);
for (GLint i = 0; i < count; i++)
{
dirtyBits.set(bits[i]);
}
for (size_t dirtyBit : dirtyBits)
{
const size_t index = VertexArray::GetVertexIndexFromDirtyBit(dirtyBit);
if (dirtyBit < VertexArray::DIRTY_BIT_ATTRIB_0)
{
continue;
}
else if (dirtyBit < VertexArray::DIRTY_BIT_ATTRIB_MAX)
{
EXPECT_EQ(dirtyBit - VertexArray::DIRTY_BIT_ATTRIB_0, index);
}
else if (dirtyBit < VertexArray::DIRTY_BIT_BINDING_MAX)
{
EXPECT_EQ(dirtyBit - VertexArray::DIRTY_BIT_BINDING_0, index);
}
else if (dirtyBit < VertexArray::DIRTY_BIT_BUFFER_DATA_MAX)
{
EXPECT_EQ(dirtyBit - VertexArray::DIRTY_BIT_BUFFER_DATA_0, index);
}
else
{
ASSERT_TRUE(false);
}
}
}