Cleanup: remove GLSL version checks

This commit is contained in:
Campbell Barton 2017-05-17 10:46:42 +10:00
parent c8bf3984ee
commit 8adec78ca5
75 changed files with 244 additions and 753 deletions

View File

@ -10,14 +10,9 @@ uniform float image_texture_width;
uniform float image_texture_height;
#endif
#if __VERSION__ < 130
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#ifdef USE_CURVE_MAPPING
/* Curve mapping parameters

View File

@ -1,15 +1,9 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 texCoord;
attribute vec2 pos;
varying vec2 texCoord_interp;
#else
in vec2 texCoord;
in vec2 pos;
out vec2 texCoord_interp;
#endif
in vec2 texCoord;
in vec2 pos;
out vec2 texCoord_interp;
void main()
{

View File

@ -29,22 +29,11 @@ struct VertexData {
vec2 uv;
};
#if __VERSION__ >= 150
layout(lines_adjacency) in;
#ifdef WIREFRAME
#ifdef WIREFRAME
layout(line_strip, max_vertices = 8) out;
#else
layout(triangle_strip, max_vertices = 4) out;
#endif
#else
#extension GL_EXT_geometry_shader4: require
/* application provides input/output layout info */
#endif
#if __VERSION__ < 140
#extension GL_ARB_uniform_buffer_object: require
#extension GL_ARB_texture_buffer_object: enable
#extension GL_EXT_texture_buffer_object: enable
layout(triangle_strip, max_vertices = 4) out;
#endif
uniform mat4 modelViewMatrix;

View File

@ -43,11 +43,4 @@ void main()
{
outpt.v.position = modelViewMatrix * position;
outpt.v.normal = normalize(normalMatrix * normal);
#if __VERSION__ < 140
/* Some compilers expects gl_Position to be written.
* It's not needed once we explicitly switch to GLSL 1.40 or above.
*/
gl_Position = outpt.v.position;
#endif
}

View File

@ -4,11 +4,7 @@ flat in int vertFlag;
#define VERTEX_SELECTED (1 << 0)
#define VERTEX_ACTIVE (1 << 1)
#if __VERSION__ == 120
#define FragColor gl_FragColor
#else
out vec4 FragColor;
#endif
out vec4 FragColor;
void main()
{

View File

@ -4,11 +4,7 @@ flat in int vertFlag;
#define VERTEX_SELECTED (1 << 0)
#define VERTEX_ACTIVE (1 << 1)
#if __VERSION__ == 120
#define FragColor gl_FragColor
#else
out vec4 FragColor;
#endif
out vec4 FragColor;
void main()
{

View File

@ -1,17 +1,10 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec4 color;
in vec2 pos;
in vec4 color;
flat varying vec4 finalColor;
#else
in vec2 pos;
in vec4 color;
flat out vec4 finalColor;
#endif
flat out vec4 finalColor;
void main()
{

View File

@ -2,15 +2,9 @@
uniform mat4 ModelViewProjectionMatrix;
/* Keep in sync with intern/opencolorio/gpu_shader_display_transform_vertex.glsl */
#if __VERSION__ == 120
attribute vec2 texCoord;
attribute vec2 pos;
varying vec2 texCoord_interp;
#else
in vec2 texCoord;
in vec2 pos;
out vec2 texCoord_interp;
#endif
in vec2 texCoord;
in vec2 pos;
out vec2 texCoord_interp;
void main()
{

View File

@ -1,13 +1,8 @@
// Draw dashed lines, perforated in screen space.
#if __VERSION__ == 120
noperspective varying float distance_along_line;
#define fragColor gl_FragColor
#else
noperspective in float distance_along_line;
out vec4 fragColor;
#endif
noperspective in float distance_along_line;
out vec4 fragColor;
uniform float dash_width;

View File

@ -5,13 +5,8 @@
uniform mat4 ModelViewProjectionMatrix;
uniform vec2 viewport_size;
#if __VERSION__ == 120
attribute vec2 pos;
noperspective varying float distance_along_line;
#else
in vec2 pos;
noperspective out float distance_along_line;
#endif
in vec2 pos;
noperspective out float distance_along_line;
void main()
{

View File

@ -3,11 +3,7 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
#else
in vec2 pos;
#endif
in vec2 pos;
void main()
{

View File

@ -2,13 +2,8 @@
uniform mat4 ModelViewProjectionMatrix;
uniform float size;
#if __VERSION__ == 120
attribute vec2 pos;
varying vec2 radii;
#else
in vec2 pos;
out vec2 radii;
#endif
in vec2 pos;
out vec2 radii;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@ -3,13 +3,8 @@ uniform mat4 ModelViewProjectionMatrix;
uniform float size;
uniform float outlineWidth;
#if __VERSION__ == 120
attribute vec2 pos;
varying vec4 radii;
#else
in vec2 pos;
out vec4 radii;
#endif
in vec2 pos;
out vec4 radii;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@ -3,17 +3,10 @@ uniform mat4 ModelViewProjectionMatrix;
uniform float size;
uniform float outlineWidth;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec4 color;
varying vec4 radii;
varying vec4 fillColor;
#else
in vec2 pos;
in vec4 color;
out vec4 radii;
out vec4 fillColor;
#endif
in vec2 pos;
in vec4 color;
out vec4 radii;
out vec4 fillColor;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@ -1,17 +1,10 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
attribute float size;
attribute vec4 color;
varying vec4 finalColor;
#else
in vec2 pos;
in float size;
in vec4 color;
out vec4 finalColor;
#endif
in vec2 pos;
in float size;
in vec4 color;
out vec4 finalColor;
void main()
{

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
noperspective varying vec4 finalColor;
#define fragColor gl_FragColor
#else
noperspective in vec4 finalColor;
out vec4 fragColor;
#endif
noperspective in vec4 finalColor;
out vec4 fragColor;
void main()
{

View File

@ -1,17 +1,10 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec4 color;
in vec2 pos;
in vec4 color;
noperspective varying vec4 finalColor;
#else
in vec2 pos;
in vec4 color;
noperspective out vec4 finalColor;
#endif
noperspective out vec4 finalColor;
void main()
{

View File

@ -1,11 +1,7 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
#else
in vec2 pos;
#endif
in vec2 pos;
void main()
{

View File

@ -1,25 +1,14 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
in vec3 pos;
#if defined(USE_COLOR_U32)
attribute int color;
in int color;
#else
attribute vec4 color;
in vec4 color;
#endif
flat varying vec4 finalColor;
#else
in vec3 pos;
#if defined(USE_COLOR_U32)
in int color;
#else
in vec4 color;
#endif
flat out vec4 finalColor;
#endif
flat out vec4 finalColor;
void main()
{

View File

@ -1,15 +1,9 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 texCoord;
attribute vec3 pos;
varying vec2 texCoord_interp;
#else
in vec2 texCoord;
in vec3 pos;
out vec2 texCoord_interp;
#endif
in vec2 texCoord;
in vec3 pos;
out vec2 texCoord_interp;
void main()
{

View File

@ -4,13 +4,8 @@
uniform mat4 ModelViewProjectionMatrix;
uniform vec2 viewport_size;
#if __VERSION__ == 120
attribute vec3 pos;
noperspective varying float distance_along_line;
#else
in vec3 pos;
noperspective out float distance_along_line;
#endif
in vec3 pos;
noperspective out float distance_along_line;
void main()
{

View File

@ -3,11 +3,7 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
#else
in vec3 pos;
#endif
in vec3 pos;
void main()
{

View File

@ -2,30 +2,16 @@
uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec3 nor;
attribute vec4 color;
in vec3 pos;
in vec3 nor;
in vec4 color;
# ifdef USE_FLAT_NORMAL
flat varying vec4 finalColor;
flat varying vec3 normal;
# else
varying vec4 finalColor;
varying vec3 normal;
# endif
#ifdef USE_FLAT_NORMAL
flat out vec3 normal;
flat out vec4 finalColor;
#else
in vec3 pos;
in vec3 nor;
in vec4 color;
# ifdef USE_FLAT_NORMAL
flat out vec3 normal;
flat out vec4 finalColor;
# else
out vec3 normal;
out vec4 finalColor;
# endif
out vec3 normal;
out vec4 finalColor;
#endif
void main()

View File

@ -2,15 +2,9 @@
uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec3 nor;
varying vec3 normal;
#else
in vec3 pos;
in vec3 nor;
out vec3 normal;
#endif
in vec3 pos;
in vec3 nor;
out vec3 normal;
void main()
{

View File

@ -1,15 +1,9 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec4 color;
varying vec4 finalColor;
#else
in vec3 pos;
in vec4 color;
out vec4 finalColor;
#endif
in vec3 pos;
in vec4 color;
out vec4 finalColor;
void main()
{

View File

@ -2,13 +2,8 @@
uniform mat4 ModelViewProjectionMatrix;
uniform float size;
#if __VERSION__ == 120
attribute vec3 pos;
varying vec2 radii;
#else
in vec3 pos;
out vec2 radii;
#endif
in vec3 pos;
out vec2 radii;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);

View File

@ -3,13 +3,8 @@ uniform mat4 ModelViewProjectionMatrix;
uniform float size;
uniform float outlineWidth;
#if __VERSION__ == 120
attribute vec3 pos;
varying vec4 radii;
#else
in vec3 pos;
out vec4 radii;
#endif
in vec3 pos;
out vec4 radii;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);

View File

@ -1,17 +1,10 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
attribute float size;
attribute vec4 color;
varying vec4 finalColor;
#else
in vec3 pos;
in float size;
in vec4 color;
out vec4 finalColor;
#endif
in vec3 pos;
in float size;
in vec4 color;
out vec4 finalColor;
void main()
{

View File

@ -1,13 +1,8 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
attribute float size;
#else
in vec3 pos;
in float size;
#endif
in vec3 pos;
in float size;
void main()
{

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
varying vec4 finalColor;
#define fragColor gl_FragColor
#else
in vec4 finalColor;
out vec4 fragColor;
#endif
in vec4 finalColor;
out vec4 fragColor;
void main()
{

View File

@ -1,17 +1,10 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec4 color;
in vec3 pos;
in vec4 color;
varying vec4 finalColor;
#else
in vec3 pos;
in vec4 color;
out vec4 finalColor;
#endif
out vec4 finalColor;
void main()
{

View File

@ -1,11 +1,7 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
#else
in vec3 pos;
#endif
in vec3 pos;
void main()
{

View File

@ -3,11 +3,7 @@ uniform vec4 color1;
uniform vec4 color2;
uniform int size;
#if __VERSION__ == 120
#define fragColor gl_FragColor
#else
out vec4 fragColor;
#endif
out vec4 fragColor;
void main()
{

View File

@ -4,11 +4,7 @@ uniform vec4 color2;
uniform int size1;
uniform int size2;
#if __VERSION__ == 120
#define fragColor gl_FragColor
#else
out vec4 fragColor;
#endif
out vec4 fragColor;
void main()
{

View File

@ -15,23 +15,13 @@ uniform vec3 eye; // direction we are looking
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
in vec3 pos;
// normals of faces this edge joins (object coords)
attribute vec3 N1;
attribute vec3 N2;
// normals of faces this edge joins (object coords)
in vec3 N1;
in vec3 N2;
flat varying vec4 finalColor;
#else
in vec3 pos;
// normals of faces this edge joins (object coords)
in vec3 N1;
in vec3 N2;
flat out vec4 finalColor;
#endif
flat out vec4 finalColor;
// TODO: in float angle; // [-pi .. +pi], + peak, 0 flat, - valley

View File

@ -26,23 +26,13 @@ uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
in vec3 pos;
// normals of faces this edge joins (object coords)
attribute vec3 N1;
attribute vec3 N2;
// normals of faces this edge joins (object coords)
in vec3 N1;
in vec3 N2;
flat varying vec4 finalColor;
#else
in vec3 pos;
// normals of faces this edge joins (object coords)
in vec3 N1;
in vec3 N2;
flat out vec4 finalColor;
#endif
flat out vec4 finalColor;
// TODO: in float angle; // [-pi .. +pi], + peak, 0 flat, - valley

View File

@ -1,13 +1,8 @@
#if __VERSION__ == 120
varying vec3 coords;
#define fragColor gl_FragColor
#else
in vec3 coords;
out vec4 fragColor;
#define texture1D texture
#define texture3D texture
#endif
in vec3 coords;
out vec4 fragColor;
#define texture1D texture
#define texture3D texture
uniform sampler3D flame_texture;
uniform sampler1D spectrum_texture;

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
flat varying vec4 finalColor;
#define fragColor gl_FragColor
#else
flat in vec4 finalColor;
out vec4 fragColor;
#endif
flat in vec4 finalColor;
out vec4 fragColor;
void main()
{

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
flat varying vec4 finalColor;
#define fragColor gl_FragColor
#else
flat in vec4 finalColor;
out vec4 fragColor;
#endif
flat in vec4 finalColor;
out vec4 fragColor;
void main()
{

View File

@ -1,13 +1,7 @@
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec2 uvs;
varying vec4 uvcoordsvar;
#else
in vec2 pos;
in vec2 uvs;
out vec4 uvcoordsvar;
#endif
in vec2 pos;
in vec2 uvs;
out vec4 uvcoordsvar;
void main()
{

View File

@ -1,11 +1,7 @@
uniform sampler2D depthbuffer;
#if __VERSION__ == 120
varying vec4 uvcoordsvar;
#else
in vec4 uvcoordsvar;
#define texture2D texture
#endif
in vec4 uvcoordsvar;
#define texture2D texture
void main(void)
{

View File

@ -16,37 +16,20 @@ uniform vec4 dof_params;
// viewvectors for reconstruction of world space
uniform vec4 viewvecs[3];
#if __VERSION__ == 120
// coordinates on framebuffer in normalized (0.0-1.0) uv space
varying vec4 uvcoordsvar;
// coordinates on framebuffer in normalized (0.0-1.0) uv space
in vec4 uvcoordsvar;
/* color texture coordinates, offset by a small amount */
varying vec2 color_uv1;
varying vec2 color_uv2;
/* color texture coordinates, offset by a small amount */
in vec2 color_uv1;
in vec2 color_uv2;
varying vec2 depth_uv1;
varying vec2 depth_uv2;
varying vec2 depth_uv3;
varying vec2 depth_uv4;
#define FragColor gl_FragColor
#else
// coordinates on framebuffer in normalized (0.0-1.0) uv space
in vec4 uvcoordsvar;
/* color texture coordinates, offset by a small amount */
in vec2 color_uv1;
in vec2 color_uv2;
in vec2 depth_uv1;
in vec2 depth_uv2;
in vec2 depth_uv3;
in vec2 depth_uv4;
out vec4 FragColor;
#define texture2D texture
#endif
in vec2 depth_uv1;
in vec2 depth_uv2;
in vec2 depth_uv3;
in vec2 depth_uv4;
out vec4 FragColor;
#define texture2D texture
float calculate_far_coc(in float zdepth)
{

View File

@ -20,43 +20,24 @@ uniform vec4 dof_params;
/* viewvectors for reconstruction of world space */
uniform vec4 viewvecs[3];
#if __VERSION__ == 120
/* initial uv coordinate */
varying vec2 uvcoord;
/* initial uv coordinate */
in vec2 uvcoord;
/* coordinate used for calculating radius et al set in geometry shader */
varying vec2 particlecoord;
varying vec4 color;
/* coordinate used for calculating radius et al set in geometry shader */
in vec2 particlecoord;
flat in vec4 color;
/* downsampling coordinates */
varying vec2 downsample1;
varying vec2 downsample2;
varying vec2 downsample3;
varying vec2 downsample4;
/* downsampling coordinates */
in vec2 downsample1;
in vec2 downsample2;
in vec2 downsample3;
in vec2 downsample4;
#define fragData0 gl_FragData[0]
#define fragData1 gl_FragData[1]
#define fragData2 gl_FragData[2]
#else
/* initial uv coordinate */
in vec2 uvcoord;
layout(location = 0) out vec4 fragData0;
layout(location = 1) out vec4 fragData1;
layout(location = 2) out vec4 fragData2;
/* coordinate used for calculating radius et al set in geometry shader */
in vec2 particlecoord;
flat in vec4 color;
/* downsampling coordinates */
in vec2 downsample1;
in vec2 downsample2;
in vec2 downsample3;
in vec2 downsample4;
layout(location = 0) out vec4 fragData0;
layout(location = 1) out vec4 fragData1;
layout(location = 2) out vec4 fragData2;
#define texture2D texture
#endif
#define texture2D texture
#define M_PI 3.1415926535897932384626433832795

View File

@ -1,33 +1,17 @@
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec2 uvs;
/* initial uv coordinate */
varying vec2 uvcoord;
in vec2 pos;
in vec2 uvs;
/* initial uv coordinate */
out vec2 uvcoord;
/* coordinate used for calculating radius et al set in geometry shader */
varying vec2 particlecoord;
/* coordinate used for calculating radius et al set in geometry shader */
out vec2 particlecoord;
/* downsampling coordinates */
varying vec2 downsample1;
varying vec2 downsample2;
varying vec2 downsample3;
varying vec2 downsample4;
#else
in vec2 pos;
in vec2 uvs;
/* initial uv coordinate */
out vec2 uvcoord;
/* coordinate used for calculating radius et al set in geometry shader */
out vec2 particlecoord;
/* downsampling coordinates */
out vec2 downsample1;
out vec2 downsample2;
out vec2 downsample3;
out vec2 downsample4;
#endif
/* downsampling coordinates */
out vec2 downsample1;
out vec2 downsample2;
out vec2 downsample3;
out vec2 downsample4;
uniform vec2 invrendertargetdim;
uniform ivec2 rendertargetdim;

View File

@ -1,37 +1,19 @@
uniform vec2 invrendertargetdim;
in vec2 pos;
in vec2 uvs;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec2 uvs;
/* texture coordinates for framebuffer read */
out vec4 uvcoordsvar;
//texture coordinates for framebuffer read
varying vec4 uvcoordsvar;
/* color texture coordinates, offset by a small amount */
out vec2 color_uv1;
out vec2 color_uv2;
/* color texture coordinates, offset by a small amount */
varying vec2 color_uv1;
varying vec2 color_uv2;
varying vec2 depth_uv1;
varying vec2 depth_uv2;
varying vec2 depth_uv3;
varying vec2 depth_uv4;
#else
in vec2 pos;
in vec2 uvs;
//texture coordinates for framebuffer read
out vec4 uvcoordsvar;
/* color texture coordinates, offset by a small amount */
out vec2 color_uv1;
out vec2 color_uv2;
out vec2 depth_uv1;
out vec2 depth_uv2;
out vec2 depth_uv3;
out vec2 depth_uv4;
#endif
out vec2 depth_uv1;
out vec2 depth_uv2;
out vec2 depth_uv3;
out vec2 depth_uv4;
//very simple shader for gull screen FX, just pass values on

View File

@ -11,16 +11,11 @@ uniform sampler1D ssao_concentric_tex;
// depth buffer
uniform sampler2D depthbuffer;
#if __VERSION__ == 120
// coordinates on framebuffer in normalized (0.0-1.0) uv space
varying vec4 uvcoordsvar;
#define FragColor gl_FragColor
#else
in vec4 uvcoordsvar;
out vec4 FragColor;
#define texture1D texture
#define texture2D texture
#endif
// coordinates on framebuffer in normalized (0.0-1.0) uv space
in vec4 uvcoordsvar;
out vec4 FragColor;
#define texture1D texture
#define texture2D texture
/* ssao_params.x : pixel scale for the ssao radious */
/* ssao_params.y : factor for the ssao darkening */

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform vec4 color;
uniform sampler2D image;

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform vec4 color;
uniform sampler2D image;

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform float znear;
uniform float zfar;

View File

@ -4,14 +4,9 @@
#define INTERLACE_COLUMN 1
#define INTERLACE_CHECKERBOARD 2
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2DRect texture
#endif
:n vec2 texCoord_interp;
out vec4 fragColor;
#define texture2DRect texture
uniform int interlace_id;
uniform sampler2DRect image_a;
@ -19,17 +14,6 @@ uniform sampler2DRect image_b;
bool interlace()
{
#if __VERSION__ == 120
if (interlace_id == INTERLACE_CHECKERBOARD) {
return int(mod(gl_FragCoord.x + gl_FragCoord.y, 2)) != 0;
}
else if (interlace_id == INTERLACE_ROW) {
return int(mod(gl_FragCoord.y, 2)) != 0;
}
else if (interlace_id == INTERLACE_COLUMN) {
return int(mod(gl_FragCoord.x, 2)) != 0;
}
#else
if (interlace_id == INTERLACE_CHECKERBOARD) {
return (int(gl_FragCoord.x + gl_FragCoord.y) & 1) != 0;
}
@ -39,7 +23,6 @@ bool interlace()
else if (interlace_id == INTERLACE_COLUMN) {
return (int(gl_FragCoord.x) & 1) != 0;
}
#endif
}
void main()

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform sampler2D image;
uniform vec4 color;

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform float alpha;
uniform sampler2D image;

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2DRect texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2DRect texture
uniform float alpha;
uniform sampler2DRect image;

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform sampler2D image;
uniform vec4 color;

View File

@ -1,15 +1,8 @@
#if __VERSION__ == 120
varying vec4 radii;
varying vec4 finalColor;
varying vec4 finalOutlineColor;
#define fragColor gl_FragColor
#else
in vec4 radii;
in vec4 finalColor;
in vec4 finalOutlineColor;
out vec4 fragColor;
#endif
in vec4 radii;
in vec4 finalColor;
in vec4 finalOutlineColor;
out vec4 fragColor;
void main() {
vec2 quad = abs(gl_PointCoord - vec2(0.5));

View File

@ -4,23 +4,13 @@ uniform mat4 ModelViewProjectionMatrix;
const float pixel_fudge = sqrt(2.0);
const float outline_width = 1.25 * pixel_fudge;
#if __VERSION__ == 120
attribute vec2 pos;
attribute float size;
attribute vec4 color;
attribute vec4 outlineColor;
varying vec4 finalColor;
varying vec4 finalOutlineColor;
varying vec4 radii;
#else
in vec2 pos;
in float size;
in vec4 color;
in vec4 outlineColor;
out vec4 finalColor;
out vec4 finalOutlineColor;
out vec4 radii;
#endif
in vec2 pos;
in float size;
in vec4 color;
in vec4 outlineColor;
out vec4 finalColor;
out vec4 finalOutlineColor;
out vec4 radii;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@ -12,14 +12,10 @@ uniform mat4 ProjectionMatrixInverse;
uniform mat3 NormalMatrix;
uniform vec4 CameraTexCoFactors;
#if __VERSION__ == 120
#define fragColor gl_FragColor
#else
out vec4 fragColor;
#define texture2D texture
#define shadow2D shadow
#define textureCube texture
#endif
out vec4 fragColor;
#define texture2D texture
#define shadow2D shadow
#define textureCube texture
/* Converters */
@ -2281,14 +2277,12 @@ void test_shadowbuf(
//float bias = (1.5 - inp*inp)*shadowbias;
co.z -= shadowbias * co.w;
if (co.w > 0.0 && co.x > 0.0 && co.x / co.w < 1.0 && co.y > 0.0 && co.y / co.w < 1.0)
#if __VERSION__ == 120
result = shadow2DProj(shadowmap, co).x;
#else
if (co.w > 0.0 && co.x > 0.0 && co.x / co.w < 1.0 && co.y > 0.0 && co.y / co.w < 1.0) {
result = textureProj(shadowmap, co);
#endif
else
}
else {
result = 1.0;
}
}
}
@ -2592,7 +2586,6 @@ vec3 rotate_vector(vec3 p, vec3 n, float theta) {
#define NUM_LIGHTS 3
#if __VERSION__ > 120
struct glLight {
vec4 position;
vec4 diffuse;
@ -2604,12 +2597,6 @@ layout(std140) uniform lightSource {
glLight glLightSource[NUM_LIGHTS];
};
#define gl_NormalMatrix NormalMatrix
#else
#define glLightSource gl_LightSource
#endif
/* bsdfs */
void node_bsdf_diffuse(vec4 color, float roughness, vec3 N, out vec4 result)
@ -2711,7 +2698,7 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad
/* directional lights */
for (int i = 0; i < NUM_LIGHTS; i++) {
vec3 light_position_world = glLightSource[i].position.xyz;
vec3 light_position = normalize(gl_NormalMatrix * light_position_world);
vec3 light_position = normalize(NormalMatrix * light_position_world);
vec3 H = normalize(light_position + V);
@ -3160,7 +3147,6 @@ void node_tex_environment_equirectangular(vec3 co, sampler2D ima, out vec4 color
float u = -atan(nco.y, nco.x) / (2.0 * M_PI) + 0.5;
float v = atan(nco.z, hypot(nco.x, nco.y)) / M_PI + 0.5;
#if __VERSION__ > 120
/* Fix pole bleeding */
float half_width = 0.5 / float(textureSize(ima, 0).x);
v = clamp(v, half_width, 1.0 - half_width);
@ -3170,9 +3156,6 @@ void node_tex_environment_equirectangular(vec3 co, sampler2D ima, out vec4 color
* at u = 0 or 2PI, hardware filtering is using the smallest mipmap for certain
* texels. So we force the highest mipmap and don't do anisotropic filtering. */
color = textureLod(ima, vec2(u, v), 0.0);
#else
color = texture2D(ima, vec2(u, v));
#endif
}
void node_tex_environment_mirror_ball(vec3 co, sampler2D ima, out vec4 color)

View File

@ -1,13 +1,8 @@
uniform vec4 color;
#if __VERSION__ == 120
varying vec2 radii;
#define fragColor gl_FragColor
#else
in vec2 radii;
out vec4 fragColor;
#endif
in vec2 radii;
out vec4 fragColor;
void main() {
float dist = length(gl_PointCoord - vec2(0.5));

View File

@ -1,11 +1,7 @@
uniform vec4 color;
#if __VERSION__ == 120
#define fragColor gl_FragColor
#else
out vec4 fragColor;
#endif
out vec4 fragColor;
void main()
{

View File

@ -2,13 +2,8 @@
uniform vec4 color;
uniform vec4 outlineColor;
#if __VERSION__ == 120
varying vec4 radii;
#define fragColor gl_FragColor
#else
in vec4 radii;
out vec4 fragColor;
#endif
in vec4 radii;
out vec4 fragColor;
void main() {
float dist = length(gl_PointCoord - vec2(0.5));

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
varying vec4 finalColor;
#define fragColor gl_FragColor
#else
in vec4 finalColor;
out vec4 fragColor;
#endif
in vec4 finalColor;
out vec4 fragColor;
void main()
{

View File

@ -1,15 +1,9 @@
uniform vec4 outlineColor;
#if __VERSION__ == 120
varying vec4 radii;
varying vec4 fillColor;
#define fragColor gl_FragColor
#else
in vec4 radii;
in vec4 fillColor;
out vec4 fragColor;
#endif
in vec4 radii;
in vec4 fillColor;
out vec4 fragColor;
void main() {
float dist = length(gl_PointCoord - vec2(0.5));

View File

@ -1,14 +1,9 @@
uniform vec2 ScaleU;
uniform sampler2D textureSource;
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
void main()
{

View File

@ -1,15 +1,9 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec2 uvs;
varying vec2 texCoord_interp;
#else
in vec2 pos;
in vec2 uvs;
out vec2 texCoord_interp;
#endif
in vec2 pos;
in vec2 uvs;
out vec2 texCoord_interp;
void main()
{

View File

@ -4,20 +4,12 @@ uniform vec4 color;
#endif
uniform vec3 light;
#if __VERSION__ == 120
varying vec3 normal;
in vec3 normal;
#ifdef USE_INSTANCE_COLOR
varying vec4 finalColor;
#endif
#define fragColor gl_FragColor
#else
in vec3 normal;
#ifdef USE_INSTANCE_COLOR
flat in vec4 finalColor;
#define color finalColor
#endif
out vec4 fragColor;
flat in vec4 finalColor;
# define color finalColor
#endif
out vec4 fragColor;
void main()
{

View File

@ -1,25 +1,14 @@
uniform vec3 light;
#if __VERSION__ == 120
# ifdef USE_FLAT_NORMAL
flat varying vec3 normal;
flat varying vec4 finalColor;
# else
varying vec3 normal;
varying vec4 finalColor;
# endif
#define fragColor gl_FragColor
#ifdef USE_FLAT_NORMAL
flat in vec3 normal;
flat in vec4 finalColor;
#else
# ifdef USE_FLAT_NORMAL
flat in vec3 normal;
flat in vec4 finalColor;
# else
in vec3 normal;
in vec4 finalColor;
# endif
out vec4 fragColor;
in vec3 normal;
in vec4 finalColor;
#endif
out vec4 fragColor;
void main()
{

View File

@ -1,13 +1,8 @@
#if __VERSION__ == 120
varying vec3 coords;
#define fragColor gl_FragColor
#else
in vec3 coords;
out vec4 fragColor;
#define texture1D texture
#define texture3D texture
#endif
uniform vec3 active_color;
uniform float step_size;

View File

@ -1,11 +1,7 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
varying vec3 coords;
#else
out vec3 coords;
#endif
out vec3 coords;
uniform vec3 min_location;
uniform vec3 invsize;

View File

@ -1,14 +1,8 @@
#if __VERSION__ == 120
flat varying vec4 color_flat;
noperspective varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
flat in vec4 color_flat;
noperspective in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
flat in vec4 color_flat;
noperspective in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
uniform sampler2D glyph;

View File

@ -1,19 +1,11 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec2 texCoord;
attribute vec4 color;
flat varying vec4 color_flat;
noperspective varying vec2 texCoord_interp;
#else
in vec2 pos;
in vec2 texCoord;
in vec4 color;
flat out vec4 color_flat;
noperspective out vec2 texCoord_interp;
#endif
in vec2 pos;
in vec2 texCoord;
in vec4 color;
flat out vec4 color_flat;
noperspective out vec2 texCoord_interp;
void main()
{

View File

@ -1,11 +1,7 @@
uniform vec4 color;
#if __VERSION__ == 120
#define fragColor gl_FragColor
#else
out vec4 fragColor;
#endif
out vec4 fragColor;
void main()
{

View File

@ -12,13 +12,8 @@ out block {
} outpt;
#endif
#if __VERSION__ == 120
varying vec3 varposition;
varying vec3 varnormal;
#else
out vec3 varposition;
out vec3 varnormal;
#endif
out vec3 varposition;
out vec3 varnormal;
#ifdef CLIP_WORKAROUND
varying float gl_ClipDistance[6];

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
varying vec3 varposition;
varying vec3 varnormal;
#else
out vec3 varposition;
out vec3 varnormal;
#endif
out vec3 varposition;
out vec3 varnormal;
/* Color, keep in sync with: gpu_shader_vertex.glsl */

View File

@ -2,13 +2,8 @@
* This fragment shader was initially found at http://fabiensanglard.net/shadowmappingVSM/index.php
*/
#if __VERSION__ == 120
varying vec4 v_position;
#define fragColor gl_FragColor
#else
in vec4 v_position;
out vec4 fragColor;
#endif
in vec4 v_position;
out vec4 fragColor;
void main()
{

View File

@ -1,11 +1,7 @@
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
varying vec4 v_position;
#else
out vec4 v_position;
#endif
out vec4 v_position;
void main()
{