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

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

Issue 1867883002: Fix a bunch of memory issues in Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@vkValgrind
Patch Set: Created 4 years, 8 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 "GrVkPipelineState.h" 8 #include "GrVkPipelineState.h"
9 9
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 fNumSamplers = numSamplers; 73 fNumSamplers = numSamplers;
74 } 74 }
75 75
76 GrVkPipelineState::~GrVkPipelineState() { 76 GrVkPipelineState::~GrVkPipelineState() {
77 // Must of freed all GPU resources before this is destroyed 77 // Must of freed all GPU resources before this is destroyed
78 SkASSERT(!fPipeline); 78 SkASSERT(!fPipeline);
79 SkASSERT(!fPipelineLayout); 79 SkASSERT(!fPipelineLayout);
80 SkASSERT(!fSamplers.count()); 80 SkASSERT(!fSamplers.count());
81 SkASSERT(!fTextureViews.count()); 81 SkASSERT(!fTextureViews.count());
82 SkASSERT(!fTextures.count()); 82 SkASSERT(!fTextures.count());
83 for (int i = 0; i < fFragmentProcessors.count(); ++i) {
84 delete fFragmentProcessors[i];
85 }
83 } 86 }
84 87
85 void GrVkPipelineState::freeTempResources(const GrVkGpu* gpu) { 88 void GrVkPipelineState::freeTempResources(const GrVkGpu* gpu) {
86 for (int i = 0; i < fSamplers.count(); ++i) { 89 for (int i = 0; i < fSamplers.count(); ++i) {
87 fSamplers[i]->unref(gpu); 90 fSamplers[i]->unref(gpu);
88 } 91 }
89 fSamplers.rewind(); 92 fSamplers.rewind();
90 93
91 for (int i = 0; i < fTextureViews.count(); ++i) { 94 for (int i = 0; i < fTextureViews.count(); ++i) {
92 fTextureViews[i]->unref(gpu); 95 fTextureViews[i]->unref(gpu);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 497
495 b.add32(get_blend_info_key(pipeline)); 498 b.add32(get_blend_info_key(pipeline));
496 499
497 b.add32(primitiveType); 500 b.add32(primitiveType);
498 501
499 // Set key length 502 // Set key length
500 int keyLength = key->count(); 503 int keyLength = key->count();
501 SkASSERT(0 == (keyLength % 4)); 504 SkASSERT(0 == (keyLength % 4));
502 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); 505 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
503 } 506 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698