123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <!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 `BufferBuilder` struct in crate `ocl`.">
- <meta name="keywords" content="rust, rustlang, rust-lang, BufferBuilder">
- <title>ocl::builders::BufferBuilder - 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="../../main.css" id="themeStyle">
- <script src="../../storage.js"></script>
-
-
-
- </head>
- <body class="rustdoc struct">
- <!--[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">☰</div>
-
- <p class='location'>Struct BufferBuilder</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.context">context</a><a href="#method.queue">queue</a><a href="#method.flags">flags</a><a href="#method.use_host_slice">use_host_slice</a><a href="#method.copy_host_slice">copy_host_slice</a><a href="#method.len">len</a><a href="#method.fill_val">fill_val</a><a href="#method.fill_event">fill_event</a><a href="#method.build">build</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a></div></div><p class='location'><a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a></p><script>window.sidebarCurrent = {name: 'BufferBuilder', ty: 'struct', 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">
- <input class="search-input" name="search"
- autocomplete="off"
- placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
- type="search">
- </div>
- </form>
- </nav>
- <section id='main' class="content">
- <h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a>::<wbr><a class="struct" href=''>BufferBuilder</a></span><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'>−</span>]
- </a>
- </span><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2137-2143' title='goto source code'>[src]</a></span></h1>
- <pre class='rust struct'><div class="docblock attributes">#[must_use = "builders do nothing unless \'::build\' is called"]
- </div>pub struct BufferBuilder<'a, T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>, </span> { /* fields omitted */ }</pre><div class='docblock'><p>A buffer builder.</p>
- </div>
- <h2 id='methods' class='small-section-header'>
- Methods<a href='#methods' class='anchor'></a>
- </h2>
- <h3 id='impl' class='impl'><span class='in-band'><code>impl<'a, T> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> T: 'a + <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>, </span></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2145-2415' title='goto source code'>[src]</a></span></h3>
- <div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>() -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2147-2155' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Returns a new buffer builder.</p>
- </div><h4 id='method.context' class="method"><span id='context.v' class='invisible'><code>pub fn <a href='#method.context' class='fnname'>context</a><'o>(self, context: &'o <a class="struct" href="../../ocl/struct.Context.html" title="struct ocl::Context">Context</a>) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> 'o: 'a, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2162-2167' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Sets the context with which to associate the buffer.</p>
- <p>May not be used in conjunction with <a href="builders/struct.BufferBuilder.html#method.queue"><code>::queue</code></a> (use one or the other).</p>
- </div><h4 id='method.queue' class="method"><span id='queue.v' class='invisible'><code>pub fn <a href='#method.queue' class='fnname'>queue</a><'b>(self, default_queue: <a class="struct" href="../../ocl/struct.Queue.html" title="struct ocl::Queue">Queue</a>) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2192-2196' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Specifies the default queue used to be used by the buffer for all
- command enqueue operations (reads, writes, etc.).</p>
- <p>The default queue is the queue which will be used when enqueuing
- commands if no queue is specified.</p>
- <p>Without a default queue:</p>
- <div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
- <span class="ident">buffer</span>.<span class="ident">read</span>(<span class="ident">data</span>).<span class="ident">queue</span>(<span class="kw-2">&</span><span class="ident">queue</span>).<span class="ident">enq</span>()<span class="question-mark">?</span>;</pre>
- <p>With a default queue:</p>
- <div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
- <span class="ident">buffer</span>.<span class="ident">read</span>(<span class="ident">data</span>).<span class="ident">enq</span>()<span class="question-mark">?</span>;</pre>
- <p>If this is set, the context associated with the <code>default_queue</code> will
- be used when creating the buffer. Attempting to specify the context
- separately (by calling <a href="builders/struct.BufferBuilder.html#method.context"><code>::context</code></a>) will cause a panic.</p>
- </div><h4 id='method.flags' class="method"><span id='flags.v' class='invisible'><code>pub fn <a href='#method.flags' class='fnname'>flags</a><'b>(self, flags: <a class="struct" href="../../ocl/flags/struct.MemFlags.html" title="struct ocl::flags::MemFlags">MemFlags</a>) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2212-2218' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Sets the flags used when creating the buffer.</p>
- <p>Defaults to <code>flags::MEM_READ_WRITE</code> aka.
- <code>MemFlags::new().read_write()</code> if this is not set. See the <a href="https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateBuffer.html">SDK Docs</a>
- for more information about flags. Note that the names of all flags in
- this library have the <code>CL_</code> prefix removed for brevity.</p>
- <h3 id="panics" class="section-header"><a href="#panics">Panics</a></h3>
- <p>Due to its unsafety, setting the
- <code>MEM_USE_HOST_PTR</code>/<code>MemFlags::new()::use_host_ptr()</code> flag will cause a
- panic. Use the <code>::use_host_slice</code> method instead.</p>
- </div><h4 id='method.use_host_slice' class="method"><span id='use_host_slice.v' class='invisible'><code>pub unsafe fn <a href='#method.use_host_slice' class='fnname'>use_host_slice</a><'d>(<br> self, <br> host_slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'d [T]</a><br>) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> 'd: 'a, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2249-2255' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Specifies a region of host memory to use as storage for the buffer.</p>
- <p>OpenCL implementations are allowed to cache the buffer contents
- pointed to by <code>host_slice</code> in device memory. This cached copy can be
- used when kernels are executed on a device.</p>
- <p>The result of OpenCL commands that operate on multiple buffer objects
- created with the same <code>host_slice</code> or overlapping host regions is
- considered to be undefined</p>
- <p>Refer to the <a href="https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/dataTypes.html">description of the alignment</a> rules for
- <code>host_slice</code> for memory objects (buffer and images) created using
- this method.</p>
- <p>Automatically sets the <code>flags::MEM_USE_HOST_PTR</code> aka.
- <code>MemFlags::new().use_host_ptr()</code> flag.</p>
- <h3 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h3>
- <p><code>::copy_host_slice</code> or <code>::use_host_slice</code> must not have already been
- called.</p>
- <h3 id="safety" class="section-header"><a href="#safety">Safety</a></h3>
- <p>The caller must ensure that <code>host_slice</code> lives until the buffer is
- destroyed. The caller must also ensure that only one buffer uses
- <code>host_slice</code> and that it is not tampered with inappropriately.</p>
- </div><h4 id='method.copy_host_slice' class="method"><span id='copy_host_slice.v' class='invisible'><code>pub fn <a href='#method.copy_host_slice' class='fnname'>copy_host_slice</a><'d>(self, host_slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'d [T]</a>) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> 'd: 'a, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2267-2273' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Specifies a region of memory to copy into the buffer upon creation.</p>
- <p>Automatically sets the <code>flags::MEM_COPY_HOST_PTR</code> aka.
- <code>MemFlags::new().copy_host_ptr()</code> flag.</p>
- <h3 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h3>
- <p><code>::copy_host_slice</code> or <code>::use_host_slice</code> must not have already been
- called.</p>
- </div><h4 id='method.len' class="method"><span id='len.v' class='invisible'><code>pub fn <a href='#method.len' class='fnname'>len</a><'b, D>(self, len: D) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> D: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="../../ocl/enum.SpatialDims.html" title="enum ocl::SpatialDims">SpatialDims</a>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2281-2285' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Sets the length for this buffer.</p>
- <p>Note that although sizes in the standard OpenCL API are expressed in
- bytes, sizes, lengths, and dimensions in this library are always
- specified in <code>bytes / sizeof(T)</code> (like everything else in Rust) unless
- otherwise noted.</p>
- </div><h4 id='method.fill_val' class="method"><span id='fill_val.v' class='invisible'><code>pub fn <a href='#method.fill_val' class='fnname'>fill_val</a>(self, fill_val: T) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2306-2309' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Allows the caller to automatically fill the buffer with a value (such
- as zero) immediately after creation.</p>
- <p>Use <a href="builders/struct.BufferBuilder.html#method.fill_event"><code>::fill_event</code></a> to set an event associated with the completion of
- the fill command if you want it to execute asynchronously (it will
- otherwise block the calling thread).</p>
- <p>Platforms that have trouble with <code>clEnqueueFillBuffer</code> such as
- <a href="http://portablecl.org/">pocl</a> should not use this option and should
- handle initializing buffers manually (using a kernel or copy host data
- flag).</p>
- <h3 id="examples" class="section-header"><a href="#examples">Examples</a></h3>
- <ul>
- <li>TODO: Provide examples once this stabilizes.</li>
- </ul>
- <p>[UNSTABLE]: May be changed or removed.</p>
- </div><h4 id='method.fill_event' class="method"><span id='fill_event.v' class='invisible'><code>pub fn <a href='#method.fill_event' class='fnname'>fill_event</a><'b, 'e, En>(self, enew: En) -> <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> 'e: 'a,<br> En: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="../../ocl/builders/enum.ClNullEventPtrEnum.html" title="enum ocl::builders::ClNullEventPtrEnum">ClNullEventPtrEnum</a><'e>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2326-2334' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Specifies the (empty) event to use for association with the completion
- of the fill command.</p>
- <p><code>enew</code> specifies an empty event (generally a <code>&mut Event</code>) to be
- associated with the fill command which will be enqueued after creation
- and just before returning the new buffer. It is up to the caller to
- ensure that the command has completed before performing any other
- operations on the buffer. Failure to do so may cause the fill command
- to run <strong>after</strong> subsequently queued commands if multiple or
- out-of-order queues are being used.</p>
- <p>Not calling this method at all will cause the fill command to block
- before returning the new buffer and is the safe option if you don't
- want to worry about it.</p>
- </div><h4 id='method.build' class="method"><span id='build.v' class='invisible'><code>pub fn <a href='#method.build' class='fnname'>build</a>(self) -> <a class="type" href="../../ocl/error/type.Result.html" title="type ocl::error::Result">OclResult</a><<a class="struct" href="../../ocl/struct.Buffer.html" title="struct ocl::Buffer">Buffer</a><T>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2340-2414' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Creates a buffer and returns it.</p>
- <p>Dimensions and either a context or default queue must be specified
- before calling <code>::build</code>.</p>
- </div></div>
- <h2 id='implementations' class='small-section-header'>
- Trait Implementations<a href='#implementations' class='anchor'></a>
- </h2>
- <h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl<'a, T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../ocl/builders/struct.BufferBuilder.html" title="struct ocl::builders::BufferBuilder">BufferBuilder</a><'a, T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>, </span></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2136' title='goto source code'>[src]</a></span></h3>
- <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/buffer.rs.html#2136' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
- </div></div></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>⏎</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>
- </div>
- </div>
- </aside>
-
- <script>
- window.rootPath = "../../";
- window.currentCrate = "ocl";
- </script>
- <script src="../../main.js"></script>
- <script defer src="../../search-index.js"></script>
- </body>
- </html>
|