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:
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/CMakeLists.txt6
-rw-r--r--source/blender/gpu/GPU_shader.h6
-rw-r--r--source/blender/gpu/intern/gpu_shader.c48
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl19
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_image_vert.glsl18
-rw-r--r--source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl (renamed from source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl)9
-rw-r--r--source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl (renamed from source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl)9
7 files changed, 58 insertions, 57 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index b2a7c784d4a..e960a817a55 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -133,9 +133,9 @@ data_to_c_simple(shaders/gpu_shader_2D_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_flat_color_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_smooth_color_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_smooth_color_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_2D_texture_2D_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_2D_texture_rect_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_2D_texture_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_image_modulate_alpha_frag.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_3D_image_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_3D_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_3D_flat_color_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_3D_smooth_color_vert.glsl SRC)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index d52a0a2965d..1fe0f6f9717 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -101,9 +101,9 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_3D_FLAT_COLOR,
GPU_SHADER_3D_SMOOTH_COLOR,
GPU_SHADER_3D_DEPTH_ONLY,
- /* basic 2D texture drawing */
- GPU_SHADER_2D_TEXTURE_2D,
- GPU_SHADER_2D_TEXTURE_RECT,
+ /* basic image drawing */
+ GPU_SHADER_3D_IMAGE_MODULATE_ALPHA,
+ GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA,
/* points */
GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR,
GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH,
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 464135426d2..e8ea6425d7b 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -53,9 +53,9 @@ extern char datatoc_gpu_shader_2D_vert_glsl[];
extern char datatoc_gpu_shader_2D_flat_color_vert_glsl[];
extern char datatoc_gpu_shader_2D_smooth_color_vert_glsl[];
extern char datatoc_gpu_shader_2D_smooth_color_frag_glsl[];
-extern char datatoc_gpu_shader_2D_texture_vert_glsl[];
-extern char datatoc_gpu_shader_2D_texture_2D_frag_glsl[];
-extern char datatoc_gpu_shader_2D_texture_rect_frag_glsl[];
+extern char datatoc_gpu_shader_3D_image_vert_glsl[];
+extern char datatoc_gpu_shader_image_modulate_alpha_frag_glsl[];
+extern char datatoc_gpu_shader_image_rect_modulate_alpha_frag_glsl[];
extern char datatoc_gpu_shader_3D_vert_glsl[];
extern char datatoc_gpu_shader_3D_flat_color_vert_glsl[];
extern char datatoc_gpu_shader_3D_smooth_color_vert_glsl[];
@@ -105,9 +105,9 @@ static struct GPUShadersGlobal {
GPUShader *fx_shaders[MAX_FX_SHADERS * 2];
/* for drawing text */
GPUShader *text;
- /* for drawing texture */
- GPUShader *texture_2D;
- GPUShader *texture_rect;
+ /* for drawing images */
+ GPUShader *image_modulate_alpha_3D;
+ GPUShader *image_rect_modulate_alpha_3D;
/* for simple 2D drawing */
GPUShader *uniform_color_2D;
GPUShader *flat_color_2D;
@@ -651,21 +651,21 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
NULL, NULL, NULL, 0, 0, 0);
retval = GG.shaders.text;
break;
- case GPU_SHADER_2D_TEXTURE_2D:
- if (!GG.shaders.texture_2D)
- GG.shaders.texture_2D = GPU_shader_create(
- datatoc_gpu_shader_2D_texture_vert_glsl,
- datatoc_gpu_shader_2D_texture_2D_frag_glsl,
+ case GPU_SHADER_3D_IMAGE_MODULATE_ALPHA:
+ if (!GG.shaders.image_modulate_alpha_3D)
+ GG.shaders.image_modulate_alpha_3D = GPU_shader_create(
+ datatoc_gpu_shader_3D_image_vert_glsl,
+ datatoc_gpu_shader_image_modulate_alpha_frag_glsl,
NULL, NULL, NULL, 0, 0, 0);
- retval = GG.shaders.texture_2D;
+ retval = GG.shaders.image_modulate_alpha_3D;
break;
- case GPU_SHADER_2D_TEXTURE_RECT:
- if (!GG.shaders.texture_rect)
- GG.shaders.texture_rect = GPU_shader_create(
- datatoc_gpu_shader_2D_texture_vert_glsl,
- datatoc_gpu_shader_2D_texture_rect_frag_glsl,
+ case GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA:
+ if (!GG.shaders.image_rect_modulate_alpha_3D)
+ GG.shaders.image_rect_modulate_alpha_3D = GPU_shader_create(
+ datatoc_gpu_shader_3D_image_vert_glsl,
+ datatoc_gpu_shader_image_rect_modulate_alpha_frag_glsl,
NULL, NULL, NULL, 0, 0, 0);
- retval = GG.shaders.texture_rect;
+ retval = GG.shaders.image_rect_modulate_alpha_3D;
break;
case GPU_SHADER_2D_UNIFORM_COLOR:
if (!GG.shaders.uniform_color_2D)
@@ -917,14 +917,14 @@ void GPU_shader_free_builtin_shaders(void)
GG.shaders.text = NULL;
}
- if (GG.shaders.texture_2D) {
- GPU_shader_free(GG.shaders.texture_2D);
- GG.shaders.texture_2D = NULL;
+ if (GG.shaders.image_modulate_alpha_3D) {
+ GPU_shader_free(GG.shaders.image_modulate_alpha_3D);
+ GG.shaders.image_modulate_alpha_3D = NULL;
}
- if (GG.shaders.texture_rect) {
- GPU_shader_free(GG.shaders.texture_rect);
- GG.shaders.texture_rect = NULL;
+ if (GG.shaders.image_rect_modulate_alpha_3D) {
+ GPU_shader_free(GG.shaders.image_rect_modulate_alpha_3D);
+ GG.shaders.image_rect_modulate_alpha_3D = NULL;
}
if (GG.shaders.uniform_color_2D) {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl
deleted file mode 100644
index 4c05cf1d25b..00000000000
--- a/source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-
-uniform mat4 ModelViewProjectionMatrix;
-
-#if __VERSION__ == 120
- attribute vec2 texcoord;
- attribute vec3 position;
- varying vec2 texture_coord;
-#else
- in vec2 texcoord;
- in vec3 position;
- out vec2 texture_coord;
-#endif
-
-
-void main()
-{
- gl_Position = ModelViewProjectionMatrix * vec4(position.xyz, 1.0f);
- texture_coord = texcoord;
-}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_image_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_image_vert.glsl
new file mode 100644
index 00000000000..e9f847f28b3
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_3D_image_vert.glsl
@@ -0,0 +1,18 @@
+
+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
+
+void main()
+{
+ gl_Position = ModelViewProjectionMatrix * vec4(pos.xyz, 1.0f);
+ texCoord_interp = texCoord;
+}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
index cd4f0d2f4c5..74e17198985 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
@@ -1,17 +1,18 @@
+
#if __VERSION__ == 120
- varying vec2 texture_coord;
+ varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
- in vec2 texture_coord;
+ in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2D texture
#endif
uniform float alpha;
-uniform sampler2D texture_map;
+uniform sampler2D image;
void main()
{
- fragColor = texture2D(texture_map, texture_coord);
+ fragColor = texture2D(image, texCoord_interp);
fragColor.a *= alpha;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl
index 9dad41dd832..aae3b40efd4 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl
@@ -1,17 +1,18 @@
+
#if __VERSION__ == 120
- varying vec2 texture_coord;
+ varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
- in vec2 texture_coord;
+ in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2DRect texture
#endif
uniform float alpha;
-uniform sampler2DRect texture_map;
+uniform sampler2DRect image;
void main()
{
- fragColor = texture2DRect(texture_map, texture_coord);
+ fragColor = texture2DRect(image, texCoord_interp);
fragColor.a *= alpha;
}