コード例 #1
0
	// Creates the graphics pipeline object
	void create_pipeline() {
		// Vulkan shader stage descriptors
		auto shader_stage_descriptors = get_layout().shader_stage_descriptors();

		// Blend operation descriptor for each attachment
		lib::vector<vk::vk_blend_op_descriptor> attachment_blend_ops;
		for (auto &a : fb_layout) {
			const framebuffer_attachment_layout &attachment = a.second;

			// Blend operation is only applicable for color attachments
			const bool is_depth_attachment = format_is_depth(attachment.image_format);
			if (is_depth_attachment)
				continue;

			vk::vk_blend_op_descriptor desc = attachment.blend;
			attachment_blend_ops.push_back(std::move(desc));
		}

		// Set viewport and scissor as dynamic states
		lib::vector<VkDynamicState> dynamic_states = {
			static_cast<VkDynamicState>(pipeline_dynamic_state::viewport),
			static_cast<VkDynamicState>(pipeline_dynamic_state::scissor),
		};

		// Create the graphics pipeline object
		graphics_pipeline.emplace(ctx.get().device(),
								  shader_stage_descriptors,
								  get_layout(),
								  device_renderpass.get(),
								  0,
								  VkViewport{},
								  VkRect2D{},
								  vertex_input_descriptor.vertex_input_binding_descriptors,
								  vertex_input_descriptor.vertex_input_attribute_descriptors,
								  static_cast<VkPrimitiveTopology>(pipeline_settings.topology),
								  pipeline_settings.rasterizer_op,
								  pipeline_settings.depth_op,
								  attachment_blend_ops,
								  pipeline_settings.blend_constants,
								  dynamic_states,
								  pipeline_name.data(),
								  &ctx.get().device().pipeline_cache().current_thread_cache());
	}
コード例 #2
0
	bool has_depth() const
	{
		return format_is_depth(depth_stencil);
	}