summaryrefslogtreecommitdiff
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-29 11:46:02 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-08-29 11:46:02 -0300
commite8b05ca996baa9819f55fc1d190a79d24906bde7 (patch)
tree422acbb72c190d83f6a5055478c560ae595517ab /drivers/gles3/shaders
parent089cf8176e225f0eee111e835a53c0245674c229 (diff)
-Fixed screen edge SSAO filter, fixes #9678
-Raised the SSAO limits, making the effect a lot more useful -Still pending to enable tresholding to avoid some hollow places
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/ssao_blur.glsl7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl
index ce4154f50c..c7c978dc37 100644
--- a/drivers/gles3/shaders/ssao_blur.glsl
+++ b/drivers/gles3/shaders/ssao_blur.glsl
@@ -56,6 +56,8 @@ uniform ivec2 axis;
uniform float camera_z_far;
uniform float camera_z_near;
+uniform ivec2 screen_size;
+
void main() {
ivec2 ssC = ivec2(gl_FragCoord.xy);
@@ -83,6 +85,7 @@ void main() {
float totalWeight = BASE;
sum *= totalWeight;
+ ivec2 clamp_limit = screen_size - ivec2(1);
for (int r = -R; r <= R; ++r) {
// We already handled the zero case above. This loop should be unrolled and the static branch optimized out,
@@ -90,8 +93,8 @@ void main() {
if (r != 0) {
ivec2 ppos = ssC + axis * (r * SCALE);
- float value = texelFetch(source_ssao, ppos, 0).r;
- float temp_depth = texelFetch(source_depth, ssC, 0).r;
+ float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r;
+ float temp_depth = texelFetch(source_depth, clamp(ssC,ivec2(0),clamp_limit), 0).r;
temp_depth = temp_depth * 2.0 - 1.0;
temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near));