diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-03-02 16:33:29 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-03-02 16:33:45 +0300 |
commit | 9c4523b1fde4419b8b59744f03b3fffbb2571436 (patch) | |
tree | 00cbb95f4d3359aecc90fe59ba632313a404a95d /source/blender/draw | |
parent | 847c091ae838a0e5268fc327dac931c810d88d9b (diff) |
Fix crash when compiling renderpass shader on some AMD drivers
Differential Revision: https://developer.blender.org/D6959
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl b/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl index 03520c55a85..b54974ce46a 100644 --- a/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl @@ -49,6 +49,7 @@ vec3 safe_divide_even_color(vec3 a, vec3 b) void main() { + vec3 color; ivec2 texel = ivec2(gl_FragCoord.xy); if (postProcessType == PASS_POST_DEPTH) { @@ -59,7 +60,7 @@ void main() else { depth = -get_view_z_from_depth(depth); } - fragColor.r = depth; + color = vec3(depth); } else if (postProcessType == PASS_POST_AO) { float ao_accum = texelFetch(inputBuffer, texel, 0).r; @@ -73,33 +74,35 @@ void main() if (depth != 1.0 && any(notEqual(encoded_normal, vec2(0.0)))) { vec3 decoded_normal = normal_decode(texelFetch(inputBuffer, texel, 0).rg, vec3(0.0)); vec3 world_normal = mat3(ViewMatrixInverse) * decoded_normal; - fragColor = vec4(world_normal, 1.0); + color = world_normal; } else { - fragColor = vec4(0.0, 0.0, 0.0, 1.0); + color = vec3(0.0); } } else if (postProcessType == PASS_POST_ACCUMULATED_VALUE) { float accumulated_value = texelFetch(inputBuffer, texel, 0).r; - fragColor = vec4(vec3(accumulated_value / currentSample), 1.0); + color = vec3(accumulated_value / currentSample); } else if (postProcessType == PASS_POST_ACCUMULATED_COLOR) { vec3 accumulated_color = texelFetch(inputBuffer, texel, 0).rgb; - fragColor = vec4(accumulated_color / currentSample, 1.0); + color = (accumulated_color / currentSample); } else if (postProcessType == PASS_POST_ACCUMULATED_LIGHT) { vec3 accumulated_light = texelFetch(inputBuffer, texel, 0).rgb; vec3 accumulated_color = texelFetch(inputColorBuffer, texel, 0).rgb; - fragColor = vec4(safe_divide_even_color(accumulated_light, accumulated_color), 1.0); + color = safe_divide_even_color(accumulated_light, accumulated_color); } else if (postProcessType == PASS_POST_TWO_LIGHT_BUFFERS) { vec3 accumulated_light = texelFetch(inputBuffer, texel, 0).rgb + texelFetch(inputSecondLightBuffer, texel, 0).rgb; vec3 accumulated_color = texelFetch(inputColorBuffer, texel, 0).rgb; - fragColor = vec4(safe_divide_even_color(accumulated_light, accumulated_color), 1.0); + color = safe_divide_even_color(accumulated_light, accumulated_color); } else { /* Output error color: Unknown how to post process this pass. */ - fragColor = vec4(1.0, 0.0, 1.0, 1.0); + color = vec3(1.0, 0.0, 1.0); } + + fragColor = vec4(color, 1.0); } |