struct.ImageBuilder.html 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `ImageBuilder` struct in crate `ocl`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, ImageBuilder">
  9. <title>ocl::builders::ImageBuilder - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
  14. <script src="../../storage.js"></script>
  15. </head>
  16. <body class="rustdoc struct">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Struct ImageBuilder</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.channel_order">channel_order</a><a href="#method.channel_data_type">channel_data_type</a><a href="#method.image_type">image_type</a><a href="#method.dims">dims</a><a href="#method.array_size">array_size</a><a href="#method.row_pitch_bytes">row_pitch_bytes</a><a href="#method.slc_pitch_bytes">slc_pitch_bytes</a><a href="#method.buffer_sync">buffer_sync</a><a href="#method.image_format">image_format</a><a href="#method.image_desc">image_desc</a><a href="#method.build">build</a></div></div><p class='location'><a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a></p><script>window.sidebarCurrent = {name: 'ImageBuilder', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <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=''>ImageBuilder</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../../src/ocl/standard/image.rs.html#1006-1013' title='goto source code'>[src]</a></span></h1>
  50. <pre class='rust struct'><div class="docblock attributes">#[must_use = "builders do nothing unless \'::build\' is called"]
  51. </div>pub struct ImageBuilder&lt;'a, T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'a,&nbsp;</span> { /* fields omitted */ }</pre><div class='docblock'><p>A builder for <code>Image</code>.</p>
  52. </div>
  53. <h2 id='methods' class='small-section-header'>
  54. Methods<a href='#methods' class='anchor'></a>
  55. </h2>
  56. <h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;'a, T&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'a + <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>,&nbsp;</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/image.rs.html#1016-1359' title='goto source code'>[src]</a></span></h3>
  57. <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>() -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1049-1058' title='goto source code'>[src]</a></span></h4>
  58. <div class='docblock'><p>Returns a new <code>ImageBuilder</code> with very basic defaults.</p>
  59. <h2 id="defaults" class="section-header"><a href="#defaults">Defaults</a></h2>
  60. <ul>
  61. <li>Flags:</li>
  62. </ul>
  63. <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">
  64. <span class="ident">ocl</span>::<span class="ident">MEM_READ_WRITE</span></pre>
  65. <ul>
  66. <li>Image Format:</li>
  67. </ul>
  68. <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">
  69. <span class="ident">ocl</span>::<span class="ident">ImageFormat</span> {
  70. <span class="ident">channel_order</span>: <span class="ident">ocl</span>::<span class="ident">ImageChannelOrder</span>::<span class="ident">Rgba</span>,
  71. <span class="ident">channel_data_type</span>: <span class="ident">ocl</span>::<span class="ident">ImageChannelDataType</span>::<span class="ident">SnormInt8</span>,
  72. }</pre>
  73. <ul>
  74. <li>Descriptor (stores everything else - width, height, pitch, etc.):</li>
  75. </ul>
  76. <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">
  77. <span class="ident">ImageDescriptor</span>::<span class="ident">new</span>(<span class="ident">MemObjectType</span>::<span class="ident">Image1d</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="prelude-val">None</span>)</pre>
  78. <h2 id="reference" class="section-header"><a href="#reference">Reference</a></h2>
  79. <p>See the [official SDK documentation] for more information.</p>
  80. <p>Some descriptions here are adapted from various SDK docs.</p>
  81. </div><h4 id='method.context' class="method"><span id='context.v' class='invisible'><code>pub fn <a href='#method.context' class='fnname'>context</a>&lt;'o&gt;(self, context: &amp;'o <a class="struct" href="../../ocl/struct.Context.html" title="struct ocl::Context">Context</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'o: 'a,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1063-1068' title='goto source code'>[src]</a></span></h4>
  82. <div class='docblock'><p>Sets the context with which to associate the buffer.</p>
  83. <p>May not be used in combination with <code>::queue</code> (use one or the other).</p>
  84. </div><h4 id='method.queue' class="method"><span id='queue.v' class='invisible'><code>pub fn <a href='#method.queue' class='fnname'>queue</a>&lt;'b&gt;(self, default_queue: <a class="struct" href="../../ocl/struct.Queue.html" title="struct ocl::Queue">Queue</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1074-1078' title='goto source code'>[src]</a></span></h4>
  85. <div class='docblock'><p>Sets the default queue.</p>
  86. <p>If this is set, the context associated with the <code>default_queue</code> will
  87. be used when creating the buffer (use one or the other).</p>
  88. </div><h4 id='method.flags' class="method"><span id='flags.v' class='invisible'><code>pub fn <a href='#method.flags' class='fnname'>flags</a>&lt;'b&gt;(self, flags: <a class="struct" href="../../ocl/flags/struct.MemFlags.html" title="struct ocl::flags::MemFlags">MemFlags</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1094-1100' title='goto source code'>[src]</a></span></h4>
  89. <div class='docblock'><p>Sets the flags used when creating the image.</p>
  90. <p>Defaults to <code>flags::MEM_READ_WRITE</code> aka.
  91. <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>
  92. for more information about flags. Note that the names of all flags in
  93. this library have the <code>CL_</code> prefix removed for brevity.</p>
  94. <h3 id="panics" class="section-header"><a href="#panics">Panics</a></h3>
  95. <p>Due to its unsafety, setting the
  96. <code>MEM_USE_HOST_PTR</code>/<code>MemFlags::new()::use_host_ptr()</code> flag will cause a
  97. panic. Use the <code>::use_host_slice</code> method instead.</p>
  98. </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>&lt;'d&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;host_slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'d [T]</a><br>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'d: 'a,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1131-1137' title='goto source code'>[src]</a></span></h4>
  99. <div class='docblock'><p>Specifies a region of host memory to use as storage for the image.</p>
  100. <p>OpenCL implementations are allowed to cache the image contents
  101. pointed to by <code>host_slice</code> in device memory. This cached copy can be
  102. used when kernels are executed on a device.</p>
  103. <p>The result of OpenCL commands that operate on multiple image objects
  104. created with the same <code>host_slice</code> or overlapping host regions is
  105. considered to be undefined</p>
  106. <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
  107. <code>host_slice</code> for memory objects (buffer and images) created using
  108. this method.</p>
  109. <p>Automatically sets the <code>flags::MEM_USE_HOST_PTR</code> aka.
  110. <code>MemFlags::new().use_host_ptr()</code> flag.</p>
  111. <h3 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h3>
  112. <p><code>::copy_host_slice</code> or <code>::use_host_slice</code> must not have already been
  113. called.</p>
  114. <h3 id="safety" class="section-header"><a href="#safety">Safety</a></h3>
  115. <p>The caller must ensure that <code>host_slice</code> lives until the image is
  116. destroyed. The caller must also ensure that only one image uses
  117. <code>host_slice</code> and that it is not tampered with inappropriately.</p>
  118. </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>&lt;'d&gt;(self, host_slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'d [T]</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'d: 'a,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1149-1155' title='goto source code'>[src]</a></span></h4>
  119. <div class='docblock'><p>Specifies a region of memory to copy into the image upon creation.</p>
  120. <p>Automatically sets the <code>flags::MEM_COPY_HOST_PTR</code> aka.
  121. <code>MemFlags::new().copy_host_ptr()</code> flag.</p>
  122. <h3 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h3>
  123. <p><code>::copy_host_slice</code> or <code>::use_host_slice</code> must not have already been
  124. called.</p>
  125. </div><h4 id='method.channel_order' class="method"><span id='channel_order.v' class='invisible'><code>pub fn <a href='#method.channel_order' class='fnname'>channel_order</a>(self, order: <a class="enum" href="../../ocl/enums/enum.ImageChannelOrder.html" title="enum ocl::enums::ImageChannelOrder">ImageChannelOrder</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1157-1160' title='goto source code'>[src]</a></span></h4>
  126. <h4 id='method.channel_data_type' class="method"><span id='channel_data_type.v' class='invisible'><code>pub fn <a href='#method.channel_data_type' class='fnname'>channel_data_type</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;data_type: <a class="enum" href="../../ocl/enums/enum.ImageChannelDataType.html" title="enum ocl::enums::ImageChannelDataType">ImageChannelDataType</a><br>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1162-1165' title='goto source code'>[src]</a></span></h4>
  127. <h4 id='method.image_type' class="method"><span id='image_type.v' class='invisible'><code>pub fn <a href='#method.image_type' class='fnname'>image_type</a>(self, image_type: <a class="enum" href="../../ocl/enums/enum.MemObjectType.html" title="enum ocl::enums::MemObjectType">MemObjectType</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1172-1175' title='goto source code'>[src]</a></span></h4>
  128. <div class='docblock'><p>Sets the type of image (technically the type of memory buffer).</p>
  129. <p>Describes the image type and must be either <code>Image1d</code>, <code>Image1dBuffer</code>,
  130. <code>Image1dArray</code>, <code>Image2d</code>, <code>Image2dArray</code>, or <code>Image3d</code>.</p>
  131. </div><h4 id='method.dims' class="method"><span id='dims.v' class='invisible'><code>pub fn <a href='#method.dims' class='fnname'>dims</a>&lt;D&gt;(self, dims: D) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="../../ocl/enum.SpatialDims.html" title="enum ocl::SpatialDims">SpatialDims</a>&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1211-1218' title='goto source code'>[src]</a></span></h4>
  132. <div class='docblock'><p>The width, height, and depth of an image or image array:</p>
  133. <p>Some notes adapted from SDK docs:</p>
  134. <h2 id="width" class="section-header"><a href="#width">Width</a></h2>
  135. <p>The width of the image in pixels. For a 2D image and image array, the
  136. image width must be ≤ <code>DeviceInfo::Image2dMaxWidth</code>. For a 3D image, the
  137. image width must be ≤ <code>DeviceInfo::Image3dMaxWidth</code>. For a 1D image buffer,
  138. the image width must be ≤ <code>DeviceInfo::ImageMaxBufferSize</code>. For a 1D image
  139. and 1D image array, the image width must be ≤ <code>DeviceInfo::Image2dMaxWidth</code>.</p>
  140. <h2 id="height" class="section-header"><a href="#height">Height</a></h2>
  141. <p>The height of the image in pixels. This is only used if the
  142. image is a 2D, 3D or 2D image array. For a 2D image or image array, the
  143. image height must be ≤ <code>DeviceInfo::Image2dMaxHeight</code>. For a 3D image, the
  144. image height must be ≤ <code>DeviceInfo::Image3dMaxHeight</code>.</p>
  145. <h2 id="depth" class="section-header"><a href="#depth">Depth</a></h2>
  146. <p>image_depth The depth of the image in pixels. This is only used if the
  147. image is a 3D image and must be a value ≥ 1 and ≤
  148. <code>DeviceInfo::Image3dMaxDepth</code>.</p>
  149. <h2 id="examples" class="section-header"><a href="#examples">Examples</a></h2>
  150. <ul>
  151. <li>To set the dimensions of a 2d image use:
  152. <code>SpatialDims::Two(width, height)</code>.</li>
  153. <li>To set the dimensions of a 2d image array use:
  154. <code>SpatialDims::Three(width, height, array_length)</code>.</li>
  155. <li>To set the dimensions of a 3d image use:
  156. <code>SpatialDims::Three(width, height, depth)</code>.</li>
  157. </ul>
  158. </div><h4 id='method.array_size' class="method"><span id='array_size.v' class='invisible'><code>pub fn <a href='#method.array_size' class='fnname'>array_size</a>(self, array_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1229-1232' title='goto source code'>[src]</a></span></h4>
  159. <div class='docblock'><p>Image array size.</p>
  160. <p>The number of images in the image array. This is only used if the image is
  161. a 1D or 2D image array. The values for image_array_size, if specified,
  162. must be a value ≥ 1 and ≤ <code>DeviceInfo::ImageMaxArraySize</code>.</p>
  163. <p>Note that reading and writing 2D image arrays from a kernel with
  164. image_array_size = 1 may be lower performance than 2D images.</p>
  165. </div><h4 id='method.row_pitch_bytes' class="method"><span id='row_pitch_bytes.v' class='invisible'><code>pub fn <a href='#method.row_pitch_bytes' class='fnname'>row_pitch_bytes</a>(self, row_pitch: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1243-1246' title='goto source code'>[src]</a></span></h4>
  166. <div class='docblock'><p>Image row pitch.</p>
  167. <p>The scan-line pitch in bytes. This must be 0 if host data is <code>None</code> and
  168. can be either 0 or ≥ image_width * size of element in bytes if host data
  169. is not <code>None</code>. If host data is not <code>None</code> and image_row_pitch = 0,
  170. image_row_pitch is calculated as image_width * size of element in bytes.
  171. If image_row_pitch is not 0, it must be a multiple of the image element
  172. size in bytes.</p>
  173. </div><h4 id='method.slc_pitch_bytes' class="method"><span id='slc_pitch_bytes.v' class='invisible'><code>pub fn <a href='#method.slc_pitch_bytes' class='fnname'>slc_pitch_bytes</a>(self, slc_pitch: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1260-1263' title='goto source code'>[src]</a></span></h4>
  174. <div class='docblock'><p>Image slice pitch.</p>
  175. <p>The size in bytes of each 2D slice in the 3D image or the size in bytes of
  176. each image in a 1D or 2D image array. This must be 0 if host data is
  177. <code>None</code>. If host data is not <code>None</code>, image_slice_pitch can be either 0 or ≥
  178. image_row_pitch * image_height for a 2D image array or 3D image and can be
  179. either 0 or ≥ image_row_pitch for a 1D image array. If host data is not
  180. <code>None</code> and image_slice_pitch = 0, image_slice_pitch is calculated as
  181. image_row_pitch * image_height for a 2D image array or 3D image and
  182. image_row_pitch for a 1D image array. If image_slice_pitch is not 0, it
  183. must be a multiple of the image_row_pitch.</p>
  184. </div><h4 id='method.buffer_sync' class="method"><span id='buffer_sync.v' class='invisible'><code>pub fn <a href='#method.buffer_sync' class='fnname'>buffer_sync</a>(self, buffer: <a class="struct" href="../../ocl_core/types/abs/struct.Mem.html" title="struct ocl_core::types::abs::Mem">MemCore</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1276-1279' title='goto source code'>[src]</a></span></h4>
  185. <div class='docblock'><p>Buffer synchronization.</p>
  186. <p>Refers to a valid buffer memory object if image_type is
  187. <code>MemObjectType::Image1dBuffer</code>. Otherwise it must be <code>None</code> (default).
  188. For a 1D image buffer object, the image pixels are taken from the buffer
  189. object's data store. When the contents of a buffer object's data store are
  190. modified, those changes are reflected in the contents of the 1D image
  191. buffer object and vice-versa at corresponding sychronization points. The
  192. image_width * size of element in bytes must be ≤ size of buffer object
  193. data store.</p>
  194. </div><h4 id='method.image_format' class="method"><span id='image_format.v' class='invisible'><code>pub fn <a href='#method.image_format' class='fnname'>image_format</a>(self, image_format: <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1291-1294' title='goto source code'>[src]</a></span></h4>
  195. <div class='docblock'><p>Specifies the image pixel format.</p>
  196. <p>If unspecified, defaults to:</p>
  197. <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">
  198. <span class="ident">ImageFormat</span> {
  199. <span class="ident">channel_order</span>: <span class="ident">ImageChannelOrder</span>::<span class="ident">Rgba</span>,
  200. <span class="ident">channel_data_type</span>: <span class="ident">ImageChannelDataType</span>::<span class="ident">SnormInt8</span>,
  201. }</pre>
  202. </div><h4 id='method.image_desc' class="method"><span id='image_desc.v' class='invisible'><code>pub unsafe fn <a href='#method.image_desc' class='fnname'>image_desc</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;image_desc: <a class="struct" href="../../ocl/builders/struct.ImageDescriptor.html" title="struct ocl::builders::ImageDescriptor">ImageDescriptor</a><br>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageBuilder.html" title="struct ocl::builders::ImageBuilder">ImageBuilder</a>&lt;'a, T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1329-1332' title='goto source code'>[src]</a></span></h4>
  203. <div class='docblock'><p>Specifies the image descriptor containing a number of important settings.</p>
  204. <p>If unspecified (not recommended), defaults to:</p>
  205. <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">
  206. <span class="ident">ImageDescriptor</span> {
  207. <span class="ident">image_type</span>: <span class="ident">MemObjectType</span>::<span class="ident">Image1d</span>,
  208. <span class="ident">image_width</span>: <span class="number">0</span>,
  209. <span class="ident">image_height</span>: <span class="number">0</span>,
  210. <span class="ident">image_depth</span>: <span class="number">0</span>,
  211. <span class="ident">image_array_size</span>: <span class="number">0</span>,
  212. <span class="ident">image_row_pitch</span>: <span class="number">0</span>,
  213. <span class="ident">image_slice_pitch</span>: <span class="number">0</span>,
  214. <span class="ident">num_mip_levels</span>: <span class="number">0</span>,
  215. <span class="ident">num_samples</span>: <span class="number">0</span>,
  216. <span class="ident">buffer</span>: <span class="prelude-val">None</span>,
  217. }</pre>
  218. <p>If you are unsure, just set the first four by using
  219. <code>ImageDescriptor::new</code>. Ex.:</p>
  220. <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">
  221. <span class="ident">ocl</span>::<span class="ident">Image</span>::<span class="ident">builder</span>()
  222. .<span class="ident">image_desc</span>(<span class="ident">ocl</span>::<span class="ident">ImageDescriptor</span>::<span class="ident">new</span>(
  223. <span class="ident">ocl</span>::<span class="ident">MemObjectType</span>::<span class="ident">Image2d</span>, <span class="number">1280</span>, <span class="number">800</span>, <span class="number">1</span>))
  224. ...
  225. ...
  226. .<span class="ident">build</span>()</pre>
  227. <p>Setting this overwrites any previously set type, dimensions, array size, pitch, etc.</p>
  228. </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) -&gt; <a class="type" href="../../ocl_core/error/type.Result.html" title="type ocl_core::error::Result">OclCoreResult</a>&lt;<a class="struct" href="../../ocl/struct.Image.html" title="struct ocl::Image">Image</a>&lt;T&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/image.rs.html#1336-1358' title='goto source code'>[src]</a></span></h4>
  229. <div class='docblock'><p>Builds with no host side image data memory specified and returns a
  230. new <code>Image</code>.</p>
  231. </div></div></section>
  232. <section id='search' class="content hidden"></section>
  233. <section class="footer"></section>
  234. <aside id="help" class="hidden">
  235. <div>
  236. <h1 class="hidden">Help</h1>
  237. <div class="shortcuts">
  238. <h2>Keyboard Shortcuts</h2>
  239. <dl>
  240. <dt><kbd>?</kbd></dt>
  241. <dd>Show this help dialog</dd>
  242. <dt><kbd>S</kbd></dt>
  243. <dd>Focus the search field</dd>
  244. <dt><kbd>↑</kbd></dt>
  245. <dd>Move up in search results</dd>
  246. <dt><kbd>↓</kbd></dt>
  247. <dd>Move down in search results</dd>
  248. <dt><kbd>↹</kbd></dt>
  249. <dd>Switch tab</dd>
  250. <dt><kbd>&#9166;</kbd></dt>
  251. <dd>Go to active search result</dd>
  252. <dt><kbd>+</kbd></dt>
  253. <dd>Expand all sections</dd>
  254. <dt><kbd>-</kbd></dt>
  255. <dd>Collapse all sections</dd>
  256. </dl>
  257. </div>
  258. <div class="infos">
  259. <h2>Search Tricks</h2>
  260. <p>
  261. Prefix searches with a type followed by a colon (e.g.
  262. <code>fn:</code>) to restrict the search to a given type.
  263. </p>
  264. <p>
  265. Accepted types are: <code>fn</code>, <code>mod</code>,
  266. <code>struct</code>, <code>enum</code>,
  267. <code>trait</code>, <code>type</code>, <code>macro</code>,
  268. and <code>const</code>.
  269. </p>
  270. <p>
  271. Search functions by type signature (e.g.
  272. <code>vec -> usize</code> or <code>* -> vec</code>)
  273. </p>
  274. </div>
  275. </div>
  276. </aside>
  277. <script>
  278. window.rootPath = "../../";
  279. window.currentCrate = "ocl";
  280. </script>
  281. <script src="../../main.js"></script>
  282. <script defer src="../../search-index.js"></script>
  283. </body>
  284. </html>