Issue with GetData/SetData as of 2024
shmellyorc opened this issue · comments
Prerequisites
- I have verified this issue is present in the
develop
branch - I have searched open and closed issues to ensure it has not already been reported.
MonoGame Version
3.8.1.303
Which MonoGame platform are you using?
MonoGame Cross-Platform Desktop Application (mgdesktopgl)
Operating System
Windows
Description
I had someone play my game and they are getting empty textures. Some textures I pass as a new texture for animations since its easier since my tilemap is a 288x288 tilemap (16 pixel grid). Some sub textures show up but it seems flacky a times.
Also the clock, the water waves, and the fish below the water texture are also sub textures using GetData/SetData.
Even went on an vm of windows 11 to regenerate this issue with the same package that was on my itch.io and I couldnt recreate the issue.
Myself I dont see this issue but a person that was playing my game saw it.
This is the code I used to make a sub textures:
Steps to Reproduce
All the bottom tiles should be shortline animated tiles but they appear as empty textures:
https://youtu.be/UZamucu1lNQ?feature=shared&t=254
Minimal Example Repo
No response
Expected Behavior
Resulting Behavior
Not showing what it should be showing. The person whom was playing my game was playing on windows.
Files
No response
I would be betting on a driver issue and wouldn't be surprised that people having it are running on an Intel integrated graphics (or a computer that has both an IGP and a discrete GPU but it's the IGP taking over). Intel's OpenGL drivers are notoriously wonky.
You should source your tiles or frames... from loaded textures and never from GetData()
.
GetData()
causes the video card to start the return of the texture to main memory, that induces a delay that may or may not or partially be reflected in the current frame. (The video driver thread is async to the game thread)
Rewrite your code to observe best practices, and the issue will resolve itself.