summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueThreadState.cpp
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2022-04-26 15:23:55 -0400
committer Leon Scroggins III <scroggo@google.com> 2022-04-26 16:47:05 -0400
commitae07fe53484124b22150279cdd9b5e5179e5fe6a (patch)
tree7ee665329e32a97ff526b5a6b505120a0e350682 /libs/gui/BufferQueueThreadState.cpp
parentc8c333259715252d81c3c4c28cdf64fd3c148b7b (diff)
Fix subtle copying bug in primeShaderCache
Move the declaration of vectors to the innermost loop that uses them. We loop through a bunch of different LayerSettings to draw content that will prime the shader cache. In several places, we create a vector initialized with multiple LayerSettings, and then inside a loop, we modify the originals. When this code was written, we created a vector<const LayerSettings*>. In I87847d01e2e330ddec88272cd8608f0b78c0a2cd, the RenderEngine API was changed to accept a vector<LayerSettings>. The problem is, when constructing a vector<LayerSettings>, we get a *copy* of the items in the initializer list. So when the loop modifies the originals, the vector stays as it is, and only the first iteraton of the loop caches any shaders. On my test device, we have only cached 6 shaders at the end of primeShaderCache. With this change, we are back up to 93 shaders. Bug: 190487656 Bug: 222355787 Test: manual - logcat + perfetto Change-Id: I9f0e9e8535feee48700f1c896f26833b6095764d
Diffstat (limited to 'libs/gui/BufferQueueThreadState.cpp')
0 files changed, 0 insertions, 0 deletions