Graphics Reference
In-Depth Information
External memory
Tile memory
0
1
2
Pixel
Local
Storage
Resolve
shader
Color
Framebuffer
n
Figure 3.3. Each draw call adds data to the pixel local storage. When done rendering, the application
must use a custom resolve shader to convert the pixel local storage to a usable framebuffer color. This
needs to be done before end of frame.
Shader Pixel Local Storage changes this by allowing the application to store
more data at each pixel fragment. With Shader Pixel Local Storage you no longer
generate a pixel per fragment shader invocation. Instead, each pixel is the product
of a queue of fragment shaders, which build up the result progressively, and
rasterization is the means for describing the queue of fragment work. Figure 3.3
illustrates this by having multiple draw calls read and write to the pixel local
storage.
3.3.1 Extension Usage
Shader Pixel Local Storage can be enabled and disabled by calling glEnable and
glDisable with GL_SHADER_PIXEL_LOCAL_STORAGE_EXT .
The extension can be enabled in a fragment shader with
# extension GL EXT shader pixel local storage : enable
Before disabling the pixel local storage, the application must ensure that the
contents of the pixel local storage is resolved to a native framebuffer. Not doing
so will lead to undefined data being written to the framebuffer.
3.3.2 Pixel Local Storage
The Shader Pixel Local Storage extension introduces new qualifiers for declaring
the pixel local storage. These are the __pixel_localEXT , __pixel_local_inEXT ,
and __pixel_local_outEXT qualifiers, as outlined in Table 3.3. Listing 3.4 shows
an example of how the pixel local storage can be declared in a shader.
Mixing pixel_local_inEXT and pixel_local_outEXT in the same fragment shader
allows applications to process, reinterpret, and convert data between fragment
shader invocations.
Search WWH ::




Custom Search