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

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

Issue 1765923002: Add DescriptorPool and set manager to GrVkProgram (Closed) Base URL: https://skia.googlesource.com/skia.git@samplerDesc
Patch Set: rebase Created 4 years, 9 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/GrVkProgram.cpp ('k') | src/gpu/vk/GrVkResourceProvider.h » ('j') | 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 "vk/GrVkProgramBuilder.h" 8 #include "vk/GrVkProgramBuilder.h"
9 9
10 #include "vk/GrVkGpu.h" 10 #include "vk/GrVkGpu.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 if (!pipeline) { 265 if (!pipeline) {
266 GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineLayout(fGpu->device(), pi pelineLayout, 266 GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineLayout(fGpu->device(), pi pelineLayout,
267 nullptr)); 267 nullptr));
268 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device( ), dsLayout[0], 268 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device( ), dsLayout[0],
269 nullptr)); 269 nullptr));
270 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device( ), dsLayout[1], 270 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device( ), dsLayout[1],
271 nullptr)); 271 nullptr));
272 return nullptr; 272 return nullptr;
273 } 273 }
274 274
275
276 GrVkDescriptorPool::DescriptorTypeCounts typeCounts;
277 typeCounts.setTypeCount(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2);
278 SkASSERT(numSamplers < 256);
279 typeCounts.setTypeCount(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, (uint8_t) numSamplers);
280 GrVkDescriptorPool* descriptorPool =
281 fGpu->resourceProvider().findOrCreateCompatibleDescriptorPool(typeCounts );
282
283 VkDescriptorSetAllocateInfo dsAllocateInfo;
284 memset(&dsAllocateInfo, 0, sizeof(VkDescriptorSetAllocateInfo));
285 dsAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
286 dsAllocateInfo.pNext = nullptr;
287 dsAllocateInfo.descriptorPool = descriptorPool->descPool();
288 dsAllocateInfo.descriptorSetCount = 2;
289 dsAllocateInfo.pSetLayouts = dsLayout;
290
291 VkDescriptorSet descriptorSets[2];
292 GR_VK_CALL_ERRCHECK(fGpu->vkInterface(), AllocateDescriptorSets(fGpu->device (),
293 &dsAllocateI nfo,
294 descriptorSe ts));
295
296 return new GrVkProgram(fGpu, 275 return new GrVkProgram(fGpu,
297 pipeline, 276 pipeline,
298 pipelineLayout, 277 pipelineLayout,
299 dsLayout, 278 dsLayout,
300 descriptorPool,
301 descriptorSets,
302 fUniformHandles, 279 fUniformHandles,
303 fUniformHandler.fUniforms, 280 fUniformHandler.fUniforms,
304 fUniformHandler.fCurrentVertexUBOOffset, 281 fUniformHandler.fCurrentVertexUBOOffset,
305 fUniformHandler.fCurrentFragmentUBOOffset, 282 fUniformHandler.fCurrentFragmentUBOOffset,
306 numSamplers, 283 numSamplers,
307 fGeometryProcessor, 284 fGeometryProcessor,
308 fXferProcessor, 285 fXferProcessor,
309 fFragmentProcessors); 286 fFragmentProcessors);
310 } 287 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkProgram.cpp ('k') | src/gpu/vk/GrVkResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698