[692] | 1 | <HTML> |
---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 3 | <!-- Created on , 12 2006 by texi2html 1.64 --> |
---|
| 4 | <!-- |
---|
| 5 | Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) |
---|
| 6 | Karl Berry <karl@freefriends.org> |
---|
| 7 | Olaf Bachmann <obachman@mathematik.uni-kl.de> |
---|
| 8 | and many others. |
---|
| 9 | Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de> |
---|
| 10 | Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> |
---|
| 11 | |
---|
| 12 | --> |
---|
| 13 | <HEAD> |
---|
| 14 | <TITLE>Hardware Buffers In OGRE: Buffer Usage</TITLE> |
---|
| 15 | |
---|
| 16 | <META NAME="description" CONTENT="Hardware Buffers In OGRE: Buffer Usage"> |
---|
| 17 | <META NAME="keywords" CONTENT="Hardware Buffers In OGRE: Buffer Usage"> |
---|
| 18 | <META NAME="resource-type" CONTENT="document"> |
---|
| 19 | <META NAME="distribution" CONTENT="global"> |
---|
| 20 | <META NAME="Generator" CONTENT="texi2html 1.64"> |
---|
| 21 | <LINK TYPE="text/css" rel="stylesheet" href="../style.css"> |
---|
| 22 | </HEAD> |
---|
| 23 | |
---|
| 24 | <BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> |
---|
| 25 | |
---|
| 26 | <A NAME="SEC5"></A> |
---|
| 27 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
| 28 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_4.html#SEC4"> < </A>]</TD> |
---|
| 29 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_3.html#SEC3"> Up </A>]</TD> |
---|
| 30 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_6.html#SEC6"> > </A>]</TD> |
---|
| 31 | <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD> |
---|
| 32 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
| 33 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
| 34 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_abt.html#SEC_About"> ? </A>]</TD> |
---|
| 35 | </TR></TABLE> |
---|
| 36 | <HR SIZE=1> |
---|
| 37 | <H2> 2.2 Buffer Usage </H2> |
---|
| 38 | <!--docid::SEC5::--> |
---|
| 39 | Because the memory in a hardware buffer is likely to be under significant contention during the rendering of a scene, the kind of access you need to the buffer over the time it is used is extremely important; whether you need to update the contents of the buffer regularly, whether you need to be able to read information back from it, these are all important factors to how the graphics card manages the buffer. The method and exact parameters used to create a buffer depends on whether you are creating an index or vertex buffer (See section <A HREF="vbo-update_9.html#SEC10">2.6 Hardware Vertex Buffers</A> and See section <A HREF="vbo-update_14.html#SEC18">2.7 Hardware Index Buffers</A>), however one creation parameter is common to them both - the 'usage'. |
---|
| 40 | <BR><BR> |
---|
| 41 | The most optimal type of hardware buffer is one which is not updated often, and is never read from. The usage parameter of createVertexBuffer or createIndexBuffer can be one of the following: |
---|
| 42 | <DL COMPACT> |
---|
| 43 | <DT><CODE>HBU_STATIC</CODE> |
---|
| 44 | <DD>This means you do not need to update the buffer very often, but you might occasionally want to read from it. |
---|
| 45 | <P> |
---|
| 46 | |
---|
| 47 | <DT><CODE>HBU_STATIC_WRITE_ONLY</CODE> |
---|
| 48 | <DD>This means you do not need to update the buffer very often, and you do not need to read from it. However, you may read from it's shadow buffer if you set one up (See section <A HREF="vbo-update_6.html#SEC6">2.3 Shadow Buffers</A>). This is the optimal buffer usage setting. |
---|
| 49 | <P> |
---|
| 50 | |
---|
| 51 | <DT><CODE>HBU_DYNAMIC</CODE> |
---|
| 52 | <DD>This means you expect to update the buffer often, and that you may wish to read from it. This is the least optimal buffer setting. |
---|
| 53 | <P> |
---|
| 54 | |
---|
| 55 | <DT><CODE>HBU_DYNAMIC_WRITE_ONLY</CODE> |
---|
| 56 | <DD>This means you expect to update the buffer often, but that you never want to read from it. However, you may read from it's shadow buffer if you set one up (See section <A HREF="vbo-update_6.html#SEC6">2.3 Shadow Buffers</A>). If you use this option, and replace the entire contents of the buffer every frame, then you should use HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE instead, since that has better performance characteristics on some platforms. |
---|
| 57 | <P> |
---|
| 58 | |
---|
| 59 | <DT><CODE>HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE</CODE> |
---|
| 60 | <DD>This means that you expect to replace the entire contents of the buffer on an extremely regular basis, most likely every frame. By selecting this option, you free the system up from having to be concerned about losing the existing contents of the buffer at any time, because if it does lose them, you will be replacing them next frame anyway. On some platforms this can make a significant performance difference, so you should try to use this whenever you have a buffer you need to update regularly. Note that if you create a buffer this way, you should use the HBL_DISCARD flag when locking the contents of it for writing. |
---|
| 61 | <P> |
---|
| 62 | |
---|
| 63 | </DL> |
---|
| 64 | Choosing the usage of your buffers carefully is important to getting optimal performance out of your geometry. If you have a situation where you need to update a vertex buffer often, consider whether you actually need to update <STRONG>all</STRONG> the parts of it, or just some. If it's the latter, consider using more than one buffer, with only the data you need to modify in the HBU_DYNAMIC buffer. |
---|
| 65 | <BR><BR> |
---|
| 66 | Always try to use the _WRITE_ONLY forms. This just means that you cannot read <EM>directly</EM> from the hardware buffer, which is good practice because reading from hardware buffers is very slow. If you really need to read data back, use a shadow buffer, described in the next section. |
---|
| 67 | <P> |
---|
| 68 | |
---|
| 69 | <A NAME="Shadow Buffers"></A> |
---|
| 70 | <HR SIZE=1> |
---|
| 71 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
| 72 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_4.html#SEC4"> < </A>]</TD> |
---|
| 73 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_3.html#SEC3"> Up </A>]</TD> |
---|
| 74 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_6.html#SEC6"> > </A>]</TD> |
---|
| 75 | <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD> |
---|
| 76 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
| 77 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
| 78 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_abt.html#SEC_About"> ? </A>]</TD> |
---|
| 79 | </TR></TABLE> |
---|
| 80 | <BR> |
---|
| 81 | <FONT SIZE="-1"> |
---|
| 82 | This document was generated |
---|
| 83 | by <I>Steve Streeting</I> on <I>, 12 2006</I> |
---|
| 84 | using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html |
---|
| 85 | "><I>texi2html</I></A> |
---|
| 86 | |
---|
| 87 | </BODY> |
---|
| 88 | </HTML> |
---|