diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-13 20:09:58 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-13 22:02:31 +0300 |
commit | e9b1163162d78324c118d3649451e81644b1af03 (patch) | |
tree | eed298e1f49708960a548268a75a05e83da37a58 /source/blender/gpu | |
parent | afb213f876e32c2ecd12a159fad8d260f37b142a (diff) |
Code cleanup: stop using rectangle textures in window draw, simplify code.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 8 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_image_frag.glsl (renamed from source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl) | 4 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl | 4 |
5 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 0ac842d90a0..9524c71be8e 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -142,13 +142,13 @@ data_to_c_simple(shaders/gpu_shader_2D_line_dashed_geom.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_image_vert.glsl SRC) +data_to_c_simple(shaders/gpu_shader_image_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_linear_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_shuffle_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_mask_uniform_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_modulate_alpha_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_alpha_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_color_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_depth_linear_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_interlace_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_image_vert.glsl SRC) diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index f2119a117e5..d25ccbc6c40 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -113,8 +113,10 @@ typedef enum GPUBuiltinShader { GPU_SHADER_2D_UNIFORM_COLOR, GPU_SHADER_2D_FLAT_COLOR, GPU_SHADER_2D_SMOOTH_COLOR, + GPU_SHADER_2D_IMAGE, GPU_SHADER_2D_IMAGE_COLOR, GPU_SHADER_2D_IMAGE_ALPHA_COLOR, + GPU_SHADER_2D_IMAGE_ALPHA, GPU_SHADER_2D_CHECKER, GPU_SHADER_2D_DIAG_STRIPES, /* for simple 3D drawing */ @@ -131,7 +133,6 @@ typedef enum GPUBuiltinShader { GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR, GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR, GPU_SHADER_3D_IMAGE_MODULATE_ALPHA, - GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA, GPU_SHADER_3D_IMAGE_DEPTH, /* stereo 3d */ GPU_SHADER_2D_IMAGE_INTERLACE, diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 598722d372b..f2dbf587abe 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -68,6 +68,7 @@ extern char datatoc_gpu_shader_2D_smooth_color_frag_glsl[]; extern char datatoc_gpu_shader_2D_image_vert_glsl[]; extern char datatoc_gpu_shader_3D_image_vert_glsl[]; +extern char datatoc_gpu_shader_image_frag_glsl[]; extern char datatoc_gpu_shader_image_linear_frag_glsl[]; extern char datatoc_gpu_shader_image_color_frag_glsl[]; extern char datatoc_gpu_shader_image_alpha_color_frag_glsl[]; @@ -75,7 +76,6 @@ extern char datatoc_gpu_shader_image_shuffle_color_frag_glsl[]; extern char datatoc_gpu_shader_image_interlace_frag_glsl[]; extern char datatoc_gpu_shader_image_mask_uniform_color_frag_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_image_depth_linear_frag_glsl[]; extern char datatoc_gpu_shader_3D_vert_glsl[]; extern char datatoc_gpu_shader_3D_normal_vert_glsl[]; @@ -710,8 +710,6 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) datatoc_gpu_shader_image_mask_uniform_color_frag_glsl }, [GPU_SHADER_3D_IMAGE_MODULATE_ALPHA] = { datatoc_gpu_shader_3D_image_vert_glsl, datatoc_gpu_shader_image_modulate_alpha_frag_glsl }, - [GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA] = { datatoc_gpu_shader_3D_image_vert_glsl, - datatoc_gpu_shader_image_rect_modulate_alpha_frag_glsl }, [GPU_SHADER_3D_IMAGE_DEPTH] = { datatoc_gpu_shader_3D_image_vert_glsl, datatoc_gpu_shader_image_depth_linear_frag_glsl }, @@ -728,10 +726,14 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) datatoc_gpu_shader_2D_smooth_color_frag_glsl }, [GPU_SHADER_2D_IMAGE_LINEAR_TO_SRGB] = { datatoc_gpu_shader_2D_image_vert_glsl, datatoc_gpu_shader_image_linear_frag_glsl }, + [GPU_SHADER_2D_IMAGE] = { datatoc_gpu_shader_2D_image_vert_glsl, + datatoc_gpu_shader_image_frag_glsl }, [GPU_SHADER_2D_IMAGE_COLOR] = { datatoc_gpu_shader_2D_image_vert_glsl, datatoc_gpu_shader_image_color_frag_glsl }, [GPU_SHADER_2D_IMAGE_ALPHA_COLOR] = { datatoc_gpu_shader_2D_image_vert_glsl, datatoc_gpu_shader_image_alpha_color_frag_glsl }, + [GPU_SHADER_2D_IMAGE_ALPHA] = { datatoc_gpu_shader_2D_image_vert_glsl, + datatoc_gpu_shader_image_modulate_alpha_frag_glsl }, [GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR] = { datatoc_gpu_shader_2D_image_vert_glsl, datatoc_gpu_shader_image_shuffle_color_frag_glsl }, [GPU_SHADER_3D_UNIFORM_COLOR] = { datatoc_gpu_shader_3D_vert_glsl, datatoc_gpu_shader_uniform_color_frag_glsl }, diff --git a/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_frag.glsl index 7d9ce9d2003..6eeab8ca7e8 100644 --- a/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_image_frag.glsl @@ -2,11 +2,9 @@ in vec2 texCoord_interp; out vec4 fragColor; -uniform float alpha; -uniform sampler2DRect image; +uniform sampler2D image; void main() { fragColor = texture(image, texCoord_interp); - fragColor.a *= alpha; } diff --git a/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl index 7f3e7df40ac..d95645f58e5 100644 --- a/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl @@ -8,8 +8,8 @@ in vec2 texCoord_interp; out vec4 fragColor; uniform int interlace_id; -uniform sampler2DRect image_a; -uniform sampler2DRect image_b; +uniform sampler2D image_a; +uniform sampler2D image_b; bool interlace() { |