| # Tokens for WebGL 2.0 Shader Language. |
| # TODO: Seperate tokens for vertex shaders into seperate file for use by |
| # swiftshader_vertex_routine_fuzzer. |
| |
| # Preprocessor tokens |
| "#" |
| "#define" |
| "#undef" |
| "#if" |
| "#ifdef" |
| "#ifndef" |
| "#else" |
| "#elif" |
| "#endif" |
| "#error" |
| "#pragma" |
| "#extension" |
| "#version" |
| "#line" |
| "defined" |
| "#macros" |
| "__LINE__" |
| "__FILE__" |
| "__VERSION__" |
| "GL_ES" |
| |
| # Fragment shaders only |
| "GL_FRAGMENT_PRECISION_HIGH" |
| |
| # Language tokens |
| "(" |
| ")" |
| "+" |
| "-" |
| "~" |
| "!" |
| "*" |
| "/" |
| "%" |
| "+" |
| "-" |
| "<<" |
| ">>" |
| "<" |
| ">" |
| "<=" |
| ">=" |
| "==" |
| "!=" |
| "+=" |
| "-=" |
| "*=" |
| "/=" |
| "%=" |
| "<<=" |
| ">>=" |
| ";" |
| "," |
| "." |
| "[" |
| "]" |
| "++" |
| "--" |
| "&" |
| "^" |
| "|" |
| "&&" |
| "||" |
| |
| # Keywords |
| " attribute " |
| " const " |
| " uniform " |
| " varying " |
| " break " |
| " continue " |
| " do " |
| " for " |
| " while " |
| " if " |
| " else " |
| " in " |
| " out " |
| " inout " |
| " float " |
| " int " |
| " void " |
| " bool " |
| " true " |
| " false " |
| " lowp " |
| " mediump " |
| " highp " |
| " precision " |
| " invariant " |
| " discard " |
| " return" |
| |
| # Types, include valid examples and partial ones (that are invalid on their own) |
| " mat2(" |
| " mat2(1.0)" |
| " mat2(1.0,2.0,3.0,4.0)" |
| " mat3(vec2(1.0, 1.0),1.0,vec2(1.0, 1.0),1.0,vec2(1.0, 1.0),1.0)" |
| " mat3(1.0)" |
| " mat3(" |
| " mat4(" |
| " mat4(1.0)" |
| " mat4(vec4(1.0),vec4(1.0,2.0,3.0,4.0),vec4(3.3),vec4(4.4))" |
| "vec2" |
| " vec2(1)" |
| " vec3(1)" |
| " vec3" |
| " vec4(1)" |
| " vec4" |
| " ivec2(1) " |
| " ivec2" |
| " ivec3(1)" |
| " ivec3" |
| " ivec4(1)" |
| " ivec4" |
| " bvec2(true)" |
| " bvec2" |
| " bvec3(true)" |
| " bvec3" |
| " bvec4(true)" |
| " bvec4" |
| " sampler2D " |
| " samplerCube " |
| " struct " |
| " sampler3D " |
| " samplerCube " |
| " sampler2DShadow " |
| " sampler2DArray " |
| " sampler2DArrayShadow " |
| " sampler2DMS " |
| " samplerCubeShadow " |
| " isampler2D " |
| " isampler3D " |
| " isamplerCube " |
| " isampler2DArray " |
| " isampler2DMS " |
| " usampler2D " |
| " usampler3D " |
| " usampler2DArray " |
| " usampler2DMS " |
| " usamplerCube " |
| " image2D " |
| " image3D " |
| " imageCube " |
| " image2DArray " |
| " iimage2D " |
| " iimage3D " |
| " iimageCube " |
| " iimage2DArray " |
| " uimage2D " |
| " uimage3D " |
| " uimageCube " |
| " uimage2DArray " |
| " atomic_uint " |
| |
| # Builtin Variables |
| "gl_Position" |
| "gl_FragColor" |
| "gl_FragData" |
| "gl_FrontFacing" |
| "gl_PointCoord" |
| "gl_MaxDrawBuffers" |
| "gl_MaxFragmentUniformVectors" |
| "gl_MaxTextureImageUnits" |
| "gl_MaxCombinedTextureImageUnits" |
| "gl_MaxVertexTextureImageUnits" |
| "gl_MaxVaryingVectors" |
| "gl_MaxVertexUniformVectors" |
| "gl_MaxVertexAttribs" |
| "gl_FragCoord.x" |
| "gl_FragCoord.y" |
| "gl_FragCoord.z" |
| "gl_FragData" |
| "gl_FragDepth" |
| "gl_InstanceID" |
| "gl_NumWorkGroups" |
| "gl_PointSize" |
| "gl_VertexID" |
| |
| # misc. |
| "void main(){" |
| |
| # Generated calls to builtin functions. |
| " pow(1.0,1.0)" |
| " fract(1.0)" |
| " dFdx(1.0)" |
| " step(1.0,1.0)" |
| " min(1,1)" |
| " min(1.0,1.0)" |
| " dot(1.0,1.0)" |
| " greaterThanEqual(uvec2(1,2),uvec2(1,2))" |
| " asin(1.0)" |
| " lessThanEqual(ivec2(1,-2),ivec2(1,-2))" |
| " inversesqrt(1.0)" |
| " length(1.0)" |
| " acosh(1.0)" |
| " roundEven(1.0)" |
| " greaterThanEqual(ivec2(1,-2),ivec2(1,-2))" |
| " greaterThan(uvec2(1,2),uvec2(1,2))" |
| " radians(1.0)" |
| " asinh(1.0)" |
| " uintBitsToFloat(1)" |
| " cos(1.0)" |
| " ceil(1.0)" |
| " equal(uvec2(1,2),uvec2(1,2))" |
| " normalize(1.0)" |
| " distance(1.0,1.0)" |
| " abs(1)" |
| " clamp(1.0,1.0,1.0)" |
| " tan(1.0)" |
| " smoothstep(1.0,1.0,1.0)" |
| " isinf(1.0)" |
| " not(bvec2(true,false))" |
| " degrees(1.0)" |
| " mix(1.0,1.0,true)" |
| " max(1.0,1.0)" |
| " lessThanEqual(uvec2(1,2),uvec2(1,2))" |
| " round(1.0)" |
| " atan(1.0,1.0)" |
| " floatBitsToInt(1.0)" |
| " abs(1.0)" |
| " fwidth(1.0)" |
| " lessThan(ivec2(1,-2),ivec2(1,-2))" |
| " intBitsToFloat(1)" |
| " mix(1.0,1.0,1.0)" |
| " notEqual(uvec2(1,2),uvec2(1,2))" |
| " floor(1.0)" |
| " refract(1.0,1.0,1.0)" |
| " equal(ivec2(1,-2),ivec2(1,-2))" |
| " max(1,1)" |
| " cosh(1.0)" |
| " isnan(1.0)" |
| " sign(1)" |
| " mod(1.0,1.0)" |
| " acos(1.0)" |
| " sinh(1.0)" |
| " greaterThan(ivec2(1,-2),ivec2(1,-2))" |
| " exp2(1.0)" |
| " notEqual(bvec2(true,false),bvec2(true,false))" |
| " reflect(1.0,1.0)" |
| " lessThan(uvec2(1,2),uvec2(1,2))" |
| " sqrt(1.0)" |
| " sign(1.0)" |
| " clamp(1,1,1)" |
| " sin(1.0)" |
| " atan(1.0)" |
| " tanh(1.0)" |
| " dFdy(1.0)" |
| " notEqual(ivec2(1,-2),ivec2(1,-2))" |
| " trunc(1.0)" |
| " log2(1.0)" |
| " equal(bvec2(true,false),bvec2(true,false))" |
| " atanh(1.0)" |
| " exp(1.0)" |
| " faceforward(1.0,1.0,1.0)" |
| " floatBitsToUint(1.0)" |
| " log(1.0)" |