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 4767

Summary: Direct3D 11 renderer emits error message when created
Product: SDL Reporter: Alex <fatlock>
Component: renderAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.10   
Hardware: x86_64   
OS: Windows 10   
Attachments: Sample initialization

Description Alex 2019-08-19 13:59:17 UTC
Created attachment 3927 [details]
Sample initialization

When creating a Direct3D 11 renderer you get some error messages. They are visible if debug logs are enabled.

Here is an output from Visual Studio:

D3D11 ERROR: ID3D11Device::CreateBuffer: The Dimensions are invalid. ByteWidth cannot be 0. [ STATE_CREATION ERROR #66: CREATEBUFFER_INVALIDDIMENSIONS]
D3D11 ERROR: ID3D11Device::CreateBuffer: CreateBuffer returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #69: CREATEBUFFER_INVALIDARG_RETURN]
DEBUG: __FUNCTION__, ID3D11Device1::CreateBuffer [vertex buffer]: The parameter is incorrect.
INFO: Created renderer: direct3d11
Comment 1 Alex 2019-08-19 16:43:49 UTC
It seems like ignoring commands without vertex data. Because code like this:

SDL_RenderClear(renderer);
SDL_RenderFlush(renderer);

just doesn't work.

So I looked at the sources and found this code:

if (D3D11_UpdateVertexBuffer(renderer, vertices, vertsize) < 0) {
    return -1;
}

Then changed into:

if (vertsize > 0 && D3D11_UpdateVertexBuffer(renderer, vertices, vertsize) < 0) {
    return -1;
}

Now works as expected but I'm not sure!