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

Reset blend equation in renderScene() #45

Merged

Conversation

gsamudra
Copy link
Contributor

Mesa was throwing a GL_INVALID_OPERATION from the glDrawArrays call further down because an advanced blending mode was still enabled, while the scene fragment shader has no blend_support.

See this test in _mesa_update_valid_to_render_state for the code which detected this condition.

The blending mode was likely last set from inSetBlendMode in source/inochi2d/core/nodes/common.d.

This patch resets the blend equation before drawing the scene.

Fixes Inochi2D/inochi-session#36.

Mesa was throwing a `GL_INVALID_OPERATION` from the `glDrawArrays` call
further down because an advanced blending mode was still enabled,
while the scene fragment shader has no `blend_support`.

See [this test] in `_mesa_update_valid_to_render_state` for the code
which detected this condition.

[this test]: https://gitlab.freedesktop.org/mesa/mesa/-/blob/47e7b49c61ed72141b20ee9061a320bd259b3e0d/src/mesa/main/draw_validate.c#L132

The blending mode was likely last set from `inSetBlendMode` in
[source/inochi2d/core/nodes/common.d][inSetBlendMode].

[inSetBlendMode]: https://github.com/Inochi2D/inochi2d/blob/d32e41fa7ab900e2fe7fdea0e25f242fcea94de7/source/inochi2d/core/nodes/common.d#L197-L247

This patch resets the blend equation before drawing the scene.

Fixes Inochi2D/inochi-session#36.
@LunaTheFoxgirl
Copy link
Member

Ah yeah that'd explain it, advanced blend equations only work with one destination texture. LGTM, merging

@LunaTheFoxgirl LunaTheFoxgirl merged commit 3b796b1 into Inochi2D:main May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Scene becomes invisible when model is loaded on certain GPUs
2 participants