summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authordsinclair@chromium.org <dsinclair@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 23:23:57 +0000
committerdsinclair@chromium.org <dsinclair@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 23:23:57 +0000
commitbd529727774c9de19bfff6b531821226d4ea8a39 (patch)
tree6360380b3acadcfe9611ab3bc8533175afedba01 /gpu
parent108aecef73d966ff16b4f989622fe66e5c5156cf (diff)
downloadchromium_src-bd529727774c9de19bfff6b531821226d4ea8a39.zip
chromium_src-bd529727774c9de19bfff6b531821226d4ea8a39.tar.gz
chromium_src-bd529727774c9de19bfff6b531821226d4ea8a39.tar.bz2
Revert r192949 "Disable shader disk cache by default."
This reverts commit r192949. The disable has been merged into M27 so re-enabling on trunk. BUG=228989 Review URL: https://chromiumcodereview.appspot.com/13872012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gpu_switches.cc4
-rw-r--r--gpu/command_buffer/service/gpu_switches.h2
-rw-r--r--gpu/command_buffer/service/memory_program_cache.cc8
-rw-r--r--gpu/command_buffer/service/memory_program_cache_unittest.cc36
4 files changed, 43 insertions, 7 deletions
diff --git a/gpu/command_buffer/service/gpu_switches.cc b/gpu/command_buffer/service/gpu_switches.cc
index 6a77db0..6d699ad 100644
--- a/gpu/command_buffer/service/gpu_switches.cc
+++ b/gpu/command_buffer/service/gpu_switches.cc
@@ -60,7 +60,7 @@ const char kGpuProgramCacheSizeKb[] = "gpu-program-cache-size-kb";
const char kTraceGL[] = "trace-gl";
// Disables the GPU shader on disk cache.
-const char kEnableGpuShaderDiskCache[] = "enable-gpu-shader-disk-cache";
+const char kDisableGpuShaderDiskCache[] = "disable-gpu-shader-disk-cache";
const char* kGpuSwitches[] = {
kCompileShaderAlwaysSucceeds,
@@ -79,7 +79,7 @@ const char* kGpuSwitches[] = {
kGpuDriverBugWorkarounds,
kGpuProgramCacheSizeKb,
kTraceGL,
- kEnableGpuShaderDiskCache,
+ kDisableGpuShaderDiskCache,
};
const int kNumGpuSwitches = arraysize(kGpuSwitches);
diff --git a/gpu/command_buffer/service/gpu_switches.h b/gpu/command_buffer/service/gpu_switches.h
index d4f4bad..ba6f804 100644
--- a/gpu/command_buffer/service/gpu_switches.h
+++ b/gpu/command_buffer/service/gpu_switches.h
@@ -27,7 +27,7 @@ GPU_EXPORT extern const char kForceSynchronousGLReadPixels[];
GPU_EXPORT extern const char kGpuDriverBugWorkarounds[];
GPU_EXPORT extern const char kGpuProgramCacheSizeKb[];
GPU_EXPORT extern const char kTraceGL[];
-GPU_EXPORT extern const char kEnableGpuShaderDiskCache[];
+GPU_EXPORT extern const char kDisableGpuShaderDiskCache[];
GPU_EXPORT extern const char* kGpuSwitches[];
GPU_EXPORT extern const int kNumGpuSwitches;
diff --git a/gpu/command_buffer/service/memory_program_cache.cc b/gpu/command_buffer/service/memory_program_cache.cc
index 726c60d..d9d944d 100644
--- a/gpu/command_buffer/service/memory_program_cache.cc
+++ b/gpu/command_buffer/service/memory_program_cache.cc
@@ -142,8 +142,8 @@ ProgramCache::ProgramLoadResult MemoryProgramCache::LoadLinkedProgram(
shader_b->set_uniform_map(value->uniform_map_1);
if (!shader_callback.is_null() &&
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableGpuShaderDiskCache)) {
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuShaderDiskCache)) {
GpuProgramProto* proto = GpuProgramProto::default_instance().New();
proto->set_sha(sha, kHashLength);
proto->set_format(value->format);
@@ -212,8 +212,8 @@ void MemoryProgramCache::SaveLinkedProgram(
}
if (!shader_callback.is_null() &&
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableGpuShaderDiskCache)) {
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuShaderDiskCache)) {
GpuProgramProto* proto = GpuProgramProto::default_instance().New();
proto->set_sha(sha, kHashLength);
proto->set_format(format);
diff --git a/gpu/command_buffer/service/memory_program_cache_unittest.cc b/gpu/command_buffer/service/memory_program_cache_unittest.cc
index a1d07fc..b083552 100644
--- a/gpu/command_buffer/service/memory_program_cache_unittest.cc
+++ b/gpu/command_buffer/service/memory_program_cache_unittest.cc
@@ -204,6 +204,37 @@ TEST_F(MemoryProgramCacheTest, CacheSave) {
*vertex_shader_->deferred_compilation_source(),
*fragment_shader_->deferred_compilation_source(),
NULL));
+ EXPECT_EQ(1, shader_cache_count());
+}
+
+TEST_F(MemoryProgramCacheTest, LoadProgram) {
+ const GLenum kFormat = 1;
+ const int kProgramId = 10;
+ const int kBinaryLength = 20;
+ char test_binary[kBinaryLength];
+ for (int i = 0; i < kBinaryLength; ++i) {
+ test_binary[i] = i;
+ }
+ ProgramBinaryEmulator emulator(kBinaryLength, kFormat, test_binary);
+
+ SetExpectationsForSaveLinkedProgram(kProgramId, &emulator);
+ cache_->SaveLinkedProgram(kProgramId, vertex_shader_, fragment_shader_, NULL,
+ base::Bind(&MemoryProgramCacheTest::ShaderCacheCb,
+ base::Unretained(this)));
+
+ EXPECT_EQ(ProgramCache::LINK_SUCCEEDED, cache_->GetLinkedProgramStatus(
+ *vertex_shader_->deferred_compilation_source(),
+ *fragment_shader_->deferred_compilation_source(),
+ NULL));
+ EXPECT_EQ(1, shader_cache_count());
+
+ cache_->Clear();
+
+ cache_->LoadProgram(shader_cache_shader());
+ EXPECT_EQ(ProgramCache::LINK_SUCCEEDED, cache_->GetLinkedProgramStatus(
+ *vertex_shader_->deferred_compilation_source(),
+ *fragment_shader_->deferred_compilation_source(),
+ NULL));
}
TEST_F(MemoryProgramCacheTest, CacheLoadMatchesSave) {
@@ -220,6 +251,7 @@ TEST_F(MemoryProgramCacheTest, CacheLoadMatchesSave) {
cache_->SaveLinkedProgram(kProgramId, vertex_shader_, fragment_shader_, NULL,
base::Bind(&MemoryProgramCacheTest::ShaderCacheCb,
base::Unretained(this)));
+ EXPECT_EQ(1, shader_cache_count());
VariableMap vertex_attrib_map = vertex_shader_->attrib_map();
VariableMap vertex_uniform_map = vertex_shader_->uniform_map();
@@ -265,6 +297,7 @@ TEST_F(MemoryProgramCacheTest, LoadProgramMatchesSave) {
cache_->SaveLinkedProgram(kProgramId, vertex_shader_, fragment_shader_, NULL,
base::Bind(&MemoryProgramCacheTest::ShaderCacheCb,
base::Unretained(this)));
+ EXPECT_EQ(1, shader_cache_count());
VariableMap vertex_attrib_map = vertex_shader_->attrib_map();
VariableMap vertex_uniform_map = vertex_shader_->uniform_map();
@@ -278,6 +311,9 @@ TEST_F(MemoryProgramCacheTest, LoadProgramMatchesSave) {
SetExpectationsForLoadLinkedProgram(kProgramId, &emulator);
+ cache_->Clear();
+ cache_->LoadProgram(shader_cache_shader());
+
EXPECT_EQ(ProgramCache::PROGRAM_LOAD_SUCCESS, cache_->LoadLinkedProgram(
kProgramId,
vertex_shader_,