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 4913 - Direct3D11 D3D11_UpdateVertexBuffer does not bind VBO when an already created VBO is used
Summary: Direct3D11 D3D11_UpdateVertexBuffer does not bind VBO when an already created...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.1
Hardware: x86_64 Windows 10
: P2 blocker
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2019-12-22 16:27 UTC by Konrad
Modified: 2019-12-23 01:49 UTC (History)
0 users

See Also:


Attachments
Patch (1.47 KB, patch)
2019-12-22 20:02 UTC, Konrad
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konrad 2019-12-22 16:27:37 UTC
After this patch:

https://hg.libsdl.org/SDL/rev/44b0a095f4b7

I did notice "flickering" of my game with Direct3D 11 renderer and looks like this:

https://hg.libsdl.org/SDL/rev/44b0a095f4b7

It was not the case when the VB was recreated each time it was being updated (prior to fix in 2.0.11).

I believe this bug happens because the vertex buffer is bigger than the data (dataSizeInBytes) we are currently drawing, thus some random stuff is popping up here and there because the whole buffer is drawn.

I will check whether I can find an easy fix for this though.
Comment 1 Konrad 2019-12-22 16:35:13 UTC
My bad, here is the video:

https://www.youtube.com/watch?v=hIu01zdC8hc
Comment 2 Konrad 2019-12-22 18:42:52 UTC
Geez, I'm seriously blind. The vertex buffer isn't bound with ID3D11DeviceContext_IASetVertexBuffers.

https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-iasetvertexbuffers

It is only done when vertex buffer is created and that is why it worked before, but it should always be bound after being updated.
Comment 3 Konrad 2019-12-22 20:02:35 UTC
Created attachment 4135 [details]
Patch

Here is the patch for fixing this issue. Vertex buffer is now always bind when used.
Comment 4 Ryan C. Gordon 2019-12-23 01:49:33 UTC
Good catch, this patch is now https://hg.libsdl.org/SDL/rev/d5b022b3511c, thanks!

--ryan.