Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-10-10 06:03:35 +0300
committerMike Erwin <significant.bit@gmail.com>2016-10-10 06:03:35 +0300
commit7a60f889d3f328e38aa882891cda615a06333ab6 (patch)
treef83e9f3e9df86f7d8da5027773acd980d6f7c94c /source/blender/gpu/shaders
parente636529e33a2a2dc7d9acfed44325e2b38be86ac (diff)
OpenGL: plug new matrix system into shaders (WIP)
Built-in shaders now use uniforms instead of legacy built-in matrices. So far I only hooked this up for new immediate mode. We use the same matrix naming convention as OpenGL, but without the gl_ prefix, e.g. gl_ModelView becomes ModelView. Right now it can skip the new matrix stack and use the legacy built-in matrices app-side. This will help us transition gradually from glMatrix functions to gpuMatrix functions. Still some work to do in gpuBindMatrices. See TODO comments in gpu_matrix.c for specifics.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_no_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_outline_smooth_vert.glsl3
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_smooth_vert.glsl3
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl5
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_no_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_no_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl4
13 files changed, 38 insertions, 13 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl
index aa1eba470ab..96c833f3b93 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec4 color;
@@ -13,6 +15,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
finalColor = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_no_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_no_color_vert.glsl
index 7ad30052cf5..4049171f73d 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_no_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_no_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec2 pos;
#else
@@ -7,5 +9,5 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_outline_smooth_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_outline_smooth_vert.glsl
index cff493bcfc7..a37ae16f837 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_outline_smooth_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_outline_smooth_vert.glsl
@@ -1,4 +1,5 @@
+uniform mat4 ModelViewProjectionMatrix;
uniform float size;
uniform float outlineWidth;
@@ -11,7 +12,7 @@ uniform float outlineWidth;
#endif
void main() {
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
gl_PointSize = size;
// calculate concentric radii in pixels
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_smooth_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_smooth_vert.glsl
index f72c4c5a9e7..201e5e90ecc 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_smooth_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_uniform_color_smooth_vert.glsl
@@ -1,4 +1,5 @@
+uniform mat4 ModelViewProjectionMatrix;
uniform float size;
#if __VERSION__ == 120
@@ -10,7 +11,7 @@ uniform float size;
#endif
void main() {
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
gl_PointSize = size;
// calculate concentric radii in pixels
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl
index 4cdd43a0a97..42ff51e3d03 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec2 pos;
attribute float size;
@@ -13,7 +15,7 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
gl_PointSize = size;
finalColor = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl
index 01606622c78..9daf2d75016 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec2 pos;
attribute vec4 color;
@@ -13,6 +15,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
finalColor = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl
index d4d36def8cd..4c05cf1d25b 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl
@@ -1,3 +1,6 @@
+
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec2 texcoord;
attribute vec3 position;
@@ -11,6 +14,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0f);
+ gl_Position = ModelViewProjectionMatrix * vec4(position.xyz, 1.0f);
texture_coord = texcoord;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
index ec6037e5077..8c241cff5d4 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec4 color;
@@ -13,6 +15,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
finalColor = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_no_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_no_color_vert.glsl
index 5d10eaec6d8..32da3a99c63 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_no_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_no_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec3 pos;
#else
@@ -7,5 +9,5 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl
index 451d8620596..84e77e59e90 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec4 color;
@@ -11,6 +13,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
finalColor = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_no_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_no_color_vert.glsl
index 0bdcbd5fef3..1fcda765b99 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_no_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_no_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec3 pos;
attribute float size;
@@ -9,6 +11,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
gl_PointSize = size;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl
index 529b46d3e2b..7999435f0e4 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec3 pos;
attribute float size;
@@ -13,7 +15,7 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
gl_PointSize = size;
finalColor = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
index 20b5e126736..22c2cfa8b93 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
@@ -1,4 +1,6 @@
+uniform mat4 ModelViewProjectionMatrix;
+
#if __VERSION__ == 120
attribute vec3 pos;
attribute vec4 color;
@@ -13,6 +15,6 @@
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
finalColor = color;
}