Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Fix fragcolor write locations in scene shaders #92070

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions drivers/gles2/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2467,17 +2467,21 @@ FRAGMENT_SHADER_CODE
frag_color.rgb = mix(pow((frag_color.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), frag_color.rgb * (1.0 / 12.92), vec3(lessThan(frag_color.rgb, vec3(0.04045))));
#endif

// Write to the final output once and only once.
// Use a temporary in the rest of the shader.
// This is for drivers that have a performance drop
// when the output is read during the shader.
gl_FragColor = frag_color;
Copy link
Member Author

@lawnjelly lawnjelly May 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this because it turns out RENDER_DEPTH is actually depth only pass, and we don't want to write to color in depth only pass.

(TURNS OUT - unless we are using RGBA shadows 😀 ).


#else // not RENDER_DEPTH
//depth render
#ifdef USE_RGBA_SHADOWS

highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
highp vec4 comp = fract(depth * vec4(255.0 * 255.0 * 255.0, 255.0 * 255.0, 255.0, 1.0));
comp -= comp.xxyz * vec4(0.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
frag_color = comp;
gl_FragColor = comp;

#endif
#endif

gl_FragColor = frag_color;
}
4 changes: 2 additions & 2 deletions drivers/gles3/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2453,13 +2453,13 @@ FRAGMENT_SHADER_CODE
#endif //ubershader-runtime
#endif //SHADELESS //ubershader-runtime

#endif //USE_MULTIPLE_RENDER_TARGETS //ubershader-runtime

// Write to the final output once and only once.
// Use a temporary in the rest of the shader.
// This is for drivers that have a performance drop
// when the output is read during the shader.
frag_color_final = frag_color;

#endif //USE_MULTIPLE_RENDER_TARGETS //ubershader-runtime
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment may be incorrect, should be // not USE_MULTIPLE_RENDER_TARGETS...


#endif //RENDER_DEPTH //ubershader-runtime
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems incorrect, should be // not RENDER_DEPTH_ONLY.

}
Loading