]> git.tdb.fi Git - libs/gl.git/blobdiff - builtin_data/_builtin.glsl
Add support for integer vertex attributes
[libs/gl.git] / builtin_data / _builtin.glsl
index 124a117b120397ec6a56d1345080f6a175eddce7..1bdfde13306cb347c061dd29d85a7dbb0acb9f77 100644 (file)
@@ -18,6 +18,10 @@ typedef vector(2) int ivec2;
 typedef vector(3) int ivec3;
 typedef vector(4) int ivec4;
 
+typedef vector(2) uint uvec2;
+typedef vector(3) uint uvec3;
+typedef vector(4) uint uvec4;
+
 typedef vector(2) bool bvec2;
 typedef vector(3) bool bvec3;
 typedef vector(4) bool bvec4;
@@ -36,6 +40,8 @@ typedef image(dimensions=2[], shadow, sampled) float sampler2DArrayShadow;
 typedef image(dimensions=cube, shadow, sampled) float samplerCubeShadow;
 typedef image(dimensions=cube[], shadow, sampled) float samplerCubeArrayShadow;
 
+const float PI = 3.1415926535;
+
 // BEGIN BUILTIN FUNCTIONS
 float radians(float degrees);
 vec2 radians(vec2 degrees);
@@ -180,12 +186,19 @@ int min(int x, int y);
 ivec2 min(ivec2 x, ivec2 y);
 ivec3 min(ivec3 x, ivec3 y);
 ivec4 min(ivec4 x, ivec4 y);
+uint min(uint x, uint y);
+uvec2 min(uvec2 x, uvec2 y);
+uvec3 min(uvec3 x, uvec3 y);
+uvec4 min(uvec4 x, uvec4 y);
 vec2 min(vec2 x, float y) { return min(x, vec2(y)); }
 vec3 min(vec3 x, float y) { return min(x, vec3(y)); }
 vec4 min(vec4 x, float y) { return min(x, vec4(y)); }
 ivec2 min(ivec2 x, int y) { return min(x, ivec2(y)); }
 ivec3 min(ivec3 x, int y) { return min(x, ivec3(y)); }
 ivec4 min(ivec4 x, int y) { return min(x, ivec4(y)); }
+uvec2 min(uvec2 x, uint y) { return min(x, uvec2(y)); }
+uvec3 min(uvec3 x, uint y) { return min(x, uvec3(y)); }
+uvec4 min(uvec4 x, uint y) { return min(x, uvec4(y)); }
 float max(float x, float y);
 vec2 max(vec2 x, vec2 y);
 vec3 max(vec3 x, vec3 y);
@@ -194,12 +207,19 @@ int max(int x, int y);
 ivec2 max(ivec2 x, ivec2 y);
 ivec3 max(ivec3 x, ivec3 y);
 ivec4 max(ivec4 x, ivec4 y);
+uint max(uint x, uint y);
+uvec2 max(uvec2 x, uvec2 y);
+uvec3 max(uvec3 x, uvec3 y);
+uvec4 max(uvec4 x, uvec4 y);
 vec2 max(vec2 x, float y) { return max(x, vec2(y)); }
 vec3 max(vec3 x, float y) { return max(x, vec3(y)); }
 vec4 max(vec4 x, float y) { return max(x, vec4(y)); }
 ivec2 max(ivec2 x, int y) { return max(x, ivec2(y)); }
 ivec3 max(ivec3 x, int y) { return max(x, ivec3(y)); }
 ivec4 max(ivec4 x, int y) { return max(x, ivec4(y)); }
+uvec2 max(uvec2 x, uint y) { return max(x, uvec2(y)); }
+uvec3 max(uvec3 x, uint y) { return max(x, uvec3(y)); }
+uvec4 max(uvec4 x, uint y) { return max(x, uvec4(y)); }
 float clamp(float x, float minVal, float maxVal);
 vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
 vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
@@ -208,12 +228,19 @@ int clamp(int x, int minVal, int maxVal);
 ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal);
 ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal);
 ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal);
+uint clamp(uint x, uint minVal, uint maxVal);
+uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal);
+uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal);
+uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal);
 vec2 clamp(vec2 x, float minVal, float maxVal) { return clamp(x, vec2(minVal), vec2(maxVal)); }
 vec3 clamp(vec3 x, float minVal, float maxVal) { return clamp(x, vec3(minVal), vec3(maxVal)); }
 vec4 clamp(vec4 x, float minVal, float maxVal) { return clamp(x, vec4(minVal), vec4(maxVal)); }
 ivec2 clamp(ivec2 x, int minVal, int maxVal) { return clamp(x, ivec2(minVal), ivec2(maxVal)); }
 ivec3 clamp(ivec3 x, int minVal, int maxVal) { return clamp(x, ivec3(minVal), ivec3(maxVal)); }
 ivec4 clamp(ivec4 x, int minVal, int maxVal) { return clamp(x, ivec4(minVal), ivec4(maxVal)); }
+uvec2 clamp(uvec2 x, uint minVal, uint maxVal) { return clamp(x, uvec2(minVal), uvec2(maxVal)); }
+uvec3 clamp(uvec3 x, uint minVal, uint maxVal) { return clamp(x, uvec3(minVal), uvec3(maxVal)); }
+uvec4 clamp(uvec4 x, uint minVal, uint maxVal) { return clamp(x, uvec4(minVal), uvec4(maxVal)); }
 float mix(float x, float y, float a);
 vec2 mix(vec2 x, vec2 y, vec2 a);
 vec3 mix(vec3 x, vec3 y, vec3 a);
@@ -230,6 +257,10 @@ int mix(int x, int y, bool a);
 ivec2 mix(ivec2 x, ivec2 y, bvec2 a);
 ivec3 mix(ivec3 x, ivec3 y, bvec3 a);
 ivec4 mix(ivec4 x, ivec4 y, bvec4 a);
+uint mix(uint x, uint y, bool a);
+uvec2 mix(uvec2 x, uvec2 y, bvec2 a);
+uvec3 mix(uvec3 x, uvec3 y, bvec3 a);
+uvec4 mix(uvec4 x, uvec4 y, bvec4 a);
 float step(float edge, float x);
 vec2 step(vec2 edge, vec2 x);
 vec3 step(vec3 edge, vec3 x);
@@ -268,7 +299,7 @@ float dot(float x, float y);
 float dot(vec2 x, vec2 y);
 float dot(vec3 x, vec3 y);
 float dot(vec4 x, vec4 y);
-vec3 cross(vec3 x);
+vec3 cross(vec3 x, vec3 y);
 float normalize(float x);
 vec2 normalize(vec2 x);
 vec3 normalize(vec3 x);
@@ -324,36 +355,54 @@ bvec4 lessThan(vec4 x, vec4 y);
 bvec2 lessThan(ivec2 x, ivec2 y);
 bvec3 lessThan(ivec3 x, ivec3 y);
 bvec4 lessThan(ivec4 x, ivec4 y);
+bvec2 lessThan(uvec2 x, uvec2 y);
+bvec3 lessThan(uvec3 x, uvec3 y);
+bvec4 lessThan(uvec4 x, uvec4 y);
 bvec2 lessThanEqual(vec2 x, vec2 y);
 bvec3 lessThanEqual(vec3 x, vec3 y);
 bvec4 lessThanEqual(vec4 x, vec4 y);
 bvec2 lessThanEqual(ivec2 x, ivec2 y);
 bvec3 lessThanEqual(ivec3 x, ivec3 y);
 bvec4 lessThanEqual(ivec4 x, ivec4 y);
+bvec2 lessThanEqual(uvec2 x, uvec2 y);
+bvec3 lessThanEqual(uvec3 x, uvec3 y);
+bvec4 lessThanEqual(uvec4 x, uvec4 y);
 bvec2 greaterThan(vec2 x, vec2 y);
 bvec3 greaterThan(vec3 x, vec3 y);
 bvec4 greaterThan(vec4 x, vec4 y);
 bvec2 greaterThan(ivec2 x, ivec2 y);
 bvec3 greaterThan(ivec3 x, ivec3 y);
 bvec4 greaterThan(ivec4 x, ivec4 y);
+bvec2 greaterThan(uvec2 x, uvec2 y);
+bvec3 greaterThan(uvec3 x, uvec3 y);
+bvec4 greaterThan(uvec4 x, uvec4 y);
 bvec2 greaterThanEqual(vec2 x, vec2 y);
 bvec3 greaterThanEqual(vec3 x, vec3 y);
 bvec4 greaterThanEqual(vec4 x, vec4 y);
 bvec2 greaterThanEqual(ivec2 x, ivec2 y);
 bvec3 greaterThanEqual(ivec3 x, ivec3 y);
 bvec4 greaterThanEqual(ivec4 x, ivec4 y);
+bvec2 greaterThanEqual(uvec2 x, uvec2 y);
+bvec3 greaterThanEqual(uvec3 x, uvec3 y);
+bvec4 greaterThanEqual(uvec4 x, uvec4 y);
 bvec2 equal(vec2 x, vec2 y);
 bvec3 equal(vec3 x, vec3 y);
 bvec4 equal(vec4 x, vec4 y);
 bvec2 equal(ivec2 x, ivec2 y);
 bvec3 equal(ivec3 x, ivec3 y);
 bvec4 equal(ivec4 x, ivec4 y);
+bvec2 equal(uvec2 x, uvec2 y);
+bvec3 equal(uvec3 x, uvec3 y);
+bvec4 equal(uvec4 x, uvec4 y);
 bvec2 notEqual(vec2 x, vec2 y);
 bvec3 notEqual(vec3 x, vec3 y);
 bvec4 notEqual(vec4 x, vec4 y);
 bvec2 notEqual(ivec2 x, ivec2 y);
 bvec3 notEqual(ivec3 x, ivec3 y);
 bvec4 notEqual(ivec4 x, ivec4 y);
+bvec2 notEqual(uvec2 x, uvec2 y);
+bvec3 notEqual(uvec3 x, uvec3 y);
+bvec4 notEqual(uvec4 x, uvec4 y);
 bool any(bvec2 x);
 bool any(bvec3 x);
 bool any(bvec4 x);
@@ -367,26 +416,50 @@ int bitfieldExtract(int value, int offset, int bits);
 ivec2 bitfieldExtract(ivec2 value, int offset, int bits);
 ivec3 bitfieldExtract(ivec3 value, int offset, int bits);
 ivec4 bitfieldExtract(ivec4 value, int offset, int bits);
+uint bitfieldExtract(uint value, int offset, int bits);
+uvec2 bitfieldExtract(uvec2 value, int offset, int bits);
+uvec3 bitfieldExtract(uvec3 value, int offset, int bits);
+uvec4 bitfieldExtract(uvec4 value, int offset, int bits);
 int bitfieldInsert(int value, int insert, int offset, int bits);
 ivec2 bitfieldInsert(ivec2 value, ivec2 insert, int offset, int bits);
 ivec3 bitfieldInsert(ivec3 value, ivec3 insert, int offset, int bits);
 ivec4 bitfieldInsert(ivec4 value, ivec4 insert, int offset, int bits);
+uint bitfieldInsert(uint value, uint insert, int offset, int bits);
+uvec2 bitfieldInsert(uvec2 value, uvec2 insert, int offset, int bits);
+uvec3 bitfieldInsert(uvec3 value, uvec3 insert, int offset, int bits);
+uvec4 bitfieldInsert(uvec4 value, uvec4 insert, int offset, int bits);
 int bitfieldReverse(int value);
 ivec2 bitfieldReverse(ivec2 value);
 ivec3 bitfieldReverse(ivec3 value);
 ivec4 bitfieldReverse(ivec4 value);
+uint bitfieldReverse(uint value);
+uvec2 bitfieldReverse(uvec2 value);
+uvec3 bitfieldReverse(uvec3 value);
+uvec4 bitfieldReverse(uvec4 value);
 int bitCount(int value);
 ivec2 bitCount(ivec2 value);
 ivec3 bitCount(ivec3 value);
 ivec4 bitCount(ivec4 value);
+uint bitCount(uint value);
+uvec2 bitCount(uvec2 value);
+uvec3 bitCount(uvec3 value);
+uvec4 bitCount(uvec4 value);
 int findLSB(int value);
 ivec2 findLSB(ivec2 value);
 ivec3 findLSB(ivec3 value);
 ivec4 findLSB(ivec4 value);
+int findLSB(uint value);
+ivec2 findLSB(uvec2 value);
+ivec3 findLSB(uvec3 value);
+ivec4 findLSB(uvec4 value);
 int findMSB(int value);
 ivec2 findMSB(ivec2 value);
 ivec3 findMSB(ivec3 value);
 ivec4 findMSB(ivec4 value);
+int findMSB(uint value);
+ivec2 findMSB(uvec2 value);
+ivec3 findMSB(uvec3 value);
+ivec4 findMSB(uvec4 value);
 int textureSize(sampler1D sampler, int lod);
 ivec2 textureSize(sampler2D sampler, int lod);
 ivec3 textureSize(sampler3D sampler, int lod);
@@ -400,6 +473,32 @@ ivec2 textureSize(samplerCubeShadow sampler, int lod);
 ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
 ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
 ivec3 textureSize(samplerCubeArrayShadow sampler, int lod);
+vec2 textureQueryLod(sampler1D sampler, float P);
+vec2 textureQueryLod(sampler2D sampler, vec2 P);
+vec2 textureQueryLod(sampler3D sampler, vec3 P);
+vec2 textureQueryLod(sampler1DArray sampler, float P);
+vec2 textureQueryLod(sampler2DArray sampler, vec2 P);
+vec2 textureQueryLod(samplerCube sampler, vec3 P);
+vec2 textureQueryLod(samplerCubeArray sampler, vec3 P);
+vec2 textureQueryLod(sampler1DShadow sampler, float P);
+vec2 textureQueryLod(sampler2DShadow sampler, vec2 P);
+vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P);
+vec2 textureQueryLod(sampler1DArrayShadow sampler, float P);
+vec2 textureQueryLod(sampler2DArrayShadow sampler, vec2 P);
+vec2 textureQueryLod(samplerCubeArrayShadow sampler, vec3 P);
+int textureQueryLevels(sampler1D sampler);
+int textureQueryLevels(sampler2D sampler);
+int textureQueryLevels(sampler3D sampler);
+int textureQueryLevels(sampler1DArray sampler);
+int textureQueryLevels(sampler2DArray sampler);
+int textureQueryLevels(samplerCube sampler);
+int textureQueryLevels(samplerCubeArray sampler);
+int textureQueryLevels(sampler1DShadow sampler);
+int textureQueryLevels(sampler2DShadow sampler);
+int textureQueryLevels(samplerCubeShadow sampler);
+int textureQueryLevels(sampler1DArrayShadow sampler);
+int textureQueryLevels(sampler2DArrayShadow sampler);
+int textureQueryLevels(samplerCubeArrayShadow sampler);
 vec4 texture(sampler1D sampler, float P);
 vec4 texture(sampler2D sampler, vec2 P);
 vec4 texture(sampler3D sampler, vec3 P);