Dealing with multiple pipelines in Vulkan

#1

hello there.
I would like to get some tips on how to deal with the following situation :
I render a scene composed of multiple meshes.
Some meshes have textures (considering only diffuse texture), others don’t. So I created two different pipelines for each “kind” of mesh, Each pipeline one with a different shader. One that uses diffuse texture, other tha don’t use diffuse texture.

VkPipelineLayout pipeline;

if (gameObjects[z]->meshes[x].material->hasTexture) {
	pipeline = pipelineWithTexturelayout;
	std::array<VkDescriptorSet, 3> descriptorSets;

	descriptorSets[0] = gameObjects[z]->descriptorSet;

	descriptorSets[1] = gameObjects[z]->meshes[x].material->descriptorSet;

	descriptorSets[2] = LightdescriptorSetScene;

	vkCmdBindPipeline(commandBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineWithTexture);

	vkCmdBindDescriptorSets(commandBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineWithTexturelayout, 0, static_cast<uint32_t>(descriptorSets.size()), descriptorSets.data(), 0, NULL);
}

else {
	pipeline = pipelineTextureLessLayout;

	std::array<VkDescriptorSet, 2> descriptorSets;

	descriptorSets[0] = gameObjects[z]->descriptorSet;

	descriptorSets[1] = LightdescriptorSetScene;

	vkCmdBindPipeline(commandBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineTextureLess);
	vkCmdBindDescriptorSets(commandBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineTextureLessLayout, 0, static_cast<uint32_t>(descriptorSets.size()), descriptorSets.data(), 0, NULL);
}

I know this is not a good solution.
Now, I want to use other kinds of textures like normal map. Now Some meshes don’t have diffuse texture but have normal maps. So following my strategy it wouldn’t be viable to deal with this It would require to create a combination of different pipelines…

Can Anyone give me a view on that.
I’m sorry if I didn’t made myself clear.