diff options
Diffstat (limited to 'manuals/chickadee/Buffers.html')
-rw-r--r-- | manuals/chickadee/Buffers.html | 73 |
1 files changed, 31 insertions, 42 deletions
diff --git a/manuals/chickadee/Buffers.html b/manuals/chickadee/Buffers.html index 00e3cfe..bfea5a1 100644 --- a/manuals/chickadee/Buffers.html +++ b/manuals/chickadee/Buffers.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> -<!-- Copyright (C) 2017, 2018, 2019 David Thompson davet@gnu.org +<!-- Copyright (C) 2017-2020 David Thompson davet@gnu.org Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 @@ -18,7 +18,7 @@ Foundation Web site at http://www.gnu.org/licenses/fdl.html. The document was typeset with http://www.texinfo.org/ (GNU Texinfo). --> -<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> +<!-- Created by GNU Texinfo 6.6, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Buffers (The Chickadee Game Toolkit)</title> @@ -38,23 +38,14 @@ http://www.texinfo.org/ (GNU Texinfo). <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} -blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} -blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} -div.smalldisplay {margin-left: 3.2em} -div.smallexample {margin-left: 3.2em} -div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} -pre.smalldisplay {font-family: inherit; font-size: smaller} -pre.smallexample {font-size: smaller} -pre.smallformat {font-family: inherit; font-size: smaller} -pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} @@ -89,14 +80,12 @@ ul.no-bullet {list-style: none} </head> <body lang="en"> -<a name="Buffers"></a> -<div class="header"> +<span id="Buffers"></span><div class="header"> <p> Next: <a href="Shaders.html#Shaders" accesskey="n" rel="next">Shaders</a>, Previous: <a href="Rendering-Engine.html#Rendering-Engine" accesskey="p" rel="prev">Rendering Engine</a>, Up: <a href="Graphics.html#Graphics" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> </div> <hr> -<a name="Buffers-1"></a> -<h4 class="subsection">2.3.11 Buffers</h4> +<span id="Buffers-1"></span><h4 class="subsection">2.3.13 Buffers</h4> <p>Alright, let’s brush aside all of those pretty high level abstractions and discuss what is going on under the hood. The GPU exists as a @@ -158,7 +147,7 @@ into the buffer. To provided a typed view into a buffer, the <p>To render a square, the GPU needs to draw two triangles, which means we need 6 vertices in total. However, the above buffer only contains -data for 4 vertices. This is becase there are only 4 unique vertices +data for 4 vertices. This is because there are only 4 unique vertices for a square, but 2 of them must be repeated for each triangle. To work with deduplicated vertex data, an “index buffer” must be created. @@ -202,7 +191,7 @@ shapes, or particles to see GPU buffers in action. <p>Without further ado, the API reference: </p> <dl> -<dt><a name="index-make_002dbuffer"></a>Procedure: <strong>make-buffer</strong> <em>data [#:name "anonymous"] [#:length] [#:offset 0] [#:stride 0] [#:target <code>vertex</code>] [#:usage <code>static</code>]</em></dt> +<dt id="index-make_002dbuffer">Procedure: <strong>make-buffer</strong> <em>data [#:name "anonymous"] [#:length] [#:offset 0] [#:stride 0] [#:target <code>vertex</code>] [#:usage <code>static</code>]</em></dt> <dd> <p>Upload <var>data</var>, a bytevector, to the GPU. By default, the entire bytevector is uploaded. A subset of the data may be uploaded by @@ -242,44 +231,44 @@ is never sent to the GPU. </p></dd></dl> <dl> -<dt><a name="index-buffer_003f"></a>Procedure: <strong>buffer?</strong> <em>obj</em></dt> +<dt id="index-buffer_003f">Procedure: <strong>buffer?</strong> <em>obj</em></dt> <dd><p>Return <code>#t</code> if <var>obj</var> is a GPU buffer. </p></dd></dl> <dl> -<dt><a name="index-index_002dbuffer_003f"></a>Procedure: <strong>index-buffer?</strong> <em>buffer</em></dt> +<dt id="index-index_002dbuffer_003f">Procedure: <strong>index-buffer?</strong> <em>buffer</em></dt> <dd><p>Return <code>#t</code> if <var>buffer</var> is an index buffer. </p></dd></dl> <dl> -<dt><a name="index-null_002dbuffer"></a>Variable: <strong>null-buffer</strong></dt> +<dt id="index-null_002dbuffer">Variable: <strong>null-buffer</strong></dt> <dd><p>Represents the absence of a buffer. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dname"></a>Procedure: <strong>buffer-name</strong> <em>buffer</em></dt> +<dt id="index-buffer_002dname">Procedure: <strong>buffer-name</strong> <em>buffer</em></dt> <dd><p>Return the name of <var>buffer</var>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dlength"></a>Procedure: <strong>buffer-length</strong> <em>buffer</em></dt> +<dt id="index-buffer_002dlength">Procedure: <strong>buffer-length</strong> <em>buffer</em></dt> <dd><p>Return the length of <var>buffer</var>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dstride"></a>Procedure: <strong>buffer-stride</strong> <em>buffer</em></dt> +<dt id="index-buffer_002dstride">Procedure: <strong>buffer-stride</strong> <em>buffer</em></dt> <dd><p>Return the amount of space, in bytes, between each element in <var>buffer</var>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dtarget"></a>Procedure: <strong>buffer-target</strong> <em>buffer</em></dt> +<dt id="index-buffer_002dtarget">Procedure: <strong>buffer-target</strong> <em>buffer</em></dt> <dd><p>Return the the intended usage of <var>buffer</var>, either <code>vertex</code> or <code>index</code>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dusage"></a>Procedure: <strong>buffer-usage</strong> <em>buffer</em></dt> +<dt id="index-buffer_002dusage">Procedure: <strong>buffer-usage</strong> <em>buffer</em></dt> <dd><p>Return the intended usage of <var>buffer</var>, either <code>static</code> for buffer data that will not change once sent to the GPU, or <code>stream</code> for buffer data that will be frequently updated from the @@ -287,14 +276,14 @@ client-side. </p></dd></dl> <dl> -<dt><a name="index-buffer_002ddata"></a>Procedure: <strong>buffer-data</strong> <em>buffer</em></dt> +<dt id="index-buffer_002ddata">Procedure: <strong>buffer-data</strong> <em>buffer</em></dt> <dd><p>Return a bytevector containing all the data within <var>buffer</var>. If <var>buffer</var> has not been mapped (see <code>with-mapped-buffer</code>) then this procedure will return <code>#f</code>. </p></dd></dl> <dl> -<dt><a name="index-with_002dmapped_002dbuffer"></a>Syntax: <strong>with-mapped-buffer</strong> <em>buffer body …</em></dt> +<dt id="index-with_002dmapped_002dbuffer">Syntax: <strong>with-mapped-buffer</strong> <em>buffer body …</em></dt> <dd><p>Evaluate <var>body</var> in the context of <var>buffer</var> having its data synced from GPU memory to RAM. In this context, <code>buffer-data</code> will return a bytevector of all the data stored in <var>buffer</var>. When @@ -306,7 +295,7 @@ contents dynamically, such as a sprite batch. </p></dd></dl> <dl> -<dt><a name="index-make_002dbuffer_002dview"></a>Procedure: <strong>make-buffer-view</strong> <em>#:buffer #:type #:component-type #:length [#:offset <code>0</code>] [#:divisor <code>1</code>] [#:name <code>"anonymous"</code>]</em></dt> +<dt id="index-make_002dbuffer_002dview">Procedure: <strong>make-buffer-view</strong> <em>#:buffer #:type #:component-type #:length [#:offset <code>0</code>] [#:divisor <code>1</code>] [#:name <code>"anonymous"</code>]</em></dt> <dd> <p>Return a new buffer view for <var>buffer</var> starting at byte index <var>offset</var> of <var>length</var> elements, where each element is of @@ -361,42 +350,42 @@ for 2 instances, and so on. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_003f"></a>Procedure: <strong>buffer-view?</strong> <em>obj</em></dt> +<dt id="index-buffer_002dview_003f">Procedure: <strong>buffer-view?</strong> <em>obj</em></dt> <dd><p>Return <code>#t</code> if <var>obj</var> is a buffer view. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_002d_003ebuffer"></a>Procedure: <strong>buffer-view->buffer</strong> <em>buffer-view</em></dt> +<dt id="index-buffer_002dview_002d_003ebuffer">Procedure: <strong>buffer-view->buffer</strong> <em>buffer-view</em></dt> <dd><p>Return the buffer that <var>buffer-view</var> is using. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_002dname"></a>Procedure: <strong>buffer-view-name</strong> <em>buffer-view</em></dt> +<dt id="index-buffer_002dview_002dname">Procedure: <strong>buffer-view-name</strong> <em>buffer-view</em></dt> <dd><p>Return the name of <var>buffer-view</var>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_002doffset"></a>Procedure: <strong>buffer-view-offset</strong> <em>buffer-view</em></dt> +<dt id="index-buffer_002dview_002doffset">Procedure: <strong>buffer-view-offset</strong> <em>buffer-view</em></dt> <dd><p>Return the byte offset of <var>buffer-view</var>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_002dtype"></a>Procedure: <strong>buffer-view-type</strong> <em>buffer-view</em></dt> +<dt id="index-buffer_002dview_002dtype">Procedure: <strong>buffer-view-type</strong> <em>buffer-view</em></dt> <dd><p>Return the data type of <var>buffer-view</var>. </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_002dcomponent_002dtype"></a>Procedure: <strong>buffer-view-component-type</strong> <em>buffer-view</em></dt> +<dt id="index-buffer_002dview_002dcomponent_002dtype">Procedure: <strong>buffer-view-component-type</strong> <em>buffer-view</em></dt> <dd><p>Return the component data type of <var>buffer-view</var> </p></dd></dl> <dl> -<dt><a name="index-buffer_002dview_002ddivisor"></a>Procedure: <strong>buffer-view-divisor</strong> <em>buffer-view</em></dt> +<dt id="index-buffer_002dview_002ddivisor">Procedure: <strong>buffer-view-divisor</strong> <em>buffer-view</em></dt> <dd><p>Return the instance divisor for <var>buffer-view</var>. </p></dd></dl> <dl> -<dt><a name="index-with_002dmapped_002dbuffer_002dview"></a>Syntax: <strong>with-mapped-buffer-view</strong> <em>buffer-view body …</em></dt> +<dt id="index-with_002dmapped_002dbuffer_002dview">Syntax: <strong>with-mapped-buffer-view</strong> <em>buffer-view body …</em></dt> <dd> <p>Evaluate <var>body</var> in the context of <var>buffer-view</var> having its data synced from GPU memory to RAM. See <code>with-mapped-buffer</code> for @@ -404,7 +393,7 @@ more information. </p></dd></dl> <dl> -<dt><a name="index-make_002dvertex_002darray"></a>Procedure: <strong>make-vertex-array</strong> <em>#:indices #:attributes [#:mode <code>triangles</code>]</em></dt> +<dt id="index-make_002dvertex_002darray">Procedure: <strong>make-vertex-array</strong> <em>#:indices #:attributes [#:mode <code>triangles</code>]</em></dt> <dd> <p>Return a new vertex array using the index data within the buffer view <var>indices</var> and the vertex attribute data within <var>attributes</var>. @@ -436,28 +425,28 @@ supported: </dd></dl> <dl> -<dt><a name="index-null_002dvertex_002darray"></a>Variable: <strong>null-vertex-array</strong></dt> +<dt id="index-null_002dvertex_002darray">Variable: <strong>null-vertex-array</strong></dt> <dd><p>Represents the absence of a vertex array. </p></dd></dl> <dl> -<dt><a name="index-vertex_002darray_003f"></a>Procedure: <strong>vertex-array?</strong> <em>obj</em></dt> +<dt id="index-vertex_002darray_003f">Procedure: <strong>vertex-array?</strong> <em>obj</em></dt> <dd><p>Return <code>#t</code> if <var>obj</var> is a vertex array. </p></dd></dl> <dl> -<dt><a name="index-vertex_002darray_002dindices"></a>Procedure: <strong>vertex-array-indices</strong> <em>vertex-array</em></dt> +<dt id="index-vertex_002darray_002dindices">Procedure: <strong>vertex-array-indices</strong> <em>vertex-array</em></dt> <dd><p>Return the buffer view containing index data for <var>vertex-array</var>. </p></dd></dl> <dl> -<dt><a name="index-vertex_002darray_002dattributes"></a>Procedure: <strong>vertex-array-attributes</strong> <em>vertex-array</em></dt> +<dt id="index-vertex_002darray_002dattributes">Procedure: <strong>vertex-array-attributes</strong> <em>vertex-array</em></dt> <dd><p>Return the attribute index -> buffer view mapping of vertex attribute data for <var>vertex-array</var>. </p></dd></dl> <dl> -<dt><a name="index-vertex_002darray_002dmode"></a>Procedure: <strong>vertex-array-mode</strong> <em>vertex-array</em></dt> +<dt id="index-vertex_002darray_002dmode">Procedure: <strong>vertex-array-mode</strong> <em>vertex-array</em></dt> <dd><p>Return the primitive rendering mode for <var>vertex-array</var>. </p></dd></dl> |