Commit: 4a3348cfe049620b9f8bcf421562ff8264bc79fa Author: Clément Foucault Date: Tue Aug 14 21:37:31 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB4a3348cfe049620b9f8bcf421562ff8264bc79fa
GPUShader: Remove some of the unused shaders keeping GPU_SHADER_SMOKE until other occurences are removed. =================================================================== M source/blender/gpu/CMakeLists.txt M source/blender/gpu/GPU_shader.h M source/blender/gpu/intern/gpu_codegen.c M source/blender/gpu/intern/gpu_shader.c D source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl D source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl D source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl D source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl D source/blender/gpu/shaders/gpu_shader_fx_dof_hq_vert.glsl D source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl D source/blender/gpu/shaders/gpu_shader_fx_lib.glsl D source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl D source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl D source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl D source/blender/gpu/shaders/gpu_shader_vertex.glsl D source/blender/gpu/shaders/gpu_shader_vertex_world.glsl D source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl D source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl =================================================================== diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 938c074920c..1765be552e5 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -87,20 +87,7 @@ set(SRC intern/gpu_vertex_format.c intern/gpu_viewport.c - shaders/gpu_shader_fx_lib.glsl - shaders/gpu_shader_fx_ssao_frag.glsl - shaders/gpu_shader_fx_dof_frag.glsl - shaders/gpu_shader_fx_dof_vert.glsl - shaders/gpu_shader_fx_dof_hq_frag.glsl - shaders/gpu_shader_fx_dof_hq_vert.glsl - shaders/gpu_shader_fx_dof_hq_geo.glsl shaders/gpu_shader_material.glsl - shaders/gpu_shader_sep_gaussian_blur_frag.glsl - shaders/gpu_shader_sep_gaussian_blur_vert.glsl - shaders/gpu_shader_vertex.glsl - shaders/gpu_shader_vsm_store_frag.glsl - shaders/gpu_shader_vsm_store_vert.glsl - shaders/gpu_shader_fx_depth_resolve.glsl shaders/gpu_shader_fire_frag.glsl shaders/gpu_shader_smoke_frag.glsl shaders/gpu_shader_smoke_vert.glsl @@ -245,12 +232,6 @@ data_to_c_simple(shaders/gpu_shader_fire_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_smoke_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_smoke_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_material.glsl SRC) -data_to_c_simple(shaders/gpu_shader_sep_gaussian_blur_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_sep_gaussian_blur_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_vertex.glsl SRC) -data_to_c_simple(shaders/gpu_shader_vertex_world.glsl SRC) -data_to_c_simple(shaders/gpu_shader_vsm_store_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_vsm_store_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_gpencil_stroke_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_gpencil_stroke_frag.glsl SRC) diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index ec5ffc0f354..d761ffc6a6d 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -107,8 +107,7 @@ int GPU_shader_get_attribute(GPUShader *shader, const char *name); /* Builtin/Non-generated shaders */ typedef enum GPUBuiltinShader { - GPU_SHADER_VSM_STORE, - GPU_SHADER_SEP_GAUSSIAN_BLUR, + /* UNUSED (TODO REMOVE) */ GPU_SHADER_SMOKE, GPU_SHADER_SMOKE_FIRE, GPU_SHADER_SMOKE_COBA, diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 0cda67b8968..98f9e22cbc1 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -63,8 +63,6 @@ #include <stdarg.h> extern char datatoc_gpu_shader_material_glsl[]; -extern char datatoc_gpu_shader_vertex_glsl[]; -extern char datatoc_gpu_shader_vertex_world_glsl[]; extern char datatoc_gpu_shader_geometry_glsl[]; static char *glsl_material_library = NULL; diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 427a3fd233e..62e6427a738 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -158,10 +158,6 @@ extern char datatoc_gpu_shader_keyframe_diamond_frag_glsl[]; extern char datatoc_gpu_shader_fire_frag_glsl[]; extern char datatoc_gpu_shader_smoke_vert_glsl[]; extern char datatoc_gpu_shader_smoke_frag_glsl[]; -extern char datatoc_gpu_shader_vsm_store_vert_glsl[]; -extern char datatoc_gpu_shader_vsm_store_frag_glsl[]; -extern char datatoc_gpu_shader_sep_gaussian_blur_vert_glsl[]; -extern char datatoc_gpu_shader_sep_gaussian_blur_frag_glsl[]; extern char datatoc_gpu_shader_gpencil_stroke_vert_glsl[]; extern char datatoc_gpu_shader_gpencil_stroke_frag_glsl[]; @@ -722,9 +718,6 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) BLI_assert(shader != GPU_NUM_BUILTIN_SHADERS); /* don't be a troll */ static const GPUShaderStages builtin_shader_stages[GPU_NUM_BUILTIN_SHADERS] = { - [GPU_SHADER_VSM_STORE] = { datatoc_gpu_shader_vsm_store_vert_glsl, datatoc_gpu_shader_vsm_store_frag_glsl }, - [GPU_SHADER_SEP_GAUSSIAN_BLUR] = { datatoc_gpu_shader_sep_gaussian_blur_vert_glsl, - datatoc_gpu_shader_sep_gaussian_blur_frag_glsl }, [GPU_SHADER_SMOKE] = { datatoc_gpu_shader_smoke_vert_glsl, datatoc_gpu_shader_smoke_frag_glsl }, [GPU_SHADER_SMOKE_FIRE] = { datatoc_gpu_shader_smoke_vert_glsl, datatoc_gpu_shader_smoke_frag_glsl }, [GPU_SHADER_SMOKE_COBA] = { datatoc_gpu_shader_smoke_vert_glsl, datatoc_gpu_shader_smoke_frag_glsl }, diff --git a/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl b/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl deleted file mode 100644 index c4e7cff2b0b..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl +++ /dev/null @@ -1,15 +0,0 @@ -uniform sampler2D depthbuffer; - -in vec4 uvcoordsvar; - -void main(void) -{ - float depth = texture(depthbuffer, uvcoordsvar.xy).r; - - /* XRay background, discard */ - if (depth >= 1.0) { - discard; - } - - gl_FragDepth = depth; -} diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl deleted file mode 100644 index 15d30e75969..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl +++ /dev/null @@ -1,209 +0,0 @@ -/* amount of offset to move one pixel left-right. - * In second pass some dimensions are zero to control verical/horizontal convolution */ -uniform vec2 invrendertargetdim; -// color buffer -uniform sampler2D colorbuffer; -//blurred color buffer for DOF effect -uniform sampler2D blurredcolorbuffer; -// slightly blurred buffer -uniform sampler2D mblurredcolorbuffer; -// depth buffer -uniform sampler2D depthbuffer; - -// this includes focal distance in x and aperture size in y -uniform vec4 dof_params; - -// viewvectors for reconstruction of world space -uniform vec4 viewvecs[3]; - -// 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; - -float calculate_far_coc(in float zdepth) -{ - float coc = dof_params.x * max(1.0 - dof_params.y / zdepth, 0.0); - - /* multiply by 1.0 / sensor size to get the normalized size */ - return coc * dof_params.z; -} - -/* near coc only! when distance is nearer than focus plane first term is bigger than one */ -vec4 calculate_near_coc(in vec4 zdepth) -{ - vec4 coc = dof_params.x * max(vec4(dof_params.y) / zdepth - vec4(1.0), vec4(0.0)); - - /* multiply by 1.0 / sensor size to get the normalized size */ - return coc * dof_params.z; -} - -/* first pass blurs the color buffer heavily and gets the near coc only. - * There are many texture accesses here but they are done on a - * lower resolution image so overall bandwidth is not a concern */ -void first_pass() -{ - vec4 depth; - vec4 zdepth; - vec4 coc; - float final_coc; - - /* amount to add to uvs so that they move one row further */ - vec2 offset_row[3]; - offset_row[0] = vec2(0.0, invrendertargetdim.y); - offset_row[1] = 2.0 * offset_row[0]; - offset_row[2] = 3.0 * offset_row[0]; - - /* heavily blur the image */ - vec4 color = texture(colorbuffer, color_uv1); - color += texture(colorbuffer, color_uv1 + offset_row[1]); - color += texture(colorbuffer, color_uv2); - color += texture(colorbuffer, color_uv2 + offset_row[1]); - color /= 4.0; - - depth.r = texture(depthbuffer, depth_uv1).r; - depth.g = texture(depthbuffer, depth_uv2).r; - depth.b = texture(depthbuffer, depth_uv3).r; - depth.a = texture(depthbuffer, depth_uv4).r; - - zdepth = get_view_space_z_from_depth(vec4(viewvecs[0].z), vec4(viewvecs[1].z), depth); - coc = calculate_near_coc(zdepth); - - depth.r = texture(depthbuffer, depth_uv1 + offset_row[0]).r; - depth.g = texture(depthbuffer, depth_uv2 + offset_row[0]).r; - depth.b = texture(depthbuffer, depth_uv3 + offset_row[0]).r; - depth.a = texture(depthbuffer, depth_uv4 + offset_row[0]).r; - - zdepth = get_view_space_z_from_depth(vec4(viewvecs[0].z), vec4(viewvecs[1].z), depth); - coc = max(calculate_near_coc(zdepth), coc); - - depth.r = texture(depthbuffer, depth_uv1 + offset_row[1]).r; - depth.g = texture(depthbuffer, depth_uv2 + offset_row[1]).r; - depth.b = texture(depthbuffer, depth_uv3 + offset_row[1]).r; - depth.a = texture(depthbuffer, depth_uv4 + offset_row[1]).r; - - zdepth = get_view_space_z_from_depth(vec4(viewvecs[0].z), vec4(viewvecs[1].z), depth); - coc = max(calculate_near_coc(zdepth), coc); - - depth.r = texture(depthbuffer, depth_uv1 + offset_row[2]).r; - depth.g = texture(depthbuffer, depth_uv2 + offset_row[2]).r; - depth.b = texture(depthbuffer, depth_uv3 + offset_row[2]).r; - depth.a = texture(depthbuffer, depth_uv4 + offset_row[2]).r; - - zdepth = get_view_space_z_from_depth(vec4(viewvecs[0].z), vec4(viewvecs[1].z), depth); - coc = max(calculate_near_coc(zdepth), coc); - - final_coc = max(max(coc.x, coc.y), max(coc.z, coc.w)); - FragColor = vec4(color.rgb, final_coc); -} - -/* second pass, gaussian blur the downsampled image */ -void second_pass() -{ - vec4 depth = vec4(texture(depthbuffer, uvcoordsvar.xy).r); - - /* clever sampling to sample 2 pixels at once. Of course it's not real gaussian sampling this way */ - vec4 color = texture(colorbuffer, uvcoordsvar.xy) * 0.3125; - color += texture(colorbuffer, uvcoordsvar.xy + invrendertargetdim) * 0.234375; - color += texture(colorbuffer, uvcoordsvar.xy + 2.5 * invrendertargetdim) * 0.09375; - color += texture(colorbuffer, uvcoordsvar.xy + 4.5 * invrendertargetdim) * 0.015625; - color += texture(colorbuffer, uvcoordsvar.xy - invrendertargetdim) * 0.234375; - color += texture(colorbuffer, uvcoordsvar.xy - 2.5 * invrendertargetdim) * 0.09375; - color += texture(colorbuffer, uvcoordsvar.xy - 4.5 * invrendertargetdim) * 0.015625; - - FragColor = color; -} - - -/* third pass, calculate the final coc from blurred and unblurred images */ -void third_pass() -{ - vec4 color = texture(colorbuffer, uvcoordsvar.xy); - vec4 color_blurred = texture(blurredcolorbuffer, uvcoordsvar.xy); - float coc = 2.0 * max(color_blurred.a, color.a); -color.a; - FragColor = vec4(color.rgb, coc); -} - - -/* fourth pass, blur the final coc once to get rid of discontinuities */ -void fourth_pass() -{ - vec4 colo @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs