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; uniform float image_texture_height;
#endif #endif
#if __VERSION__ < 130
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
#ifdef USE_CURVE_MAPPING #ifdef USE_CURVE_MAPPING
/* Curve mapping parameters /* Curve mapping parameters

View File

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

View File

@ -29,23 +29,12 @@ struct VertexData {
vec2 uv; vec2 uv;
}; };
#if __VERSION__ >= 150
layout(lines_adjacency) in; layout(lines_adjacency) in;
#ifdef WIREFRAME #ifdef WIREFRAME
layout(line_strip, max_vertices = 8) out; layout(line_strip, max_vertices = 8) out;
#else #else
layout(triangle_strip, max_vertices = 4) out; layout(triangle_strip, max_vertices = 4) out;
#endif #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
#endif
uniform mat4 modelViewMatrix; uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix; uniform mat4 projectionMatrix;

View File

@ -43,11 +43,4 @@ void main()
{ {
outpt.v.position = modelViewMatrix * position; outpt.v.position = modelViewMatrix * position;
outpt.v.normal = normalize(normalMatrix * normal); 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_SELECTED (1 << 0)
#define VERTEX_ACTIVE (1 << 1) #define VERTEX_ACTIVE (1 << 1)
#if __VERSION__ == 120
#define FragColor gl_FragColor
#else
out vec4 FragColor; out vec4 FragColor;
#endif
void main() void main()
{ {

View File

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

View File

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

View File

@ -2,15 +2,9 @@
uniform mat4 ModelViewProjectionMatrix; uniform mat4 ModelViewProjectionMatrix;
/* Keep in sync with intern/opencolorio/gpu_shader_display_transform_vertex.glsl */ /* 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 texCoord;
in vec2 pos; in vec2 pos;
out vec2 texCoord_interp; out vec2 texCoord_interp;
#endif
void main() void main()
{ {

View File

@ -1,13 +1,8 @@
// Draw dashed lines, perforated in screen space. // 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; noperspective in float distance_along_line;
out vec4 fragColor; out vec4 fragColor;
#endif
uniform float dash_width; uniform float dash_width;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,15 +26,6 @@ uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewProjectionMatrix; uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix; uniform mat3 NormalMatrix;
#if __VERSION__ == 120
attribute vec3 pos;
// normals of faces this edge joins (object coords)
attribute vec3 N1;
attribute vec3 N2;
flat varying vec4 finalColor;
#else
in vec3 pos; in vec3 pos;
// normals of faces this edge joins (object coords) // normals of faces this edge joins (object coords)
@ -42,7 +33,6 @@ uniform mat3 NormalMatrix;
in vec3 N2; in vec3 N2;
flat out vec4 finalColor; flat out vec4 finalColor;
#endif
// TODO: in float angle; // [-pi .. +pi], + peak, 0 flat, - valley // 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; in vec3 coords;
out vec4 fragColor; out vec4 fragColor;
#define texture1D texture #define texture1D texture
#define texture3D texture #define texture3D texture
#endif
uniform sampler3D flame_texture; uniform sampler3D flame_texture;
uniform sampler1D spectrum_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; flat in vec4 finalColor;
out vec4 fragColor; out vec4 fragColor;
#endif
void main() void main()
{ {

View File

@ -1,11 +1,6 @@
#if __VERSION__ == 120
flat varying vec4 finalColor;
#define fragColor gl_FragColor
#else
flat in vec4 finalColor; flat in vec4 finalColor;
out vec4 fragColor; out vec4 fragColor;
#endif
void main() 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 pos;
in vec2 uvs; in vec2 uvs;
out vec4 uvcoordsvar; out vec4 uvcoordsvar;
#endif
void main() void main()
{ {

View File

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

View File

@ -16,21 +16,6 @@ uniform vec4 dof_params;
// viewvectors for reconstruction of world space // viewvectors for reconstruction of world space
uniform vec4 viewvecs[3]; uniform vec4 viewvecs[3];
#if __VERSION__ == 120
// coordinates on framebuffer in normalized (0.0-1.0) uv space
varying vec4 uvcoordsvar;
/* 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;
#define FragColor gl_FragColor
#else
// coordinates on framebuffer in normalized (0.0-1.0) uv space // coordinates on framebuffer in normalized (0.0-1.0) uv space
in vec4 uvcoordsvar; in vec4 uvcoordsvar;
@ -45,8 +30,6 @@ uniform vec4 viewvecs[3];
out vec4 FragColor; out vec4 FragColor;
#define texture2D texture #define texture2D texture
#endif
float calculate_far_coc(in float zdepth) float calculate_far_coc(in float zdepth)
{ {

View File

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

View File

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

View File

@ -1,26 +1,9 @@
uniform vec2 invrendertargetdim; uniform vec2 invrendertargetdim;
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec2 uvs;
//texture coordinates for framebuffer read
varying vec4 uvcoordsvar;
/* 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 pos;
in vec2 uvs; in vec2 uvs;
//texture coordinates for framebuffer read /* texture coordinates for framebuffer read */
out vec4 uvcoordsvar; out vec4 uvcoordsvar;
/* color texture coordinates, offset by a small amount */ /* color texture coordinates, offset by a small amount */
@ -31,7 +14,6 @@ uniform vec2 invrendertargetdim;
out vec2 depth_uv2; out vec2 depth_uv2;
out vec2 depth_uv3; out vec2 depth_uv3;
out vec2 depth_uv4; out vec2 depth_uv4;
#endif
//very simple shader for gull screen FX, just pass values on //very simple shader for gull screen FX, just pass values on

View File

@ -11,16 +11,11 @@ uniform sampler1D ssao_concentric_tex;
// depth buffer // depth buffer
uniform sampler2D depthbuffer; uniform sampler2D depthbuffer;
#if __VERSION__ == 120
// coordinates on framebuffer in normalized (0.0-1.0) uv space // coordinates on framebuffer in normalized (0.0-1.0) uv space
varying vec4 uvcoordsvar;
#define FragColor gl_FragColor
#else
in vec4 uvcoordsvar; in vec4 uvcoordsvar;
out vec4 FragColor; out vec4 FragColor;
#define texture1D texture #define texture1D texture
#define texture2D texture #define texture2D texture
#endif
/* ssao_params.x : pixel scale for the ssao radious */ /* ssao_params.x : pixel scale for the ssao radious */
/* ssao_params.y : factor for the ssao darkening */ /* 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; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform vec4 color; uniform vec4 color;
uniform sampler2D image; 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; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform vec4 color; uniform vec4 color;
uniform sampler2D image; 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; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform float znear; uniform float znear;
uniform float zfar; uniform float zfar;

View File

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

View File

@ -1,12 +1,7 @@
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform sampler2D image; uniform sampler2D image;
uniform vec4 color; 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; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform float alpha; uniform float alpha;
uniform sampler2D image; 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; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2DRect texture #define texture2DRect texture
#endif
uniform float alpha; uniform float alpha;
uniform sampler2DRect image; 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; in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform sampler2D image; uniform sampler2D image;
uniform vec4 color; 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 radii;
in vec4 finalColor; in vec4 finalColor;
in vec4 finalOutlineColor; in vec4 finalOutlineColor;
out vec4 fragColor; out vec4 fragColor;
#endif
void main() { void main() {
vec2 quad = abs(gl_PointCoord - vec2(0.5)); vec2 quad = abs(gl_PointCoord - vec2(0.5));

View File

@ -4,15 +4,6 @@ uniform mat4 ModelViewProjectionMatrix;
const float pixel_fudge = sqrt(2.0); const float pixel_fudge = sqrt(2.0);
const float outline_width = 1.25 * pixel_fudge; 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 vec2 pos;
in float size; in float size;
in vec4 color; in vec4 color;
@ -20,7 +11,6 @@ const float outline_width = 1.25 * pixel_fudge;
out vec4 finalColor; out vec4 finalColor;
out vec4 finalOutlineColor; out vec4 finalOutlineColor;
out vec4 radii; out vec4 radii;
#endif
void main() { void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@ -12,14 +12,10 @@ uniform mat4 ProjectionMatrixInverse;
uniform mat3 NormalMatrix; uniform mat3 NormalMatrix;
uniform vec4 CameraTexCoFactors; uniform vec4 CameraTexCoFactors;
#if __VERSION__ == 120
#define fragColor gl_FragColor
#else
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#define shadow2D shadow #define shadow2D shadow
#define textureCube texture #define textureCube texture
#endif
/* Converters */ /* Converters */
@ -2281,16 +2277,14 @@ void test_shadowbuf(
//float bias = (1.5 - inp*inp)*shadowbias; //float bias = (1.5 - inp*inp)*shadowbias;
co.z -= shadowbias * co.w; 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 (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
result = textureProj(shadowmap, co); result = textureProj(shadowmap, co);
#endif }
else else {
result = 1.0; result = 1.0;
} }
} }
}
void test_shadowbuf_vsm( void test_shadowbuf_vsm(
vec3 rco, sampler2D shadowmap, mat4 shadowpersmat, float shadowbias, float bleedbias, float inp, vec3 rco, sampler2D shadowmap, mat4 shadowpersmat, float shadowbias, float bleedbias, float inp,
@ -2592,7 +2586,6 @@ vec3 rotate_vector(vec3 p, vec3 n, float theta) {
#define NUM_LIGHTS 3 #define NUM_LIGHTS 3
#if __VERSION__ > 120
struct glLight { struct glLight {
vec4 position; vec4 position;
vec4 diffuse; vec4 diffuse;
@ -2604,12 +2597,6 @@ layout(std140) uniform lightSource {
glLight glLightSource[NUM_LIGHTS]; glLight glLightSource[NUM_LIGHTS];
}; };
#define gl_NormalMatrix NormalMatrix
#else
#define glLightSource gl_LightSource
#endif
/* bsdfs */ /* bsdfs */
void node_bsdf_diffuse(vec4 color, float roughness, vec3 N, out vec4 result) 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 */ /* directional lights */
for (int i = 0; i < NUM_LIGHTS; i++) { for (int i = 0; i < NUM_LIGHTS; i++) {
vec3 light_position_world = glLightSource[i].position.xyz; 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); 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 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; float v = atan(nco.z, hypot(nco.x, nco.y)) / M_PI + 0.5;
#if __VERSION__ > 120
/* Fix pole bleeding */ /* Fix pole bleeding */
float half_width = 0.5 / float(textureSize(ima, 0).x); float half_width = 0.5 / float(textureSize(ima, 0).x);
v = clamp(v, half_width, 1.0 - half_width); 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 * 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. */ * texels. So we force the highest mipmap and don't do anisotropic filtering. */
color = textureLod(ima, vec2(u, v), 0.0); 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) void node_tex_environment_mirror_ball(vec3 co, sampler2D ima, out vec4 color)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,6 @@
uniform vec3 light; 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
#else
#ifdef USE_FLAT_NORMAL #ifdef USE_FLAT_NORMAL
flat in vec3 normal; flat in vec3 normal;
flat in vec4 finalColor; flat in vec4 finalColor;
@ -19,7 +9,6 @@ uniform vec3 light;
in vec4 finalColor; in vec4 finalColor;
#endif #endif
out vec4 fragColor; out vec4 fragColor;
#endif
void main() void main()
{ {

View File

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

View File

@ -1,11 +1,7 @@
uniform mat4 ModelViewProjectionMatrix; uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ == 120
varying vec3 coords;
#else
out vec3 coords; out vec3 coords;
#endif
uniform vec3 min_location; uniform vec3 min_location;
uniform vec3 invsize; 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; flat in vec4 color_flat;
noperspective in vec2 texCoord_interp; noperspective in vec2 texCoord_interp;
out vec4 fragColor; out vec4 fragColor;
#define texture2D texture #define texture2D texture
#endif
uniform sampler2D glyph; uniform sampler2D glyph;

View File

@ -1,19 +1,11 @@
uniform mat4 ModelViewProjectionMatrix; 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 pos;
in vec2 texCoord; in vec2 texCoord;
in vec4 color; in vec4 color;
flat out vec4 color_flat; flat out vec4 color_flat;
noperspective out vec2 texCoord_interp; noperspective out vec2 texCoord_interp;
#endif
void main() void main()
{ {

View File

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

View File

@ -12,13 +12,8 @@ out block {
} outpt; } outpt;
#endif #endif
#if __VERSION__ == 120
varying vec3 varposition;
varying vec3 varnormal;
#else
out vec3 varposition; out vec3 varposition;
out vec3 varnormal; out vec3 varnormal;
#endif
#ifdef CLIP_WORKAROUND #ifdef CLIP_WORKAROUND
varying float gl_ClipDistance[6]; 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 varposition;
out vec3 varnormal; out vec3 varnormal;
#endif
/* Color, keep in sync with: gpu_shader_vertex.glsl */ /* 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 * 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; in vec4 v_position;
out vec4 fragColor; out vec4 fragColor;
#endif
void main() void main()
{ {

View File

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