Fix crash when compiling renderpass shader on some AMD drivers
Differential Revision: https://developer.blender.org/D6959
This commit is contained in:
parent
847c091ae8
commit
9c4523b1fd
Notes:
blender-bot
2023-05-29 09:17:12 +02:00
Referenced by issue #74431, Eevee Ambient Occlusion Pass not working Referenced by issue #74274, Blender 2.82a proposed revisions Referenced by issue #74174, Eevee: Crash upon opening material properties
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue