-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
2D: Fix CanvasTexture
rendering when updating channels
#101931
Conversation
a889d66
to
0769ba6
Compare
0769ba6
to
6639174
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected. Code looks good to me.
To test this, try changing the texture of the Background node in https://github.com/Calinou/godot-rendering-tests' tests/2d/test_point_light_2d.tscn
to a CanvasTexture with normal and specular maps.
Looks good to me! Did you test if this closes #101865 as well? |
@clayjohn thanks for the tip – I was funnily enough going to try some code, but great there is an MRP already. Will report back. |
TightLocalVector<RID> *vec = static_cast<TightLocalVector<RID> *>(p_userdata); | ||
RD *rd = RD::get_singleton(); | ||
for (RID rid : *vec) { | ||
// the invalidation callback will take care of clearing rid_set_to_uniform_set cache also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the invalidation callback will take care of clearing rid_set_to_uniform_set cache also | |
// The invalidation callback will also take care of clearing rid_set_to_uniform_set cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot, how'd I miss these. Ehh, we'll just get 'em in a formatting pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye, sorry about that!
@@ -2992,6 +3007,19 @@ void RendererCanvasRenderRD::_render_batch(RD::DrawListID p_draw_list, CanvasSha | |||
const RIDCache::Pair *iter = rid_set_to_uniform_set.insert(key, rid); | |||
uniform_set = &iter->data; | |||
RD::get_singleton()->uniform_set_set_invalidation_callback(rid, RendererCanvasRenderRD::_uniform_set_invalidation_callback, (void *)&iter->key); | |||
|
|||
// If this is a CanvasTexture, it must be tracked so that any changes to the diffuse, normal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If this is a CanvasTexture, it must be tracked so that any changes to the diffuse, normal | |
// If this is a CanvasTexture, it must be tracked so that any changes to the diffuse, normal, |
Thanks! |
Closes #101702
Closes #101865
This PR introduces an invalidation callback API to
TextureStorageRD
forCanvasTexture
, so the 2D renderer can invalidate associated uniform sets when a texture channel, such as diffuse, is modified.