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 1676

Summary: Render variable corruption after SDL_SetWindowSize
Product: SDL Reporter: Taiki <taiki>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: blocker    
Priority: P2 CC: aiac0692, taiki
Version: HG 2.0   
Hardware: x86_64   
OS: Windows (All)   
Attachments: Sample of this bug, it'll set RENDER_BUG at 1 after SDL_SetWindowSize

Description Taiki 2013-01-01 04:12:02 UTC
Created attachment 1006 [details]
Sample of this bug, it'll set RENDER_BUG at 1 after SDL_SetWindowSize

Hello,
By switching my app from SDL 1.2 to 2.0, I experimented a lot of weird bugs where create textures fail inexplicably.
By investigating, I succed at reproduce the crash in a really short code (linked).

I reproduce the bug with a 100% accuracy on my 64bits laptop/desktop, running both AMD and Intel CPU, both with ATI graphical cards and with updated pilots.
On a 32 bit netbook with a Intel graphical chip/Atom CPU, the bug never happen.
I work with MinGW, fully updated, it compiled by build of the SDL.

By looking at SDL_GetError(), I get "CreateTexture(): INVALIDCALL".
I went as deep as I could and it fails after a DirectX call. (I've DirectX updated SDK installed on my laptop).

Thanks in advance to look into this bug.
Comment 1 Taiki 2013-02-11 10:19:21 UTC
Hello, as I don't see any answer, here is a new (compilable) sample

int main()
{
    if(SDL_Init(SDL_INIT_VIDEO)) //launch the SDL and check for failure
        return 0;

    SDL_Window *windows = SDL_CreateWindow("Trigger the bug", 50, 25, 50, 75, SDL_WINDOW_OPENGL);
    SDL_Renderer *renderervar = SDL_CreateRenderer(windows, -1, SDL_RENDERER_ACCELERATED);
    SDL_SetWindowSize(windows, 100, 150);
    SDL_RenderClear(renderervar); //Failed, SDL_GetError send "Reset(): INVALIDCALL", and then, any attempt to create texture will fail: the only fix is to destroy the render variable and create it again.
}
Comment 2 Sam Lantinga 2013-03-04 01:10:06 UTC
Can you try in the latest snapshot?
http://www.libsdl.org/tmp/SDL-2.0.zip

Somebody reported a similar bug, which was fixed.

Thanks!
Comment 3 Taiki 2013-03-04 02:43:01 UTC
Seems to be fixed :)
Thanks!
Comment 4 Sam Lantinga 2013-03-06 01:57:49 UTC
Great, thanks! :)