parent
							
								
									3e1ec8deac
								
							
						
					
					
						commit
						3bcee3c01a
					
				| 
						 | 
				
			
			@ -764,7 +764,7 @@ void VulkanExample::getEnabledFeatures()
 | 
			
		|||
			// Bind scene matrices descriptor to set 0
 | 
			
		||||
			vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.pbrLayout, 0, 1, &descriptorSet, 0, nullptr);
 | 
			
		||||
			vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.pbrLayout, 6, 1, &skinDescriptorSet, 0, nullptr);
 | 
			
		||||
			vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, wireframe ? wireframePipeline : solidPipeline);
 | 
			
		||||
			vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, wireframe ? pipelines.wireframe : pipelines.solid);
 | 
			
		||||
			glTFModel.draw(drawCmdBuffers[i], pipelineLayouts.pbrLayout);
 | 
			
		||||
			vkCmdEndRenderPass(drawCmdBuffers[i]);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -781,7 +781,7 @@ void VulkanExample::getEnabledFeatures()
 | 
			
		|||
				vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
 | 
			
		||||
				vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
 | 
			
		||||
				vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.tonemappingLayout, 0, 1, &tonemappingDescriptorSet, 0, NULL);
 | 
			
		||||
				vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, toneMappingPipeline);
 | 
			
		||||
				vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.toneMapping);
 | 
			
		||||
				vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0);
 | 
			
		||||
				drawUI(drawCmdBuffers[i]);
 | 
			
		||||
				vkCmdEndRenderPass(drawCmdBuffers[i]);
 | 
			
		||||
| 
						 | 
				
			
			@ -1068,13 +1068,13 @@ void VulkanExample::getEnabledFeatures()
 | 
			
		|||
		pipelineCI.pStages = shaderStages.data();
 | 
			
		||||
 | 
			
		||||
		// Solid rendering pipeline
 | 
			
		||||
		VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &solidPipeline));
 | 
			
		||||
		VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.solid));
 | 
			
		||||
 | 
			
		||||
		// Wire frame rendering pipeline
 | 
			
		||||
		if (deviceFeatures.fillModeNonSolid) {
 | 
			
		||||
			rasterizationStateCI.polygonMode = VK_POLYGON_MODE_LINE;
 | 
			
		||||
			rasterizationStateCI.lineWidth = 1.0f;
 | 
			
		||||
			VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &wireframePipeline));
 | 
			
		||||
			VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.wireframe));
 | 
			
		||||
		}
 | 
			
		||||
		//Create Tone Mapping render pipeline
 | 
			
		||||
		prepareToneMappingPipeline();
 | 
			
		||||
| 
						 | 
				
			
			@ -1082,10 +1082,10 @@ void VulkanExample::getEnabledFeatures()
 | 
			
		|||
 | 
			
		||||
	void VulkanExample::prepareToneMappingPipeline()
 | 
			
		||||
	{
 | 
			
		||||
		if (toneMappingPipeline != VK_NULL_HANDLE)
 | 
			
		||||
		if (pipelines.toneMapping != VK_NULL_HANDLE)
 | 
			
		||||
		{
 | 
			
		||||
			vkDestroyPipeline(device, toneMappingPipeline, nullptr);
 | 
			
		||||
			toneMappingPipeline = VK_NULL_HANDLE;
 | 
			
		||||
			vkDestroyPipeline(device, pipelines.toneMapping, nullptr);
 | 
			
		||||
			pipelines.toneMapping = VK_NULL_HANDLE;
 | 
			
		||||
		}
 | 
			
		||||
		VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
 | 
			
		||||
		VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1116,7 +1116,7 @@ void VulkanExample::getEnabledFeatures()
 | 
			
		|||
		pipelineCI.stageCount = static_cast<uint32_t>(shaderStages.size());
 | 
			
		||||
		pipelineCI.pStages = shaderStages.data();
 | 
			
		||||
 | 
			
		||||
		VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &toneMappingPipeline));
 | 
			
		||||
		VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.toneMapping));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Prepare and initialize uniform buffer containing shader uniforms
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -254,11 +254,11 @@ public:
 | 
			
		|||
		VkDeviceMemory memory;
 | 
			
		||||
	} vertexStaging, indexStaging;
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
		VkPipeline solidPipeline;
 | 
			
		||||
		VkPipeline wireframePipeline = VK_NULL_HANDLE;
 | 
			
		||||
		VkPipeline toneMappingPipeline = VK_NULL_HANDLE;
 | 
			
		||||
	
 | 
			
		||||
	struct Pipelines {
 | 
			
		||||
		VkPipeline solid;
 | 
			
		||||
		VkPipeline wireframe = VK_NULL_HANDLE;
 | 
			
		||||
		VkPipeline toneMapping = VK_NULL_HANDLE;
 | 
			
		||||
	} pipelines;
 | 
			
		||||
 | 
			
		||||
	struct  PipelineLayouts
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -359,10 +359,10 @@ public:
 | 
			
		|||
	{
 | 
			
		||||
		// Clean up used Vulkan resources
 | 
			
		||||
		// Note : Inherited destructor cleans up resources stored in base class
 | 
			
		||||
		vkDestroyPipeline(device, solidPipeline, nullptr);
 | 
			
		||||
		vkDestroyPipeline(device, toneMappingPipeline, nullptr);
 | 
			
		||||
		if (wireframePipeline != VK_NULL_HANDLE) {
 | 
			
		||||
			vkDestroyPipeline(device, wireframePipeline, nullptr);
 | 
			
		||||
		vkDestroyPipeline(device, pipelines.solid, nullptr);
 | 
			
		||||
		vkDestroyPipeline(device, pipelines.toneMapping, nullptr);
 | 
			
		||||
		if (pipelines.wireframe != VK_NULL_HANDLE) {
 | 
			
		||||
			vkDestroyPipeline(device, pipelines.wireframe, nullptr);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		vkDestroyPipelineLayout(device, pipelineLayouts.pbrLayout, nullptr);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue