Replies: 1 comment 3 replies
-
I ended up adding a simple 2-frame protection on registered textures, so they are reset only after being unregistered for 2 frames, which resolves the issue. The changes required adding additional systems to free the protected textures during actual transition events, like area changes, but it all worked out. I would still be interested in hearing any advice related to this kind of thing. Thanks! |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Short Version:
Is there any way to determine if a texture is in use by the GPU at runtime?
Long Version:
I'm using a large texture array as my game's entire texture system, where each new needed texture requests an open slot, and each texture being released frees up a slot. It uses reference counting to avoid duplicates and all of that, but I've encountered a pretty serious issue.
When a texture is removed, I swap it out with a blank pure white RGB 16x16 texture. And when an object needs to be refreshed, it is regenerated in a single frame, which causes the textures to be unlinked from the shader, then re-added almost immediately after (most likely to a different texture slot). I've noticed that there are random artifacts appearing on objects when this happens. The artifacts appear almost like tiny squares rather than polygons, which I'm assuming is part of my GPU's pixel renderer. The artifacts appear either white or almost like a transparent-style grid. The grid looks almost like what you might see in Photoshop when you have a single layer that is transparent.
I don't know this for sure, but I believe this is happening because I'm swapping out textures while the GPU is still rendering with them. I'm assuming that since I'm not destroying the textures (just swapping them out), the GPU cannot use any type of reference counting to keep a lock on them.
Is it possible to request this information at runtime, to see if a texture is in use by the GPU? Or perhaps a certain time within a frame that it would always be safe to swap out textures?
Appreciate any info!
Beta Was this translation helpful? Give feedback.
All reactions