Commit 968c7811 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Enable shader caching for OOP-D and passthrough

PassthroughProgramCache is effectively a singleton. https://cs.chromium.org/chromium/src/gpu/command_buffer/service/passthrough_program_cache.cc?rcl=9f6874260539e70ec774687f49a56d6fd1feb8f5&l=49

We need to grab it from GpuChannelManager to support shader caching
using Angle.

TBR=boliu@chromium.org

Change-Id: I43378d11f01bcc0bac37faa228f72db404214464
Reviewed-on: https://chromium-review.googlesource.com/c/1427221
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625316}
parent 0bc05783
......@@ -160,7 +160,8 @@ DeferredGpuCommandService::DeferredGpuCommandService(
mailbox_manager.get(),
nullptr,
gl::GLSurfaceFormat(),
shared_image_manager.get()),
shared_image_manager.get(),
nullptr),
sync_point_manager_(std::move(sync_point_manager)),
mailbox_manager_(std::move(mailbox_manager)),
gpu_info_(gpu_info),
......
......@@ -271,7 +271,8 @@ void PixelTest::SetUpGpuServiceOnGpuThread(base::WaitableEvent* event) {
->GetFormat(),
gpu_service_->gpu_feature_info(),
gpu_service_->gpu_channel_manager()->gpu_preferences(),
gpu_service_->shared_image_manager());
gpu_service_->shared_image_manager(),
gpu_service_->gpu_channel_manager()->program_cache());
event->Signal();
}
......
......@@ -4,13 +4,16 @@
#include "components/viz/service/display_embedder/skia_output_surface_impl.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/base64.h"
#include "base/test/scoped_feature_list.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/pixel_test_utils.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/service/display_embedder/skia_output_surface_impl.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "gpu/command_buffer/service/scheduler.h"
#include "gpu/ipc/gpu_in_process_thread_service.h"
......@@ -100,7 +103,8 @@ void SkiaOutputSurfaceImplTest::SetUpGpuServiceOnGpuThread() {
->GetFormat(),
gpu_service_->gpu_feature_info(),
gpu_service_->gpu_channel_manager()->gpu_preferences(),
gpu_service_->shared_image_manager());
gpu_service_->shared_image_manager(),
gpu_service_->gpu_channel_manager()->program_cache());
UnblockMainThread();
}
......
......@@ -251,7 +251,8 @@ void VizMainImpl::CreateFrameSinkManagerInternal(
gpu_service_->sync_point_manager(), gpu_service_->mailbox_manager(),
gpu_service_->share_group(), format, gpu_service_->gpu_feature_info(),
gpu_service_->gpu_channel_manager()->gpu_preferences(),
gpu_service_->shared_image_manager());
gpu_service_->shared_image_manager(),
gpu_service_->gpu_channel_manager()->program_cache());
viz_compositor_thread_runner_->CreateFrameSinkManager(
std::move(params), task_executor_, gpu_service_.get());
......
......@@ -20,13 +20,15 @@ CommandBufferTaskExecutor::CommandBufferTaskExecutor(
MailboxManager* mailbox_manager,
scoped_refptr<gl::GLShareGroup> share_group,
gl::GLSurfaceFormat share_group_surface_format,
SharedImageManager* shared_image_manager)
SharedImageManager* shared_image_manager,
gles2::ProgramCache* program_cache)
: gpu_preferences_(gpu_preferences),
gpu_feature_info_(gpu_feature_info),
sync_point_manager_(sync_point_manager),
mailbox_manager_(mailbox_manager),
share_group_(share_group),
share_group_surface_format_(share_group_surface_format),
program_cache_(program_cache),
shader_translator_cache_(gpu_preferences_),
shared_image_manager_(shared_image_manager) {
DCHECK(mailbox_manager_);
......@@ -57,13 +59,14 @@ gles2::ProgramCache* CommandBufferTaskExecutor::program_cache() {
bool disable_disk_cache =
gpu_preferences_.disable_gpu_shader_disk_cache ||
gpu_feature_info_.IsWorkaroundEnabled(gpu::DISABLE_PROGRAM_DISK_CACHE);
program_cache_ = std::make_unique<gles2::MemoryProgramCache>(
owned_program_cache_ = std::make_unique<gles2::MemoryProgramCache>(
gpu_preferences_.gpu_program_cache_size, disable_disk_cache,
gpu_feature_info_.IsWorkaroundEnabled(
gpu::DISABLE_PROGRAM_CACHING_FOR_TRANSFORM_FEEDBACK),
&activity_flags_);
program_cache_ = owned_program_cache_.get();
}
return program_cache_.get();
return program_cache_;
}
} // namespace gpu
......@@ -6,6 +6,7 @@
#define GPU_IPC_COMMAND_BUFFER_TASK_EXECUTOR_H_
#include <memory>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
......@@ -73,7 +74,8 @@ class GL_IN_PROCESS_CONTEXT_EXPORT CommandBufferTaskExecutor
MailboxManager* mailbox_manager,
scoped_refptr<gl::GLShareGroup> share_group,
gl::GLSurfaceFormat share_group_surface_format,
SharedImageManager* shared_image_manager);
SharedImageManager* shared_image_manager,
gles2::ProgramCache* program_cache);
// Always use virtualized GL contexts if this returns true.
virtual bool ForceVirtualizedGLContexts() const = 0;
......@@ -133,7 +135,8 @@ class GL_IN_PROCESS_CONTEXT_EXPORT CommandBufferTaskExecutor
std::unique_ptr<gles2::Outputter> outputter_;
scoped_refptr<gl::GLShareGroup> share_group_;
gl::GLSurfaceFormat share_group_surface_format_;
std::unique_ptr<gles2::ProgramCache> program_cache_;
std::unique_ptr<gles2::ProgramCache> owned_program_cache_;
gles2::ProgramCache* program_cache_;
gles2::ImageManager image_manager_;
ServiceDiscardableManager discardable_manager_;
PassthroughDiscardableManager passthrough_discardable_manager_;
......
......@@ -4,6 +4,9 @@
#include "gpu/ipc/gpu_in_process_thread_service.h"
#include <utility>
#include <vector>
#include "base/threading/thread_task_runner_handle.h"
#include "gpu/command_buffer/service/scheduler.h"
......@@ -56,14 +59,16 @@ GpuInProcessThreadService::GpuInProcessThreadService(
gl::GLSurfaceFormat share_group_surface_format,
const GpuFeatureInfo& gpu_feature_info,
const GpuPreferences& gpu_preferences,
SharedImageManager* shared_image_manager)
SharedImageManager* shared_image_manager,
gles2::ProgramCache* program_cache)
: CommandBufferTaskExecutor(gpu_preferences,
gpu_feature_info,
sync_point_manager,
mailbox_manager,
share_group,
share_group_surface_format,
shared_image_manager),
shared_image_manager,
program_cache),
task_runner_(task_runner),
scheduler_(scheduler) {}
......
......@@ -5,6 +5,8 @@
#ifndef GPU_IPC_GPU_IN_PROCESS_THREAD_SERVICE_H_
#define GPU_IPC_GPU_IN_PROCESS_THREAD_SERVICE_H_
#include <memory>
#include "base/compiler_specific.h"
#include "base/single_thread_task_runner.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
......@@ -14,9 +16,12 @@
#include "ui/gl/gl_share_group.h"
namespace gpu {
class Scheduler;
namespace gles2 {
class ProgramCache;
} // namespace gles2
// Default Service class when no service is specified. GpuInProcessThreadService
// is used by Mus and unit tests.
class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
......@@ -31,7 +36,8 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
gl::GLSurfaceFormat share_group_surface_format,
const GpuFeatureInfo& gpu_feature_info,
const GpuPreferences& gpu_preferences,
SharedImageManager* shared_image_manager);
SharedImageManager* shared_image_manager,
gles2::ProgramCache* program_cache);
// CommandBufferTaskExecutor implementation.
bool ForceVirtualizedGLContexts() const override;
......
......@@ -73,7 +73,7 @@ void InProcessGpuThreadHolder::InitializeOnGpuThread(
task_executor_ = base::MakeRefCounted<GpuInProcessThreadService>(
task_runner(), scheduler_.get(), sync_point_manager_.get(),
mailbox_manager_.get(), nullptr, gl::GLSurfaceFormat(), gpu_feature_info_,
gpu_preferences_, shared_image_manager_.get());
gpu_preferences_, shared_image_manager_.get(), nullptr);
completion->Signal();
}
......
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