Vulkan: Faster state transitions.
Implements a transition table from Pipeline Cache entry to
state change neighbouring Pipeline Cache entries. We use
a 64-bit mask to do a quick scan over the pipeline desc.
This ends up being a lot faster than doing a full hash
and memcmp over the pipeline description.
Note that there could be future optimizations to this design.
We might keep a hash map of the pipeline transitions instead
of a list. Or use a sorted list. This could speed up the search
when there are many transitions for cache entries. Also we could
skip the transition table and opt to do a full hash when there
are more than a configurable number of dirty states. This might
be a bit faster in some cases. Likely this will be something we
can add performance tests for in the future.
Documentation is also added in a README file for the Vulkan back
end. This will be extended over time.
Improves performance about 30-35% on the VBO state change test.
Bug: angleproject:3013
Change-Id: I793f9e3efd8887acf00ad60e4ac2502a54c95dee
Reviewed-on: https://chromium-review.googlesource.com/c/1369287
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index e0e361a..1cbca8c 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -40,16 +40,11 @@
}
}
-constexpr GLuint Log2(GLuint bytes)
-{
- return bytes == 1 ? 0 : (1 + Log2(bytes / 2));
-}
-
constexpr uint32_t PackTypeInfo(GLuint bytes, bool specialized)
{
// static_assert within constexpr requires c++17
// static_assert(isPow2(bytes));
- return bytes | (Log2(bytes) << 8) | (specialized << 16);
+ return bytes | (rx::Log2(bytes) << 8) | (specialized << 16);
}
} // anonymous namespace