Upload
warren-rogers
View
219
Download
4
Embed Size (px)
Citation preview
arb-glsl workgroupUpdate
Bill Licea-Kane
ATI Research, Inc.
arb-glsl workgroupOpenGL Shading Language• OpenGL Shading Language• OpenGL ES Shading Language
– EVOLVING TOGETHER IN PARALLEL
arb-glsl workgroupOpenGL Shading Language
#version 120• Can link shaders with mixed versions• Special Variables• Qualifiers• Minor changes (some backward incompatible)
– Names– Function Signatures– Arrays– Matrices
• ARB_texture_shader_lod
arb-glsl workgroupOpenGL Shading Language• built-in fragment special variables
– Based on OpenGL ES 2.0– Values are undefined if GL_POINT_SPRITE disabled
gl_PointCoord;
• qualifier
vec4 centroid varying Texcoord;
arb-glsl workgroupOpenGL Shading Language
arb-glsl workgroupOpenGL Shading Language
• Names – slight changes from #version 110– C++ like– Names hide names of all types
• Functions, Variables, Structures– Can declare names within a scope
• Exception – local functions declarations disallowed• Exception – can not redeclare within a scope
– Built-in functions in “outermost scope”• A local name hides *ALL* outer names
arb-glsl workgroupOpenGL Shading Language
• Example
#version 120
// ...
vec4 texture2D( sampler2D s, vec4 P )
{
return vec4( 1.0, 0.0, 1.0, 1.0 );
}
// ...
vec4 texture2D = texture2D( tex0, P.st );
arb-glsl workgroupOpenGL Shading Language• Signature matching• First try to find an exact match• Else try limited implicit constructors:
– int float– ivec2 vec2– ivec3 vec3– ivec4 vec4
• If multiple implicit matches, error
arb-glsl workgroupOpenGL Shading Language• Arrays
– Now first class– ==, !=, = (but must have explicit size)– Array constructors
float[7]( 0.0,1.0,2.0,3.0,4.0,5.0,6.0 )float[]( 0.0,1.0,2.0,3.0,4.0,5.0,6.0 )
float a[] = float[]( 0.0, 1.0, 2.0 );
arb-glsl workgroupOpenGL Shading Language• Matrices
– non-square permitted
mat2x3 // 2 columns by 3 rows
outerProduct()
transpose()– Additional constructors
arb-glsl workgroupOpenGL Shading Language• built-in functions
– Based on ATI_shader_texture_lod
texture2DLod( sampler2D s, vec2 P,
float Lod );
texture2DGradARB( sampler2D s, vec2 P,
vec2 dPdx, vec2 dPdy );
texture2DProjGradARB( sampler2D s, vec2 P,
vec2 dPdx, vec2 dPdy );
arb-glsl workgroupPixel grids and area operators