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

Unified Diff: src/gpu/vk/GrVkPipelineStateBuilder.cpp

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded assert 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGLSLSampler.h ('k') | src/gpu/vk/GrVkPipelineStateDataManager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkPipelineStateBuilder.cpp
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
index 2bd80033dd885bf71a1013bb3c848530a6861cdf..be30bb3e4df3ea6110f758b65d3f72e2e51e49c1 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -162,20 +162,18 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(GrPrimitiveType primitiveT
VkShaderModule vertShaderModule;
VkShaderModule fragShaderModule;
- uint32_t numSamplers = fSamplerUniforms.count();
+ uint32_t numSamplers = (uint32_t)fUniformHandler.numSamplers();
SkAutoTDeleteArray<VkDescriptorSetLayoutBinding> dsSamplerBindings(
new VkDescriptorSetLayoutBinding[numSamplers]);
for (uint32_t i = 0; i < numSamplers; ++i) {
- UniformHandle uniHandle = fSamplerUniforms[i];
- GrVkUniformHandler::UniformInfo uniformInfo = fUniformHandler.getUniformInfo(uniHandle);
- SkASSERT(kSampler2D_GrSLType == uniformInfo.fVariable.getType());
- SkASSERT(GrVkUniformHandler::kSamplerDescSet == uniformInfo.fSetNumber);
- SkASSERT(uniformInfo.fBinding == i);
- dsSamplerBindings[i].binding = uniformInfo.fBinding;
+ const GrVkGLSLSampler& sampler =
+ static_cast<const GrVkGLSLSampler&>(fUniformHandler.getSampler(i));
+ SkASSERT(sampler.binding() == i);
+ dsSamplerBindings[i].binding = sampler.binding();
dsSamplerBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
dsSamplerBindings[i].descriptorCount = 1;
- dsSamplerBindings[i].stageFlags = visibility_to_vk_stage_flags(uniformInfo.fVisibility);
+ dsSamplerBindings[i].stageFlags = visibility_to_vk_stage_flags(sampler.visibility());
dsSamplerBindings[i].pImmutableSamplers = nullptr;
}
@@ -184,11 +182,10 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(GrPrimitiveType primitiveT
dsSamplerLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
dsSamplerLayoutCreateInfo.pNext = nullptr;
dsSamplerLayoutCreateInfo.flags = 0;
- dsSamplerLayoutCreateInfo.bindingCount = fSamplerUniforms.count();
+ dsSamplerLayoutCreateInfo.bindingCount = numSamplers;
// Setting to nullptr fixes an error in the param checker validation layer. Even though
// bindingCount is 0 (which is valid), it still tries to validate pBindings unless it is null.
- dsSamplerLayoutCreateInfo.pBindings = fSamplerUniforms.count() ? dsSamplerBindings.get() :
- nullptr;
+ dsSamplerLayoutCreateInfo.pBindings = numSamplers ? dsSamplerBindings.get() : nullptr;
GR_VK_CALL_ERRCHECK(fGpu->vkInterface(),
CreateDescriptorSetLayout(fGpu->device(),
« no previous file with comments | « src/gpu/vk/GrVkGLSLSampler.h ('k') | src/gpu/vk/GrVkPipelineStateDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698