| 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 "GrVkProgram.h" | 8 #include "GrVkProgram.h" |
| 9 | 9 |
| 10 #include "GrPipeline.h" | 10 #include "GrPipeline.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 fPipeline = nullptr; | 93 fPipeline = nullptr; |
| 94 } | 94 } |
| 95 if (fDescriptorPool) { | 95 if (fDescriptorPool) { |
| 96 fDescriptorPool->unref(gpu); | 96 fDescriptorPool->unref(gpu); |
| 97 fDescriptorPool = nullptr; | 97 fDescriptorPool = nullptr; |
| 98 } | 98 } |
| 99 if (fPipelineLayout) { | 99 if (fPipelineLayout) { |
| 100 GR_VK_CALL(gpu->vkInterface(), DestroyPipelineLayout(gpu->device(), | 100 GR_VK_CALL(gpu->vkInterface(), DestroyPipelineLayout(gpu->device(), |
| 101 fPipelineLayout, | 101 fPipelineLayout, |
| 102 nullptr)); | 102 nullptr)); |
| 103 fPipelineLayout = nullptr; | 103 fPipelineLayout = VK_NULL_HANDLE; |
| 104 } | 104 } |
| 105 | 105 |
| 106 if (fDSLayout[0]) { | 106 if (fDSLayout[0]) { |
| 107 GR_VK_CALL(gpu->vkInterface(), DestroyDescriptorSetLayout(gpu->device(),
fDSLayout[0], | 107 GR_VK_CALL(gpu->vkInterface(), DestroyDescriptorSetLayout(gpu->device(),
fDSLayout[0], |
| 108 nullptr)); | 108 nullptr)); |
| 109 fDSLayout[0] = nullptr; | 109 fDSLayout[0] = VK_NULL_HANDLE; |
| 110 } | 110 } |
| 111 if (fDSLayout[1]) { | 111 if (fDSLayout[1]) { |
| 112 GR_VK_CALL(gpu->vkInterface(), DestroyDescriptorSetLayout(gpu->device(),
fDSLayout[1], | 112 GR_VK_CALL(gpu->vkInterface(), DestroyDescriptorSetLayout(gpu->device(),
fDSLayout[1], |
| 113 nullptr)); | 113 nullptr)); |
| 114 fDSLayout[1] = nullptr; | 114 fDSLayout[1] = VK_NULL_HANDLE; |
| 115 } | 115 } |
| 116 | 116 |
| 117 if (fVertexUniformBuffer) { | 117 if (fVertexUniformBuffer) { |
| 118 fVertexUniformBuffer->release(gpu); | 118 fVertexUniformBuffer->release(gpu); |
| 119 } | 119 } |
| 120 | 120 |
| 121 if (fFragmentUniformBuffer) { | 121 if (fFragmentUniformBuffer) { |
| 122 fFragmentUniformBuffer->release(gpu); | 122 fFragmentUniformBuffer->release(gpu); |
| 123 } | 123 } |
| 124 this->freeTempResources(gpu); | 124 this->freeTempResources(gpu); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void GrVkProgram::abandonGPUResources() { | 127 void GrVkProgram::abandonGPUResources() { |
| 128 fPipeline->unrefAndAbandon(); | 128 fPipeline->unrefAndAbandon(); |
| 129 fPipeline = nullptr; | 129 fPipeline = nullptr; |
| 130 fDescriptorPool->unrefAndAbandon(); | 130 fDescriptorPool->unrefAndAbandon(); |
| 131 fDescriptorPool = nullptr; | 131 fDescriptorPool = nullptr; |
| 132 fPipelineLayout = nullptr; | 132 fPipelineLayout = VK_NULL_HANDLE; |
| 133 fDSLayout[0] = nullptr; | 133 fDSLayout[0] = VK_NULL_HANDLE; |
| 134 fDSLayout[1] = nullptr; | 134 fDSLayout[1] = VK_NULL_HANDLE; |
| 135 | 135 |
| 136 fVertexUniformBuffer->abandon(); | 136 fVertexUniformBuffer->abandon(); |
| 137 fFragmentUniformBuffer->abandon(); | 137 fFragmentUniformBuffer->abandon(); |
| 138 | 138 |
| 139 for (int i = 0; i < fSamplers.count(); ++i) { | 139 for (int i = 0; i < fSamplers.count(); ++i) { |
| 140 fSamplers[i]->unrefAndAbandon(); | 140 fSamplers[i]->unrefAndAbandon(); |
| 141 } | 141 } |
| 142 fSamplers.rewind(); | 142 fSamplers.rewind(); |
| 143 | 143 |
| 144 for (int i = 0; i < fTextureViews.count(); ++i) { | 144 for (int i = 0; i < fTextureViews.count(); ++i) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 for (int i = 0; i < fTextureViews.count(); ++i) { | 359 for (int i = 0; i < fTextureViews.count(); ++i) { |
| 360 commandBuffer.addResource(fTextureViews[i]); | 360 commandBuffer.addResource(fTextureViews[i]); |
| 361 } | 361 } |
| 362 | 362 |
| 363 for (int i = 0; i < fTextures.count(); ++i) { | 363 for (int i = 0; i < fTextures.count(); ++i) { |
| 364 commandBuffer.addResource(fTextures[i]); | 364 commandBuffer.addResource(fTextures[i]); |
| 365 } | 365 } |
| 366 #endif | 366 #endif |
| 367 } | 367 } |
| OLD | NEW |