Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/gpu/vk/GrVkPipelineStateCache.cpp

Issue 2208903002: Use sse4.2 CRC32 instructions to hash when available. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrVkResourceProvider.h" 8 #include "GrVkResourceProvider.h"
9 9
10 #include "GrVkGpu.h" 10 #include "GrVkGpu.h"
11 #include "GrProcessor.h" 11 #include "GrProcessor.h"
12 #include "GrVkPipelineState.h" 12 #include "GrVkPipelineState.h"
13 #include "GrVkPipelineStateBuilder.h" 13 #include "GrVkPipelineStateBuilder.h"
14 #include "SkRTConf.h" 14 #include "SkRTConf.h"
15 #include "SkOpts.h"
15 #include "glsl/GrGLSLFragmentProcessor.h" 16 #include "glsl/GrGLSLFragmentProcessor.h"
16 #include "glsl/GrGLSLProgramDataManager.h" 17 #include "glsl/GrGLSLProgramDataManager.h"
17 18
18 #ifdef GR_PIPELINE_STATE_CACHE_STATS 19 #ifdef GR_PIPELINE_STATE_CACHE_STATS
19 SK_CONF_DECLARE(bool, c_DisplayVkPipelineCache, "gpu.displayyVkPipelineCache", f alse, 20 SK_CONF_DECLARE(bool, c_DisplayVkPipelineCache, "gpu.displayyVkPipelineCache", f alse,
20 "Display pipeline state cache usage."); 21 "Display pipeline state cache usage.");
21 #endif 22 #endif
22 23
23 struct GrVkResourceProvider::PipelineStateCache::Entry { 24 struct GrVkResourceProvider::PipelineStateCache::Entry {
24 25
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 GrCapsDebugf(fGpu->caps(), "Failed to build vk program descriptor!\n"); 107 GrCapsDebugf(fGpu->caps(), "Failed to build vk program descriptor!\n");
107 return nullptr; 108 return nullptr;
108 } 109 }
109 110
110 // Get vulkan specific descriptor key 111 // Get vulkan specific descriptor key
111 GrVkPipelineState::BuildStateKey(pipeline, primitiveType, &desc.fStateKey); 112 GrVkPipelineState::BuildStateKey(pipeline, primitiveType, &desc.fStateKey);
112 // Get checksum of entire PipelineDesc 113 // Get checksum of entire PipelineDesc
113 int keyLength = desc.fStateKey.count(); 114 int keyLength = desc.fStateKey.count();
114 SkASSERT(0 == (keyLength % 4)); 115 SkASSERT(0 == (keyLength % 4));
115 // Seed the checksum with the checksum of the programDesc then add the vulka n key to it. 116 // Seed the checksum with the checksum of the programDesc then add the vulka n key to it.
116 desc.fChecksum = SkChecksum::Murmur3(desc.fStateKey.begin(), keyLength, 117 desc.fChecksum = SkOpts::hash(desc.fStateKey.begin(), keyLength,
117 desc.fProgramDesc.getChecksum()); 118 desc.fProgramDesc.getChecksum());
118 119
119 Entry* entry = nullptr; 120 Entry* entry = nullptr;
120 if (Entry** entryptr = fHashTable.find(desc)) { 121 if (Entry** entryptr = fHashTable.find(desc)) {
121 SkASSERT(*entryptr); 122 SkASSERT(*entryptr);
122 entry = *entryptr; 123 entry = *entryptr;
123 } 124 }
124 if (!entry) { 125 if (!entry) {
125 #ifdef GR_PIPELINE_STATE_CACHE_STATS 126 #ifdef GR_PIPELINE_STATE_CACHE_STATS
126 ++fCacheMisses; 127 ++fCacheMisses;
127 #endif 128 #endif
(...skipping 20 matching lines...) Expand all
148 entry->fPipelineState = std::move(pipelineState); 149 entry->fPipelineState = std::move(pipelineState);
149 fHashTable.set(entry); 150 fHashTable.set(entry);
150 fLRUList.addToTail(entry); 151 fLRUList.addToTail(entry);
151 return entry->fPipelineState; 152 return entry->fPipelineState;
152 } else { 153 } else {
153 fLRUList.remove(entry); 154 fLRUList.remove(entry);
154 fLRUList.addToTail(entry); 155 fLRUList.addToTail(entry);
155 } 156 }
156 return entry->fPipelineState; 157 return entry->fPipelineState;
157 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698