Commit 9a0fab34 authored by Khushal Sagar's avatar Khushal Sagar Committed by Commit Bot

viz: Ensure GrShaderCache setup for SkiaOutputSurfaceImpl draws.

The GrShaderCache::ScopedCacheUse needs to be acquired when using the
GrContext to scope the cache's use to a single client. Add it for the
overdraw_ddl draw in SkiaOutputSurface.

R=ericrk@chromium.org

Change-Id: I6849deed684fa486b0a44bb227ce04217b62cafc
Reviewed-on: https://chromium-review.googlesource.com/c/1394348
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619764}
parent bce878b0
......@@ -226,15 +226,26 @@ void SkiaOutputSurfaceImplOnGpu::FinishPaintCurrentFrame(
{
base::Optional<gpu::raster::GrShaderCache::ScopedCacheUse> cache_use;
if (gpu_service_->gr_shader_cache())
if (gpu_service_->gr_shader_cache()) {
cache_use.emplace(gpu_service_->gr_shader_cache(),
gpu::kInProcessCommandBufferClientId);
}
sk_surface_->draw(ddl.get());
gr_context()->flush();
}
// Note that the ScopedCacheUse for GrShaderCache is scoped until the
// ReleaseFenceSync call here since releasing the fence may schedule a
// different decoder's stream which also uses the shader cache.
sync_point_client_state_->ReleaseFenceSync(sync_fence_release);
if (overdraw_ddl) {
base::Optional<gpu::raster::GrShaderCache::ScopedCacheUse> cache_use;
if (gpu_service_->gr_shader_cache()) {
cache_use.emplace(gpu_service_->gr_shader_cache(),
gpu::kInProcessCommandBufferClientId);
}
sk_sp<SkSurface> overdraw_surface = SkSurface::MakeRenderTarget(
gr_context(), overdraw_ddl->characterization(), SkBudgeted::kNo);
overdraw_surface->draw(overdraw_ddl.get());
......
......@@ -149,6 +149,9 @@ void GrShaderCache::EnforceLimits(size_t size_needed) {
GrShaderCache::ScopedCacheUse::ScopedCacheUse(GrShaderCache* cache,
int32_t client_id)
: cache_(cache) {
DCHECK_EQ(cache_->current_client_id_, kInvalidClientId);
DCHECK_NE(client_id, kInvalidClientId);
cache_->current_client_id_ = client_id;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment