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 - Direct3D 11 renderer emits error message when created
Summary: Direct3D 11 renderer emits error message when created
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.10
Hardware: x86_64 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-19 13:59 UTC by Alex
Modified: 2019-08-19 16:44 UTC (History)
0 users

See Also:


Attachments
Sample initialization (464 bytes, text/plain)
2019-08-19 13:59 UTC, Alex
Details

Note You need to log in before you can comment on or make changes to this bug.
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!