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

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

Issue 2128273002: Only check resource tracking on program shutdown, not context shutdown (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/gpu/vk/GrVkResource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "GrTextureParams.h" 10 #include "GrTextureParams.h"
11 #include "GrVkCommandBuffer.h" 11 #include "GrVkCommandBuffer.h"
12 #include "GrVkPipeline.h" 12 #include "GrVkPipeline.h"
13 #include "GrVkRenderTarget.h" 13 #include "GrVkRenderTarget.h"
14 #include "GrVkSampler.h" 14 #include "GrVkSampler.h"
15 #include "GrVkUtil.h" 15 #include "GrVkUtil.h"
16 16
17 #ifdef SK_TRACE_VK_RESOURCES 17 #ifdef SK_TRACE_VK_RESOURCES
18 SkTDynamicHash<GrVkResource, uint32_t> GrVkResource::fTrace; 18 GrVkResource::Trace GrVkResource::fTrace;
19 SkRandom GrVkResource::fRandom; 19 SkRandom GrVkResource::fRandom;
20 #endif 20 #endif
21 21
22 GrVkResourceProvider::GrVkResourceProvider(GrVkGpu* gpu) 22 GrVkResourceProvider::GrVkResourceProvider(GrVkGpu* gpu)
23 : fGpu(gpu) 23 : fGpu(gpu)
24 , fPipelineCache(VK_NULL_HANDLE) 24 , fPipelineCache(VK_NULL_HANDLE)
25 , fUniformDescPool(nullptr) 25 , fUniformDescPool(nullptr)
26 , fCurrentUniformDescCount(0) { 26 , fCurrentUniformDescCount(0) {
27 fPipelineStateCache = new PipelineStateCache(gpu); 27 fPipelineStateCache = new PipelineStateCache(gpu);
28 } 28 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineCache(fGpu->device(), fPipeli neCache, nullptr)); 307 GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineCache(fGpu->device(), fPipeli neCache, nullptr));
308 fPipelineCache = VK_NULL_HANDLE; 308 fPipelineCache = VK_NULL_HANDLE;
309 309
310 if (fUniformDescLayout) { 310 if (fUniformDescLayout) {
311 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device( ), 311 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device( ),
312 fUniformDescL ayout, 312 fUniformDescL ayout,
313 nullptr)); 313 nullptr));
314 fUniformDescLayout = VK_NULL_HANDLE; 314 fUniformDescLayout = VK_NULL_HANDLE;
315 } 315 }
316 fUniformDescPool->unref(fGpu); 316 fUniformDescPool->unref(fGpu);
317
318 #ifdef SK_TRACE_VK_RESOURCES
319 if (GrVkResource::fTrace.count()) {
320 SkTDynamicHash<GrVkResource, uint32_t>::Iter iter(&GrVkResource::fTrace) ;
321 for (; !iter.done(); ++iter) {
322 (*iter).dumpInfo();
323 }
324 }
325 SkASSERT(0 == GrVkResource::fTrace.count());
326 #endif
327 } 317 }
328 318
329 void GrVkResourceProvider::abandonResources() { 319 void GrVkResourceProvider::abandonResources() {
330 // release our active command buffers 320 // release our active command buffers
331 for (int i = 0; i < fActiveCommandBuffers.count(); ++i) { 321 for (int i = 0; i < fActiveCommandBuffers.count(); ++i) {
332 SkASSERT(fActiveCommandBuffers[i]->finished(fGpu)); 322 SkASSERT(fActiveCommandBuffers[i]->finished(fGpu));
333 SkASSERT(fActiveCommandBuffers[i]->unique()); 323 SkASSERT(fActiveCommandBuffers[i]->unique());
334 fActiveCommandBuffers[i]->unrefAndAbandon(); 324 fActiveCommandBuffers[i]->unrefAndAbandon();
335 } 325 }
336 fActiveCommandBuffers.reset(); 326 fActiveCommandBuffers.reset();
(...skipping 24 matching lines...) Expand all
361 (*iter).unrefAndAbandon(); 351 (*iter).unrefAndAbandon();
362 } 352 }
363 fSamplers.reset(); 353 fSamplers.reset();
364 354
365 fPipelineStateCache->abandon(); 355 fPipelineStateCache->abandon();
366 356
367 fPipelineCache = VK_NULL_HANDLE; 357 fPipelineCache = VK_NULL_HANDLE;
368 358
369 fUniformDescLayout = VK_NULL_HANDLE; 359 fUniformDescLayout = VK_NULL_HANDLE;
370 fUniformDescPool->unrefAndAbandon(); 360 fUniformDescPool->unrefAndAbandon();
371
372 #ifdef SK_TRACE_VK_RESOURCES
373 if (GrVkResource::fTrace.count()) {
374 SkTDynamicHash<GrVkResource, uint32_t>::Iter iter(&GrVkResource::fTrace) ;
375 for (; !iter.done(); ++iter) {
376 (*iter).dumpInfo();
377 }
378 }
379 SkASSERT(0 == GrVkResource::fTrace.count());
380 #endif
381 } 361 }
382 362
383 //////////////////////////////////////////////////////////////////////////////// 363 ////////////////////////////////////////////////////////////////////////////////
384 364
385 GrVkResourceProvider::CompatibleRenderPassSet::CompatibleRenderPassSet( 365 GrVkResourceProvider::CompatibleRenderPassSet::CompatibleRenderPassSet(
386 const GrVkG pu* gpu, 366 const GrVkG pu* gpu,
387 const GrVkR enderTarget& target) 367 const GrVkR enderTarget& target)
388 : fLastReturnedIndex(0) { 368 : fLastReturnedIndex(0) {
389 fRenderPasses.emplace_back(new GrVkRenderPass()); 369 fRenderPasses.emplace_back(new GrVkRenderPass());
390 fRenderPasses[0]->initSimple(gpu, target); 370 fRenderPasses[0]->initSimple(gpu, target);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 406 }
427 407
428 void GrVkResourceProvider::CompatibleRenderPassSet::abandonResources() { 408 void GrVkResourceProvider::CompatibleRenderPassSet::abandonResources() {
429 for (int i = 0; i < fRenderPasses.count(); ++i) { 409 for (int i = 0; i < fRenderPasses.count(); ++i) {
430 if (fRenderPasses[i]) { 410 if (fRenderPasses[i]) {
431 fRenderPasses[i]->unrefAndAbandon(); 411 fRenderPasses[i]->unrefAndAbandon();
432 fRenderPasses[i] = nullptr; 412 fRenderPasses[i] = nullptr;
433 } 413 }
434 } 414 }
435 } 415 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkResource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698