Fix Shader compile-mode radio buttons in Viewer.
Originally, these radio buttons would allow the user to immediately switch between different compile stages and view the change in output. At some point, this broke, and clicking the radio buttons would clear the shader list, so that the user would need to click View again to see the shaders. This made it much harder to visualize the difference in compilation stages at a glance. Now the radio buttons work normally again. Change-Id: I234c305817909c4345dd12318df3cbe4505121a8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524936 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
99b7434daf
commit
30d3d1ab19
@ -2563,6 +2563,7 @@ void Viewer::drawImGui() {
|
|||||||
|
|
||||||
// If we are changing the compile mode, we want to reset the cache and redo
|
// If we are changing the compile mode, we want to reset the cache and redo
|
||||||
// everything.
|
// everything.
|
||||||
|
static bool sDoDeferredView = false;
|
||||||
if (doDump || newOptLevel != fOptLevel) {
|
if (doDump || newOptLevel != fOptLevel) {
|
||||||
sksl = doDump || (newOptLevel == kShaderOptLevel_Source);
|
sksl = doDump || (newOptLevel == kShaderOptLevel_Source);
|
||||||
fOptLevel = (ShaderOptLevel)newOptLevel;
|
fOptLevel = (ShaderOptLevel)newOptLevel;
|
||||||
@ -2589,11 +2590,12 @@ void Viewer::drawImGui() {
|
|||||||
sksl ? GrContextOptions::ShaderCacheStrategy::kSkSL
|
sksl ? GrContextOptions::ShaderCacheStrategy::kSkSL
|
||||||
: GrContextOptions::ShaderCacheStrategy::kBackendSource;
|
: GrContextOptions::ShaderCacheStrategy::kBackendSource;
|
||||||
displayParamsChanged = true;
|
displayParamsChanged = true;
|
||||||
doView = true;
|
|
||||||
|
|
||||||
fDeferredActions.push_back([=]() {
|
fDeferredActions.push_back([=]() {
|
||||||
// Reset the cache.
|
// Reset the cache.
|
||||||
fPersistentCache.reset();
|
fPersistentCache.reset();
|
||||||
|
sDoDeferredView = true;
|
||||||
|
|
||||||
// Dump the cache once we have drawn a frame with it.
|
// Dump the cache once we have drawn a frame with it.
|
||||||
if (doDump) {
|
if (doDump) {
|
||||||
fDeferredActions.push_back([this]() {
|
fDeferredActions.push_back([this]() {
|
||||||
@ -2630,10 +2632,11 @@ void Viewer::drawImGui() {
|
|||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
if (doView) {
|
if (doView || sDoDeferredView) {
|
||||||
fPersistentCache.reset();
|
fPersistentCache.reset();
|
||||||
ctx->priv().getGpu()->resetShaderCacheForTesting();
|
ctx->priv().getGpu()->resetShaderCacheForTesting();
|
||||||
gLoadPending = true;
|
gLoadPending = true;
|
||||||
|
sDoDeferredView = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't support updating SPIRV shaders. We could re-assemble them (with edits),
|
// We don't support updating SPIRV shaders. We could re-assemble them (with edits),
|
||||||
|
Loading…
Reference in New Issue
Block a user