Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is simply the sheer amount of data you have to process.</p> <p>Your float buffer is 9 megabytes in size, and you touch the data more than once. Most likely your rendering loop looks somewhat like this:</p> <ul> <li>Clear the buffer</li> <li>Render something on it (uses reads and writes)</li> <li>Convert to unsigned bytes</li> <li>Upload to OpenGL</li> </ul> <p>That's a lot of data that you move around, and the cache can't help you much because the image is much larger than your cache. Let's assume you touch every pixel five times. If so you move 45mb of data in and out of the slow main memory. 45mb does not sound like much data, but consider that almost each memory access will be a cache miss. The CPU will spend most of the time waiting for the data to arrive. </p> <p>If you want to stay on the CPU to do the rendering there's not much you can do. Some ideas: </p> <ul> <li><p>Using SSE for non temporary loads and stores <em>may</em> help, but they will complicate your task quite a bit (you have to align your reads and writes).</p></li> <li><p>Try break up your rendering into tiles. E.g. do everything on smaller rectangles (256*256 or so). The idea behind this is, that you actually get a benefit from the cache. After you've cleared your rectangle for example the entire bitmap will be in the cache. Rendering and converting to bytes will be a lot faster now because there is no need to get the data from the relative slow main memory anymore.</p></li> <li><p>Last resort: Reduce the resolution of your particle effect. This will give you a good bang for the buck at the cost of visual quality.</p></li> </ul> <p>The best solution is to move the rendering onto the graphic card. Render to texture functionality is standard these days. It's a bit tricky to get it working with OpenGL because you have to decide which extension to use, but once you have it working the performance is not an issue anymore.</p> <p>Btw - do you <strong>really</strong> need floating point render-targets? If you get away with 3 bytes per pixel you will see a nice performance improvement. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload