Skip to content

Conversation

@beicause
Copy link
Contributor

@beicause beicause commented Feb 21, 2025

Fixes #95273. Fixes #85989.

  • Don't change TextureRD's rid when assigned an empty texture_rd_rid, Instead, repalce its texture by a placeholder texture.
  • Check if rd texture is valid to avoid printing errors when users have freed texture_rd_rid of TextureRD and replace the rd texture.

@beicause beicause requested a review from a team as a code owner February 21, 2025 12:58
@AThousandShips AThousandShips added bug topic:rendering cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels Feb 21, 2025
@AThousandShips AThousandShips added this to the 4.5 milestone Feb 21, 2025
@akien-mga akien-mga changed the title TextureRD: don't change its rid when assigned an empty texture_rd_rid TextureRD: Don't change its rid when assigned an empty texture_rd_rid Feb 21, 2025
@beicause beicause force-pushed the texturerd-do-not-change-rid branch from bcf64cc to 192c338 Compare February 22, 2025 03:39
@beicause

This comment was marked as outdated.

@beicause beicause force-pushed the texturerd-do-not-change-rid branch from b939a95 to 3efdcad Compare April 5, 2025 17:54
@beicause beicause requested a review from a team as a code owner April 5, 2025 17:54
@beicause beicause force-pushed the texturerd-do-not-change-rid branch 2 times, most recently from 8c6501d to a809932 Compare April 5, 2025 18:06
@beicause

This comment was marked as outdated.

@beicause beicause force-pushed the texturerd-do-not-change-rid branch from a809932 to 2aa17fc Compare July 29, 2025 16:01
@beicause
Copy link
Contributor Author

beicause commented Jul 29, 2025

Looking back, I realized the way I used to check if the rd texture is valid is wrong.
I think it makes more sense to ignore the invalid free errors because we already do this in texture_free:

void TextureStorage::Texture::cleanup() {
if (RD::get_singleton()->texture_is_valid(rd_texture_srgb)) {
//erase this first, as it's a dependency of the one below
RD::get_singleton()->free(rd_texture_srgb);
}
if (RD::get_singleton()->texture_is_valid(rd_texture)) {
RD::get_singleton()->free(rd_texture);
}

@beicause beicause changed the title TextureRD: Don't change its rid when assigned an empty texture_rd_rid TextureRD: Ignore invalid free error and keep rid unchanged when replacing rd texture Jul 29, 2025
@beicause beicause force-pushed the texturerd-do-not-change-rid branch from 2aa17fc to 04a8994 Compare July 29, 2025 16:20
@Repiteo Repiteo added the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Sep 18, 2025
@Repiteo Repiteo modified the milestones: 4.5, 4.x Sep 18, 2025
@Repiteo Repiteo removed the request for review from a team September 18, 2025 16:42
@akien-mga akien-mga removed cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release topic:rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Texture2Drd nested in ShaderMaterial keeps completely white once an empty RID was assigned to it Error when changing the TextureRID of a Texture2DRD

5 participants