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/vertex/index.html

60 lines
12 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 `vertex` mod in crate `vulkano`."><meta name="keywords" content="rust, rustlang, rust-lang, vertex"><title>vulkano::pipeline::vertex - 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 vertex</p><div class="sidebar-elems"><div class="block items"><ul><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>::<wbr><a href='../index.html'>pipeline</a></p><script>window.sidebarCurrent = {name: 'vertex', 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/vertex/mod.rs.html#10-89' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>vulkano</a>::<wbr><a href='../index.html'>pipeline</a>::<wbr><a class="mod" href=''>vertex</a></span></h1><div class='docblock'><h1 id="vertex-sources-definition" class="section-header"><a href="#vertex-sources-definition">Vertex sources definition</a></h1>
<p>When you create a graphics pipeline object, you need to pass an object which indicates the
layout of the vertex buffer(s) that will serve as input for the vertex shader. This is done
by passing an implementation of the <code>VertexDefinition</code> trait.</p>
<p>In addition to this, the object that you pass when you create the graphics pipeline must also
implement the <code>VertexSource</code> trait. This trait has a template parameter which corresponds to the
list of vertex buffers.</p>
<p>The vulkano library provides some structs that already implement these traits.
The most common situation is a single vertex buffer and no instancing, in which case you can
pass a <code>SingleBufferDefinition</code> when you create the pipeline.</p>
<h1 id="implementing-vertex" class="section-header"><a href="#implementing-vertex">Implementing <code>Vertex</code></a></h1>
<p>The implementations of the <code>VertexDefinition</code> trait that are provided by vulkano (like
<code>SingleBufferDefinition</code>) require you to use a buffer whose content is <code>[V]</code> where <code>V</code>
implements the <code>Vertex</code> trait.</p>
<p>The <code>Vertex</code> trait is unsafe, but can be implemented on a struct with the <code>impl_vertex!</code>
macro.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">use</span> <span class="ident">vulkano</span>::<span class="ident">buffer</span>::<span class="ident">BufferAccess</span>;
<span class="kw">use</span> <span class="ident">vulkano</span>::<span class="ident">buffer</span>::<span class="ident">BufferUsage</span>;
<span class="kw">use</span> <span class="ident">vulkano</span>::<span class="ident">memory</span>::<span class="ident">HostVisible</span>;
<span class="kw">use</span> <span class="ident">vulkano</span>::<span class="ident">pipeline</span>::<span class="ident">vertex</span>::;
<span class="kw">struct</span> <span class="ident">Vertex</span> {
<span class="ident">position</span>: [<span class="ident">f32</span>; <span class="number">2</span>]
}
<span class="macro">impl_vertex</span><span class="macro">!</span>(<span class="ident">Vertex</span>, <span class="ident">position</span>);
<span class="kw">let</span> <span class="ident">usage</span> <span class="op">=</span> <span class="ident">BufferUsage</span> {
<span class="ident">vertex_buffer</span>: <span class="bool-val">true</span>,
.. <span class="ident">BufferUsage</span>::<span class="ident">none</span>()
};
<span class="kw">let</span> <span class="ident">vertex_buffer</span> <span class="op">=</span> <span class="ident">BufferAccess</span>::<span class="op">&lt;</span>[<span class="ident">Vertex</span>], <span class="kw">_</span><span class="op">&gt;</span>::<span class="ident">array</span>(<span class="kw-2">&amp;</span><span class="ident">device</span>, <span class="number">128</span>, <span class="kw-2">&amp;</span><span class="ident">usage</span>, <span class="ident">HostVisible</span>, <span class="kw-2">&amp;</span><span class="ident">queue</span>)
.<span class="ident">expect</span>(<span class="string">&quot;failed to create buffer&quot;</span>);
<span class="comment">// TODO: finish example</span></pre></div>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.AttributeInfo.html" title='vulkano::pipeline::vertex::AttributeInfo struct'>AttributeInfo</a></td><td class='docblock-short'><p>Information about a single attribute within a vertex.
TODO: change that API</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.BufferlessDefinition.html" title='vulkano::pipeline::vertex::BufferlessDefinition struct'>BufferlessDefinition</a></td><td class='docblock-short'><p>Implementation of <code>VertexDefinition</code> for drawing with no buffers at all.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.BufferlessVertices.html" title='vulkano::pipeline::vertex::BufferlessVertices struct'>BufferlessVertices</a></td><td class='docblock-short'><p>Value to be passed as the vertex source for bufferless draw commands.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.OneVertexOneInstanceDefinition.html" title='vulkano::pipeline::vertex::OneVertexOneInstanceDefinition struct'>OneVertexOneInstanceDefinition</a></td><td class='docblock-short'><p>Unstable.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.SingleBufferDefinition.html" title='vulkano::pipeline::vertex::SingleBufferDefinition struct'>SingleBufferDefinition</a></td><td class='docblock-short'><p>Implementation of <code>VertexDefinition</code> for a single vertex buffer.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.SingleInstanceBufferDefinition.html" title='vulkano::pipeline::vertex::SingleInstanceBufferDefinition struct'>SingleInstanceBufferDefinition</a></td><td class='docblock-short'><p>Same as <code>SingleBufferDefinition</code> but advances by instance.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.TwoBuffersDefinition.html" title='vulkano::pipeline::vertex::TwoBuffersDefinition struct'>TwoBuffersDefinition</a></td><td class='docblock-short'><p>Unstable.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.VertexMemberInfo.html" title='vulkano::pipeline::vertex::VertexMemberInfo struct'>VertexMemberInfo</a></td><td class='docblock-short'><p>Information about a member of a vertex struct.</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.IncompatibleVertexDefinitionError.html" title='vulkano::pipeline::vertex::IncompatibleVertexDefinitionError enum'>IncompatibleVertexDefinitionError</a></td><td class='docblock-short'><p>Error that can happen when the vertex definition doesn't match the input of the vertex shader.</p>
</td></tr><tr class='module-item'><td><a class="enum" href="enum.InputRate.html" title='vulkano::pipeline::vertex::InputRate enum'>InputRate</a></td><td class='docblock-short'><p>How the vertex source should be unrolled.</p>
</td></tr><tr class='module-item'><td><a class="enum" href="enum.VertexMemberTy.html" title='vulkano::pipeline::vertex::VertexMemberTy enum'>VertexMemberTy</a></td><td class='docblock-short'><p>Type of a member of a vertex struct.</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.Vertex.html" title='vulkano::pipeline::vertex::Vertex trait'>Vertex</a></td><td class='docblock-short'><p>Describes an individual <code>Vertex</code>. In other words a collection of attributes that can be read
from a vertex shader.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.VertexDefinition.html" title='vulkano::pipeline::vertex::VertexDefinition trait'>VertexDefinition</a></td><td class='docblock-short'><p>Trait for types that describe the definition of the vertex input used by a graphics pipeline.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.VertexMember.html" title='vulkano::pipeline::vertex::VertexMember trait'>VertexMember</a></td><td class='docblock-short'><p>Trait for data types that can be used as vertex members. Used by the <code>impl_vertex!</code> macro.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.VertexSource.html" title='vulkano::pipeline::vertex::VertexSource trait'>VertexSource</a></td><td class='docblock-short'><p>Extension trait of <code>VertexDefinition</code>. The <code>L</code> parameter is an acceptable vertex source for this
vertex definition.</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>