Skip to content
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

Fix D3D VBOs sometimes initialised with junk data #5690

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

smoogipoo
Copy link
Contributor

@smoogipoo smoogipoo commented Mar 20, 2023

I noticed that every once in a while certain vertices would get incorrect data.

Furthermore this would always occur on vertices that were 0-initialised, which is always the case with exactly one vertex in FBOs since the FtB pass doesn't do anything there (depth = 0). That explains why the issues I was seeing was always when BufferedContainer + blur were involved (e.g. backgrounds, in-gameplay break overlay arrows, song select leaderboard glows).

This makes it so that we always perform one buffer update with 0-initialised data when initialising a VBO. In GLRenderer we are relying on glBufferData to both initialise the storage for us and clean out the driver/GPU buffer, so this was just missed in the port to Veldrid.

peppy
peppy previously approved these changes Mar 20, 2023
@smoogipoo
Copy link
Contributor Author

The documentation of glBufferData lists a similar thing to D3D:

 If data is NULL, a data store of the specified size is still created, but its contents remain uninitialized and thus undefined. 

Which could explain some issues we've had in the past. I've updated this PR to include a similar fix for the GLRenderer implementation.

@peppy peppy enabled auto-merge March 21, 2023 07:22
@peppy peppy merged commit 0e97e94 into ppy:master Mar 21, 2023
@smoogipoo smoogipoo deleted the fix-d3d-vbo-init branch September 11, 2023 02:24
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.

2 participants