X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=builtin_data%2F_builtin.glsl;h=124a117b120397ec6a56d1345080f6a175eddce7;hp=aa36d5c601d3bf13e055c5f9df01c5fda4828322;hb=305b62cf4f7e2a4ca3cc56109003aed6bde61c25;hpb=fe7996a5985e8e7064004d2f42758d89ebf54b57 diff --git a/builtin_data/_builtin.glsl b/builtin_data/_builtin.glsl index aa36d5c6..124a117b 100644 --- a/builtin_data/_builtin.glsl +++ b/builtin_data/_builtin.glsl @@ -169,13 +169,9 @@ float mod(float x, float y); vec2 mod(vec2 x, vec2 y); vec3 mod(vec3 x, vec3 y); vec4 mod(vec4 x, vec4 y); -vec2 mod(vec2 x, float y); -vec3 mod(vec3 x, float y); -vec4 mod(vec4 x, float y); -float modf(float x, out float y); -vec2 modf(vec2 x, out vec2 y); -vec3 modf(vec3 x, out vec3 y); -vec4 modf(vec4 x, out vec4 y); +vec2 mod(vec2 x, float y) { return mod(x, vec2(y)); } +vec3 mod(vec3 x, float y) { return mod(x, vec3(y)); } +vec4 mod(vec4 x, float y) { return mod(x, vec4(y)); } float min(float x, float y); vec2 min(vec2 x, vec2 y); vec3 min(vec3 x, vec3 y); @@ -184,12 +180,12 @@ int min(int x, int y); ivec2 min(ivec2 x, ivec2 y); ivec3 min(ivec3 x, ivec3 y); ivec4 min(ivec4 x, ivec4 y); -vec2 min(vec2 x, float y); -vec3 min(vec3 x, float y); -vec4 min(vec4 x, float y); -ivec2 min(ivec2 x, int y); -ivec3 min(ivec3 x, int y); -ivec4 min(ivec4 x, int 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)); } float max(float x, float y); vec2 max(vec2 x, vec2 y); vec3 max(vec3 x, vec3 y); @@ -198,12 +194,12 @@ int max(int x, int y); ivec2 max(ivec2 x, ivec2 y); ivec3 max(ivec3 x, ivec3 y); ivec4 max(ivec4 x, ivec4 y); -vec2 max(vec2 x, float y); -vec3 max(vec3 x, float y); -vec4 max(vec4 x, float y); -ivec2 max(ivec2 x, int y); -ivec3 max(ivec3 x, int y); -ivec4 max(ivec4 x, int 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)); } float clamp(float x, float minVal, float maxVal); vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); @@ -212,19 +208,20 @@ 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); -vec2 clamp(vec2 x, float minVal, float maxVal); -vec3 clamp(vec3 x, float minVal, float maxVal); -vec4 clamp(vec4 x, float minVal, float maxVal); -ivec2 clamp(ivec2 x, int minVal, int maxVal); -ivec3 clamp(ivec3 x, int minVal, int maxVal); -ivec4 clamp(ivec4 x, int minVal, int 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)); } float mix(float x, float y, float a); vec2 mix(vec2 x, vec2 y, vec2 a); vec3 mix(vec3 x, vec3 y, vec3 a); vec4 mix(vec4 x, vec4 y, vec4 a); -vec2 mix(vec2 x, vec2 y, float a); -vec3 mix(vec3 x, vec3 y, float a); -vec4 mix(vec4 x, vec4 y, float a); +float mix(float x, float y, float a) { return mix(x, y, float(a)); } +vec2 mix(vec2 x, vec2 y, float a) { return mix(x, y, vec2(a)); } +vec3 mix(vec3 x, vec3 y, float a) { return mix(x, y, vec3(a)); } +vec4 mix(vec4 x, vec4 y, float a) { return mix(x, y, vec4(a)); } float mix(float x, float y, bool a); vec2 mix(vec2 x, vec2 y, bvec2 a); vec3 mix(vec3 x, vec3 y, bvec3 a); @@ -237,16 +234,16 @@ float step(float edge, float x); vec2 step(vec2 edge, vec2 x); vec3 step(vec3 edge, vec3 x); vec4 step(vec4 edge, vec4 x); -vec2 step(float edge, vec2 x); -vec3 step(float edge, vec3 x); -vec4 step(float edge, vec4 x); +vec2 step(float edge, vec2 x) { return step(vec2(edge), x); } +vec3 step(float edge, vec3 x) { return step(vec3(edge), x); } +vec4 step(float edge, vec4 x) { return step(vec4(edge), x); } float smoothstep(float edge0, float edge1, float x); vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); -vec2 smoothstep(float edge0, float edge1, vec2 x); -vec3 smoothstep(float edge0, float edge1, vec3 x); -vec4 smoothstep(float edge0, float edge1, vec4 x); +vec2 smoothstep(float edge0, float edge1, vec2 x) { return smoothstep(vec2(edge0), vec2(edge1), x); } +vec3 smoothstep(float edge0, float edge1, vec3 x) { return smoothstep(vec3(edge0), vec3(edge1), x); } +vec4 smoothstep(float edge0, float edge1, vec4 x) { return smoothstep(vec4(edge0), vec4(edge1), x); } bool isnan(float x); bvec2 isnan(vec2 x); bvec3 isnan(vec3 x); @@ -255,26 +252,10 @@ bool isinf(float x); bvec2 isinf(vec2 x); bvec3 isinf(vec3 x); bvec4 isinf(vec4 x); -int floatBitsToInt(float value); -ivec2 floatBitsToInt(vec2 value); -ivec3 floatBitsToInt(vec3 value); -ivec4 floatBitsToInt(vec4 value); -float intBitsToFloat(int value); -vec2 intBitsToFloat(ivec2 value); -vec3 intBitsToFloat(ivec3 value); -vec4 intBitsToFloat(ivec4 value); float fma(float a, float b, float c); vec2 fma(vec2 a, vec2 b, vec2 c); vec3 fma(vec3 a, vec3 b, vec3 c); vec4 fma(vec4 a, vec4 b, vec4 c); -float frexp(float x, out int exp); -vec2 frexp(vec2 x, out ivec2 exp); -vec3 frexp(vec3 x, out ivec3 exp); -vec4 frexp(vec4 x, out ivec4 exp); -float ldexp(float x, int exp); -vec2 ldexp(vec2 x, ivec2 exp); -vec3 ldexp(vec3 x, ivec3 exp); -vec4 ldexp(vec4 x, ivec4 exp); float length(float x); float length(vec2 x); float length(vec3 x); @@ -296,14 +277,14 @@ float faceforward(float N, float I, float Nref); vec2 faceforward(vec2 N, vec2 I, vec2 Nref); vec3 faceforward(vec3 N, vec3 I, vec3 Nref); vec4 faceforward(vec4 N, vec4 I, vec4 Nref); -float reflect(float N, float I); -vec2 reflect(vec2 N, vec2 I); -vec3 reflect(vec3 N, vec3 I); -vec4 reflect(vec4 N, vec4 I); -float refract(float N, float I, float eta); -vec2 refract(vec2 N, vec2 I, float eta); -vec3 refract(vec3 N, vec3 I, float eta); -vec4 refract(vec4 N, vec4 I, float eta); +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); mat2 matrixCompMult(mat2 x, mat2 y); mat3 matrixCompMult(mat3 x, mat3 y); mat4 matrixCompMult(mat4 x, mat4 y); @@ -382,10 +363,6 @@ bool all(bvec4 x); bool not(bvec2 x); bool not(bvec3 x); bool not(bvec4 x); -void imulExtended(int x, int y, out int msb, out int lsb); -void imulExtended(ivec2 x, ivec2 y, out ivec2 msb, out ivec2 lsb); -void imulExtended(ivec3 x, ivec3 y, out ivec3 msb, out ivec3 lsb); -void imulExtended(ivec4 x, ivec4 y, out ivec4 msb, out ivec4 lsb); int bitfieldExtract(int value, int offset, int bits); ivec2 bitfieldExtract(ivec2 value, int offset, int bits); ivec3 bitfieldExtract(ivec3 value, int offset, int bits); @@ -468,6 +445,7 @@ in gl_PerVertex float gl_ClipDistance[]; } gl_in[]; in int gl_PrimitiveIDIn; +in int gl_InvocationID; out gl_PerVertex { vec4 gl_Position;