You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trac3r-rust/doc/vulkano/pipeline/index.html

84 lines
13 KiB

5 years ago
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `pipeline` mod in crate `vulkano`."><meta name="keywords" content="rust, rustlang, rust-lang, pipeline"><title>vulkano::pipeline - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../vulkano/index.html'><div class='logo-container'><img src='https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png' alt='logo'></div></a><p class='location'>Module pipeline</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'><a href='../index.html'>vulkano</a></p><script>window.sidebarCurrent = {name: 'pipeline', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/vulkano/pipeline/mod.rs.html#10-99' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>vulkano</a>::<wbr><a class="mod" href=''>pipeline</a></span></h1><div class='docblock'><p>Describes a graphical or compute operation.</p>
<p>In Vulkan, before you can add a draw or a compute command to a command buffer you have to
create a <em>pipeline object</em> that describes this command.</p>
<p>When you create a pipeline object, the implementation will usually generate some GPU machine
code that will execute the operation (similar to a compiler that generates an executable for
the CPU). Consequently it is a CPU-intensive operation that should be performed at
initialization or during a loading screen.</p>
<p>There are two kinds of pipelines:</p>
<ul>
<li><code>ComputePipeline</code>s, for compute operations (general-purpose operations that read/write data
in buffers or raw pixels in images).</li>
<li><code>GraphicsPipeline</code>s, for graphical operations (operations that take vertices as input and
write pixels to a framebuffer).</li>
</ul>
<h1 id="creating-a-compute-pipeline" class="section-header"><a href="#creating-a-compute-pipeline">Creating a compute pipeline.</a></h1>
<p>In order to create a compute pipeline, you first need a <em>shader entry point</em>.</p>
<p>TODO: write the rest
For now vulkano has no &quot;clean&quot; way to create shaders ; everything's a bit hacky</p>
<h1 id="creating-a-graphics-pipeline" class="section-header"><a href="#creating-a-graphics-pipeline">Creating a graphics pipeline</a></h1>
<p>A graphics operation takes vertices or vertices and indices as input, and writes pixels to a
framebuffer. It consists of multiple steps:</p>
<ul>
<li>A <em>shader</em> named the <em>vertex shader</em> is run once for each vertex of the input.</li>
<li>Vertices are assembled into primitives.</li>
<li>Optionally, a shader named the <em>tessellation control shader</em> is run once for each primitive
and indicates the tessellation level to apply for this primitive.</li>
<li>Optionally, a shader named the <em>tessellation evaluation shader</em> is run once for each vertex,
including the ones newly created by the tessellation.</li>
<li>Optionally, a shader named the <em>geometry shader</em> is run once for each line or triangle.</li>
<li>The vertex coordinates (as outputted by the geometry shader, or by the tessellation
evaluation shader if there's no geometry shader, or by the vertex shader if there's no
geometry shader nor tessellation evaluation shader) are turned into screen-space coordinates.</li>
<li>The list of pixels that cover each triangle are determined.</li>
<li>A shader named the fragment shader is run once for each pixel that covers one of the
triangles.</li>
<li>The depth test and/or the stencil test are performed.</li>
<li>The output of the fragment shader is written to the framebuffer attachments, possibly by
mixing it with the existing values.</li>
</ul>
<p>All the sub-modules of this module (with the exception of <code>cache</code>) correspond to the various
stages of graphical pipelines.</p>
<blockquote>
<p><strong>Note</strong>: With the exception of the addition of the tessellation shaders and the geometry
shader, these steps haven't changed in the past decade. If you are familiar with shaders in
OpenGL 2 for example, don't worry as it works in the same in Vulkan.</p>
</blockquote>
<blockquote>
<p><strong>Note</strong>: All the stages that consist in executing a shader are performed by a microprocessor
(unless you happen to use a software implementation of Vulkan). As for the other stages,
some hardware (usually desktop graphics cards) have dedicated chips that will execute them
while some other hardware (usually mobile) perform them with the microprocessor as well. In
the latter situation, the implementation will usually glue these steps to your shaders.</p>
</blockquote>
<p>Creating a graphics pipeline follows the same principle as a compute pipeline, except that
you must pass multiple shaders alongside with configuration for the other steps.</p>
<p>TODO: add an example</p>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table><tr class='module-item'><td><a class="mod" href="blend/index.html" title='vulkano::pipeline::blend mod'>blend</a></td><td class='docblock-short'><p>Defines how the color output of the fragment shader is written to the attachment.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="cache/index.html" title='vulkano::pipeline::cache mod'>cache</a></td><td class='docblock-short'><p>Cache the pipeline objects to disk for faster reloads.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="depth_stencil/index.html" title='vulkano::pipeline::depth_stencil mod'>depth_stencil</a></td><td class='docblock-short'><p>Depth and stencil operations description.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="input_assembly/index.html" title='vulkano::pipeline::input_assembly mod'>input_assembly</a></td><td class='docblock-short'><p>Assembling vertices into primitives.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="multisample/index.html" title='vulkano::pipeline::multisample mod'>multisample</a></td><td class='docblock-short'><p>State of multisampling.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="raster/index.html" title='vulkano::pipeline::raster mod'>raster</a></td><td class='docblock-short'><p>Stage when triangles are turned into pixels.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="shader/index.html" title='vulkano::pipeline::shader mod'>shader</a></td><td class='docblock-short'><p>Stage of a graphics pipeline.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="vertex/index.html" title='vulkano::pipeline::vertex mod'>vertex</a></td><td class='docblock-short'><p>Vertex sources definition</p>
</td></tr><tr class='module-item'><td><a class="mod" href="viewport/index.html" title='vulkano::pipeline::viewport mod'>viewport</a></td><td class='docblock-short'><p>Viewports and scissor boxes.</p>
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.ComputePipeline.html" title='vulkano::pipeline::ComputePipeline struct'>ComputePipeline</a></td><td class='docblock-short'><p>A pipeline object that describes to the Vulkan implementation how it should perform compute
operations.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.ComputePipelineSys.html" title='vulkano::pipeline::ComputePipelineSys struct'>ComputePipelineSys</a></td><td class='docblock-short'><p>Opaque object that represents the inside of the compute pipeline. Can be made into a trait
object.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.GraphicsPipeline.html" title='vulkano::pipeline::GraphicsPipeline struct'>GraphicsPipeline</a></td><td class='docblock-short'><p>Defines how the implementation should perform a draw operation.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.GraphicsPipelineBuilder.html" title='vulkano::pipeline::GraphicsPipelineBuilder struct'>GraphicsPipelineBuilder</a></td><td class='docblock-short'><p>Prototype for a <code>GraphicsPipeline</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.GraphicsPipelineSys.html" title='vulkano::pipeline::GraphicsPipelineSys struct'>GraphicsPipelineSys</a></td><td class='docblock-short'><p>Opaque object that represents the inside of the graphics pipeline.</p>
</td></tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table><tr class='module-item'><td><a class="enum" href="enum.ComputePipelineCreationError.html" title='vulkano::pipeline::ComputePipelineCreationError enum'>ComputePipelineCreationError</a></td><td class='docblock-short'><p>Error that can happen when creating a compute pipeline.</p>
</td></tr><tr class='module-item'><td><a class="enum" href="enum.GraphicsPipelineCreationError.html" title='vulkano::pipeline::GraphicsPipelineCreationError enum'>GraphicsPipelineCreationError</a></td><td class='docblock-short'><p>Error that can happen when creating a graphics pipeline.</p>
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table><tr class='module-item'><td><a class="trait" href="trait.ComputePipelineAbstract.html" title='vulkano::pipeline::ComputePipelineAbstract trait'>ComputePipelineAbstract</a></td><td class='docblock-short'><p>Trait implemented on all compute pipelines.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.GraphicsPipelineAbstract.html" title='vulkano::pipeline::GraphicsPipelineAbstract trait'>GraphicsPipelineAbstract</a></td><td class='docblock-short'><p>Trait implemented on objects that reference a graphics pipeline. Can be made into a trait
object.
When using this trait <code>AutoCommandBufferBuilder::draw*</code> calls will need the buffers to be
wrapped in a <code>vec!()</code>.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "vulkano";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>