aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShahbaz Youssefi <syoussefi@chromium.org>2024-04-13 23:07:11 -0400
committerAngle LUCI CQ <angle-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-04-15 16:07:20 +0000
commit24ba48eb21ce5b22ca16753620d10cefedb7584d (patch)
tree1408cc90a81e0ff6eb6a105ac2f2ee14e3433297
parent99ac37cf7bad44d43f0c18da0410bde1073b62ea (diff)
downloadangle-24ba48eb21ce5b22ca16753620d10cefedb7584d.tar.gz
Do not cache program binary in blob cache redundantly with app
If the application has specified the GL_PROGRAM_BINARY_RETRIEVABLE_HINT hint, let the application itself cache the program binary and skip ANGLE's implicit caching. This saves time in serializing the binary, and memory and disk space storing these binaries. If the application sets the hint, but does not actually restore the binary, they will suffer instead. This change also adds a perf warning for applications that retrieve the binary without setting this hint. Bug: angleproject:7393 Change-Id: I05aa880a31fa2fbbd61447c257c990a57137e1e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5448089 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
-rw-r--r--src/libANGLE/Program.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 3b65c836f5..61435b2384 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -1439,6 +1439,13 @@ angle::Result Program::getBinary(Context *context,
GLsizei bufSize,
GLsizei *length)
{
+ if (!mState.mBinaryRetrieveableHint)
+ {
+ ANGLE_PERF_WARNING(
+ context->getState().getDebug(), GL_DEBUG_SEVERITY_LOW,
+ "Saving program binary without GL_PROGRAM_BINARY_RETRIEVABLE_HINT is suboptimal.");
+ }
+
ASSERT(!mLinkingState);
if (binaryFormat)
{
@@ -2305,10 +2312,10 @@ void Program::cacheProgramBinary(const Context *context)
{
// If program caching is disabled, we already consider the binary cached.
ASSERT(!context->getFrontendFeatures().disableProgramCaching.enabled || mIsBinaryCached);
- if (!mLinked || mIsBinaryCached)
+ if (!mLinked || mIsBinaryCached || mState.mBinaryRetrieveableHint)
{
- // Program caching is disabled, the program is yet to be linked or it's already cached,
- // nothing to do.
+ // Program caching is disabled, the program is yet to be linked, it's already cached, or the
+ // application has specified that it prefers to cache the program binary itself.
return;
}