We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4679 - Vertex buffer allocation uses illegal argument combination
Summary: Vertex buffer allocation uses illegal argument combination
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86_64 Windows 10
: P2 blocker
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.10
Depends on:
Blocks:
 
Reported: 2019-06-21 04:14 UTC by Cameron Gutman
Modified: 2019-06-21 19:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Gutman 2019-06-21 04:14:59 UTC
The fix for bug #4537 causes IDirect3DDevice9::CreateVertexBuffer() to fail consistently, and thus VBOs are not used. The combination of D3DUSAGE_DYNAMIC and D3DPOOL_MANAGED is illegal, as noted by warnings from the debug D3D9 runtime each time we try to render:

Direct3D9: (ERROR) :D3DUSAGE_DYNAMIC cannot be used with managed vertex buffers
Direct3D9: (ERROR) :Failure trying to create Vertex Buffer

and MSDN says:

"D3DUSAGE_DYNAMIC and D3DPOOL_MANAGED are incompatible and should not be used together." - https://docs.microsoft.com/en-us/windows/desktop/direct3d9/d3dusage

VBOs work again after reverting https://hg.libsdl.org/SDL/rev/412a6f2078d4
Comment 1 Cameron Gutman 2019-06-21 04:15:56 UTC
Oops, the correct rev to revert is: https://hg.libsdl.org/SDL/rev/706e38de05c9
Comment 2 Ryan C. Gordon 2019-06-21 18:14:49 UTC
Ah, well, shoot.

--ryan.
Comment 3 Ryan C. Gordon 2019-06-21 19:12:01 UTC
Okay, so the actual problem in Bug #4537 was that we weren't releasing the vertex buffers on renderer shutdown, so I fixed that and put this back to D3DPOOL_DEFAULT.

I am a little concerned that immediate mode is turning out to be slightly faster than using a vertex buffer, but we're talking about a few FPS when drawing 30,000 sprites. Maybe that's less true at normal usage patterns, if it were enough to lose sleep over in the first place. Maybe I'll revisit that for 2.0.11.

At any rate, this is fixed by https://hg.libsdl.org/SDL/rev/9d3f245739f8, thanks!

--ryan.