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

Fix local uniform buffers not always bound on draw #5681

Merged
merged 4 commits into from
Mar 22, 2023

Conversation

frenzibyte
Copy link
Member

This caused Metal to crash when loading a colour picker, due to the UBO not being bound in the front-to-back pass. Rather than duplicating code there, I've refactored the API to force UBOs to always be bound whenever the DrawNode wishes to bind the shader.

DrawNodes that bind other shaders will have to manually bind UBOs themselves. One alternative direction I had was to completely mark IShader.Bind/Unbind internal and re-define the methods in DrawNode instead, along with logic to store uniform blocks in the shader in order to be bound on DrawNode.BindShader.

vNext

TexturedShaderDrawNode.TextureShader is made private

This is partially done to force consumers into binding uniform blocks in the newly defined TexturedShaderDrawNode.BindUniformResources method, such that uniform blocks are always bound whenever the corresponding shader is used for drawing in the framework.

For binding/unbinding shaders, use TexturedShaderDrawNode.BindTextureShader/TexturedShaderDrawNode.UnbindTextureShader instead.

@peppy peppy enabled auto-merge March 22, 2023 05:18
@peppy peppy merged commit 840aec2 into ppy:master Mar 22, 2023
@frenzibyte frenzibyte deleted the fix-ubo-not-bound branch March 22, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants