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 "vk/GrVkProgramBuilder.h" | 8 #include "vk/GrVkProgramBuilder.h" |
9 | 9 |
10 #include "vk/GrVkGpu.h" | 10 #include "vk/GrVkGpu.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (!pipeline) { | 278 if (!pipeline) { |
279 GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineLayout(fGpu->device(), pi
pelineLayout, | 279 GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineLayout(fGpu->device(), pi
pelineLayout, |
280 nullptr)); | 280 nullptr)); |
281 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device(
), dsLayout[0], | 281 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device(
), dsLayout[0], |
282 nullptr)); | 282 nullptr)); |
283 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device(
), dsLayout[1], | 283 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorSetLayout(fGpu->device(
), dsLayout[1], |
284 nullptr)); | 284 nullptr)); |
285 return nullptr; | 285 return nullptr; |
286 } | 286 } |
287 | 287 |
288 | |
289 GrVkDescriptorPool::DescriptorTypeCounts typeCounts; | |
290 typeCounts.setTypeCount(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2); | |
291 SkASSERT(numSamplers < 256); | |
292 typeCounts.setTypeCount(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, (uint8_t)
numSamplers); | |
293 GrVkDescriptorPool* descriptorPool = | |
294 fGpu->resourceProvider().findOrCreateCompatibleDescriptorPool(typeCounts
); | |
295 | |
296 VkDescriptorSetAllocateInfo dsAllocateInfo; | |
297 memset(&dsAllocateInfo, 0, sizeof(VkDescriptorSetAllocateInfo)); | |
298 dsAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; | |
299 dsAllocateInfo.pNext = nullptr; | |
300 dsAllocateInfo.descriptorPool = descriptorPool->descPool(); | |
301 dsAllocateInfo.descriptorSetCount = 2; | |
302 dsAllocateInfo.pSetLayouts = dsLayout; | |
303 | |
304 VkDescriptorSet descriptorSets[2]; | |
305 GR_VK_CALL_ERRCHECK(fGpu->vkInterface(), AllocateDescriptorSets(fGpu->device
(), | |
306 &dsAllocateI
nfo, | |
307 descriptorSe
ts)); | |
308 | |
309 return new GrVkProgram(fGpu, | 288 return new GrVkProgram(fGpu, |
310 pipeline, | 289 pipeline, |
311 pipelineLayout, | 290 pipelineLayout, |
312 dsLayout, | 291 dsLayout, |
313 descriptorPool, | |
314 descriptorSets, | |
315 fUniformHandles, | 292 fUniformHandles, |
316 fUniformHandler.fUniforms, | 293 fUniformHandler.fUniforms, |
317 fUniformHandler.fCurrentVertexUBOOffset, | 294 fUniformHandler.fCurrentVertexUBOOffset, |
318 fUniformHandler.fCurrentFragmentUBOOffset, | 295 fUniformHandler.fCurrentFragmentUBOOffset, |
319 numSamplers, | 296 numSamplers, |
320 fGeometryProcessor, | 297 fGeometryProcessor, |
321 fXferProcessor, | 298 fXferProcessor, |
322 fFragmentProcessors); | 299 fFragmentProcessors); |
323 } | 300 } |
OLD | NEW |