OpenGL.GL.EXT.gpu_shader4
OpenGL extension EXT.gpu_shader4
This module customises the behaviour of the
OpenGL.raw.GL.EXT.gpu_shader4 to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a set of new features to the OpenGL Shading
Language and related APIs to support capabilities of new hardware. In
particular, this extension provides the following functionality:
- New texture lookup functions are provided that allow shaders to access individual texels using integer coordinates referring to the texel location and level of detail. No filtering is performed. These functions allow applications to use textures as one-, two-, and three-dimensional arrays.
- New texture lookup functions are provided that allow shaders to query the dimensions of a specific level-of-detail image of a texture object.
- New texture lookup functions variants are provided that allow shaders to pass a constant integer vector used to offset the texel locations used during the lookup to assist in custom texture filtering operations.
- New texture lookup functions are provided that allow shaders to access one- and two-dimensional array textures. The second, or third, coordinate is used to select the layer of the array to access.
- New "Grad" texture lookup functions are provided that allow shaders to explicitely pass in derivative values which are used by the GL to compute the level-of-detail when performing a texture lookup.
- A new texture lookup function is provided to access a buffer texture.
- The existing absolute LOD texture lookup functions are no longer restricted to the vertex shader only.
- The ability to specify and use cubemap textures with a DEPTH_COMPONENT internal format. This also enables shadow mapping on cubemaps. The 'q' coordinate is used as the reference value for comparisons. A set of new texture lookup functions is provided to lookup into shadow cubemaps.
- The ability to specify if varying variables are interpolated in a non-perspective correct manner, if they are flat shaded or, if multi-sampling, if centroid sampling should be performed.
- Full signed integer and unsigned integer support in the OpenGL Shading Language:
- Integers are defined as 32 bit values using two's complement.
- Unsigned integers and vectors thereof are added.
- New texture lookup functions are provided that return integer values. These functions are to be used in conjunction with new texture formats whose components are actual integers, rather than integers that encode a floating-point value. To support these lookup functions, new integer and unsigned-integer sampler types are introduced.
- Integer bitwise operators are now enabled.
- Several built-in functions and operators now operate on integers or vectors of integers.
- New vertex attribute functions are added that load integer attribute data and can be referenced in a vertex shader as integer data.
- New uniform loading commands are added to load unsigned integer data.
- Varying variables can now be (unsigned) integers. If declared as such, they have to be flat shaded.
- Fragment shaders can define their own output variables, and declare them to be of type floating-point, integer or unsigned integer. These variables are bound to a fragment color index with the new API command BindFragDataLocationEXT(), and directed to buffers using the existing DrawBuffer or DrawBuffers API commands.
- Added new built-in functions truncate() and round() to the shading language.
- A new built-in variable accessible from within vertex shaders that holds the index <i> implicitly passed to ArrayElement to specify the vertex. This is called the vertex ID.
- A new built-in variable accessible from within fragment and geometry shaders that hold the index of the currently processed primitive. This is called the primitive ID.
This extension also briefly mentions a new shader type, called a geometry
shader. A geometry shader is run after vertices are transformed, but
before clipping. A geometry shader begins with a single primitive (point,
line, triangle. It can read the attributes of any of the vertices in the
primitive and use them to generate new primitives. A geometry shader has a
fixed output primitive type (point, line strip, or triangle strip) and
emits vertices to define a new primitive. Geometry shaders are discussed
in detail in the GL_EXT_geometry_shader4 specification.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/gpu_shader4.txt
Functions
Constants
GL_INT_SAMPLER_1D_ARRAY_EXT (36302)
GL_INT_SAMPLER_1D_EXT (36297)
GL_INT_SAMPLER_2D_ARRAY_EXT (36303)
GL_INT_SAMPLER_2D_EXT (36298)
GL_INT_SAMPLER_2D_RECT_EXT (36301)
GL_INT_SAMPLER_3D_EXT (36299)
GL_INT_SAMPLER_BUFFER_EXT (36304)
GL_INT_SAMPLER_CUBE_EXT (36300)
GL_MAX_PROGRAM_TEXEL_OFFSET_EXT (35077)
GL_MIN_PROGRAM_TEXEL_OFFSET_EXT (35076)
GL_SAMPLER_1D_ARRAY_EXT (36288)
GL_SAMPLER_1D_ARRAY_SHADOW_EXT (36291)
GL_SAMPLER_2D_ARRAY_EXT (36289)
GL_SAMPLER_2D_ARRAY_SHADOW_EXT (36292)
GL_SAMPLER_BUFFER_EXT (36290)
GL_SAMPLER_CUBE_SHADOW_EXT (36293)
GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT (36310)
GL_UNSIGNED_INT_SAMPLER_1D_EXT (36305)
GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT (36311)
GL_UNSIGNED_INT_SAMPLER_2D_EXT (36306)
GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT (36309)
GL_UNSIGNED_INT_SAMPLER_3D_EXT (36307)
GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT (36312)
GL_UNSIGNED_INT_SAMPLER_CUBE_EXT (36308)
GL_UNSIGNED_INT_VEC2_EXT (36294)
GL_UNSIGNED_INT_VEC3_EXT (36295)
GL_UNSIGNED_INT_VEC4_EXT (36296)
GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT (35069)