| OLD | NEW |
| 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" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 sk_sp<GrVkPipelineState> GrVkResourceProvider::PipelineStateCache::refPipelineSt
ate( | 92 sk_sp<GrVkPipelineState> GrVkResourceProvider::PipelineStateCache::refPipelineSt
ate( |
| 93 const GrPipeline&
pipeline, | 93 const GrPipeline&
pipeline, |
| 94 const GrPrimitive
Processor& primProc, | 94 const GrPrimitive
Processor& primProc, |
| 95 GrPrimitiveType p
rimitiveType, | 95 GrPrimitiveType p
rimitiveType, |
| 96 const GrVkRenderP
ass& renderPass) { | 96 const GrVkRenderP
ass& renderPass) { |
| 97 #ifdef GR_PIPELINE_STATE_CACHE_STATS | 97 #ifdef GR_PIPELINE_STATE_CACHE_STATS |
| 98 ++fTotalRequests; | 98 ++fTotalRequests; |
| 99 #endif | 99 #endif |
| 100 // Get GrVkProgramDesc | 100 // Get GrVkProgramDesc |
| 101 GrVkPipelineState::Desc desc; | 101 GrVkPipelineState::Desc desc; |
| 102 if (!GrGLSLProgramDescBuilder::Build(&desc.fProgramDesc, | 102 if (!GrProgramDesc::Build(&desc.fProgramDesc, primProc, pipeline, *fGpu->vkC
aps().glslCaps())) { |
| 103 primProc, | |
| 104 pipeline, | |
| 105 *fGpu->vkCaps().glslCaps())) { | |
| 106 GrCapsDebugf(fGpu->caps(), "Failed to build vk program descriptor!\n"); | 103 GrCapsDebugf(fGpu->caps(), "Failed to build vk program descriptor!\n"); |
| 107 return nullptr; | 104 return nullptr; |
| 108 } | 105 } |
| 106 desc.fProgramDesc.finalize(); |
| 109 | 107 |
| 110 // Get vulkan specific descriptor key | 108 // Get vulkan specific descriptor key |
| 111 GrVkPipelineState::BuildStateKey(pipeline, primitiveType, &desc.fStateKey); | 109 GrVkPipelineState::BuildStateKey(pipeline, primitiveType, &desc.fStateKey); |
| 112 // Get checksum of entire PipelineDesc | 110 // Get checksum of entire PipelineDesc |
| 113 int keyLength = desc.fStateKey.count(); | 111 int keyLength = desc.fStateKey.count(); |
| 114 SkASSERT(0 == (keyLength % 4)); | 112 SkASSERT(0 == (keyLength % 4)); |
| 115 // Seed the checksum with the checksum of the programDesc then add the vulka
n key to it. | 113 // Seed the checksum with the checksum of the programDesc then add the vulka
n key to it. |
| 116 desc.fChecksum = SkOpts::hash(desc.fStateKey.begin(), keyLength, | 114 desc.fChecksum = SkOpts::hash(desc.fStateKey.begin(), keyLength, |
| 117 desc.fProgramDesc.getChecksum()); | 115 desc.fProgramDesc.getChecksum()); |
| 118 | 116 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 148 entry->fPipelineState = std::move(pipelineState); | 146 entry->fPipelineState = std::move(pipelineState); |
| 149 fHashTable.set(entry); | 147 fHashTable.set(entry); |
| 150 fLRUList.addToTail(entry); | 148 fLRUList.addToTail(entry); |
| 151 return entry->fPipelineState; | 149 return entry->fPipelineState; |
| 152 } else { | 150 } else { |
| 153 fLRUList.remove(entry); | 151 fLRUList.remove(entry); |
| 154 fLRUList.addToTail(entry); | 152 fLRUList.addToTail(entry); |
| 155 } | 153 } |
| 156 return entry->fPipelineState; | 154 return entry->fPipelineState; |
| 157 } | 155 } |
| OLD | NEW |