Cleanup: Workbench: Remove unused resources in cavity shaders
This avoid uneeded resource binds.
This commit is contained in:
parent
71fff31990
commit
0dd3e77d71
|
@ -3,11 +3,7 @@
|
|||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_cavity_common)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "normalBuffer")
|
||||
.sampler(2, ImageType::UINT_2D, "objectIdBuffer")
|
||||
.sampler(3, ImageType::FLOAT_2D, "cavityJitter")
|
||||
.uniform_buf(3, "vec4", "samples_coords[512]")
|
||||
.sampler(0, ImageType::FLOAT_2D, "normalBuffer")
|
||||
.uniform_buf(4, "WorldData", "world_data", Frequency::PASS)
|
||||
.typedef_source("workbench_shader_shared.h")
|
||||
.fragment_source("workbench_effect_cavity_frag.glsl")
|
||||
|
@ -17,15 +13,23 @@ GPU_SHADER_CREATE_INFO(workbench_effect_cavity_common)
|
|||
GPU_SHADER_CREATE_INFO(workbench_effect_cavity)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_CAVITY")
|
||||
.uniform_buf(3, "vec4", "samples_coords[512]")
|
||||
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "cavityJitter")
|
||||
.additional_info("workbench_effect_cavity_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_curvature)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_CURVATURE")
|
||||
.sampler(1, ImageType::UINT_2D, "objectIdBuffer")
|
||||
.additional_info("workbench_effect_cavity_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_cavity_curvature)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_CAVITY")
|
||||
.define("USE_CURVATURE")
|
||||
.uniform_buf(3, "vec4", "samples_coords[512]")
|
||||
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "cavityJitter")
|
||||
.sampler(3, ImageType::UINT_2D, "objectIdBuffer")
|
||||
.additional_info("workbench_effect_cavity_common");
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
/* From The Alchemy screen-space ambient obscurance algorithm
|
||||
* http://graphics.cs.williams.edu/papers/AlchemyHPG11/VV11AlchemyAO.pdf */
|
||||
|
||||
#ifdef USE_CAVITY
|
||||
|
||||
void cavity_compute(vec2 screenco,
|
||||
sampler2D depthBuffer,
|
||||
sampler2D normalBuffer,
|
||||
|
@ -90,3 +92,5 @@ void cavity_compute(vec2 screenco,
|
|||
cavities = clamp(cavities * world_data.cavity_valley_factor, 0.0, 1.0);
|
||||
edges = edges * world_data.cavity_ridge_factor;
|
||||
}
|
||||
|
||||
#endif /* USE_CAVITY */
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(workbench_common_lib.glsl)
|
||||
|
||||
#ifdef USE_CURVATURE
|
||||
|
||||
float curvature_soft_clamp(float curvature, float control)
|
||||
{
|
||||
if (curvature < 0.5 / control) {
|
||||
|
@ -43,3 +47,5 @@ void curvature_compute(vec2 uv,
|
|||
curvature = 2.0 * curvature_soft_clamp(normal_diff, world_data.curvature_ridge);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* USE_CURVATURE */
|
||||
|
|
|
@ -164,10 +164,10 @@ void workbench_cavity_cache_init(WORKBENCH_Data *data)
|
|||
|
||||
grp = DRW_shgroup_create(sh, psl->cavity_ps);
|
||||
DRW_shgroup_uniform_texture(grp, "normalBuffer", wpd->normal_buffer_tx);
|
||||
DRW_shgroup_uniform_block(grp, "samples_coords", wpd->vldata->cavity_sample_ubo);
|
||||
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
|
||||
|
||||
if (SSAO_ENABLED(wpd)) {
|
||||
DRW_shgroup_uniform_block(grp, "samples_coords", wpd->vldata->cavity_sample_ubo);
|
||||
DRW_shgroup_uniform_texture(grp, "depthBuffer", dtxl->depth);
|
||||
DRW_shgroup_uniform_texture(grp, "cavityJitter", wpd->vldata->cavity_jitter_tx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue