Skip to content

Fix global shader texture uniform #107475

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

Merged

Conversation

beicause
Copy link
Contributor

@beicause beicause commented Jun 13, 2025

Fixes #107470

global_shader_parameter_add can add a Texture2D object as a shader parameter, and it is implicitly converted to RID:

const Variant ret = _get_obj().obj->callp(CoreStringName(get_rid), nullptr, 0, ce);

Additionally we can save the RID before textures.push_back() to avoid converting it twice..

@beicause beicause requested a review from a team as a code owner June 13, 2025 05:27
@AThousandShips AThousandShips added this to the 4.5 milestone Jun 13, 2025
@akien-mga akien-mga requested a review from dsnopek June 13, 2025 07:55
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

@akien-mga akien-mga merged commit 3b2b015 into godotengine:master Jun 13, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@dsnopek
Copy link
Contributor

dsnopek commented Jun 13, 2025

Thanks for catching this! (And sorry for introducing the regression :-/)

I just tested these changes with the original MRP from issue #101938, and that issue is still fixed with these new changes :-)

@beicause beicause deleted the fix-global-shader-texture-uniform branch June 14, 2025 04:20
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.

Global shader sampler2d uniforms are blank
4 participants