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 2677 - SDL_UpdateTexture crashes for texture with SDL_TEXTUREACCESS_TARGET
Summary: SDL_UpdateTexture crashes for texture with SDL_TEXTUREACCESS_TARGET
Status: RESOLVED DUPLICATE of bug 2625
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86 Windows (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-08 14:54 UTC by Damian Kaczmarek
Modified: 2015-05-31 05:57 UTC (History)
1 user (show)

See Also:


Attachments
Example showing the problem (1.37 KB, text/x-c++src)
2014-08-08 14:54 UTC, Damian Kaczmarek
Details
Fix for the bug (987 bytes, patch)
2014-08-08 16:56 UTC, Damian Kaczmarek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Damian Kaczmarek 2014-08-08 14:54:28 UTC
Created attachment 1806 [details]
Example showing the problem

I have SDL2 compiled from latest HG with mingw.

i686-w64-mingw32-g++ sdl2_windows-sdl_update_texture_crash.cpp -l SDL2 -o sdl2_windows-sdl_update_texture_crash.exe

Crashes both on Windows and on Wine. Example works on Linux.

Crashes inside SDL_UpdateTexture

Please advise

Note: possibly duplicate of Bug 2625 but not sure
Comment 1 Damian Kaczmarek 2014-08-08 16:56:30 UTC
Created attachment 1807 [details]
Fix for the bug

Fixed crash, please review. According to my tests it's working properly.
Comment 2 Sam Lantinga 2014-08-17 05:54:38 UTC
According to the documentation, the lockrect on the render target, created in D3DPOOL_DEFAULT, should fail:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb205913(v=vs.85).aspx

Is that what you're seeing? The update doesn't crash, but also doesn't actually happen?
Comment 3 Sam Lantinga 2014-08-17 06:18:33 UTC
Can you check to see if this fixes the issue for you?
https://hg.libsdl.org/SDL/rev/86a6f6d92960

Thanks!
Comment 4 Damian Kaczmarek 2014-08-17 12:24:53 UTC
As far as I am concerned my update fixed it and I am not seeing any adverse effects. In what way is it wrong? Do you have a test program that fails? I see your patch is quite large. I can check this but probably tomorrow earliest.
Comment 5 Sam Lantinga 2014-08-17 17:13:02 UTC
LockRect on the render target, created in D3DPOOL_DEFAULT is supposed to fail, according to Microsoft's documentation, and I have seen this in the past. My patch uses a staging surface for render targets as well, which is the recommended way of updating textures.
Comment 6 Damian Kaczmarek 2014-08-17 22:31:36 UTC
I see, so it worked for me by accident? :) (non conformant NVIDIA driver?)
Comment 7 Sam Lantinga 2014-08-17 23:33:51 UTC
Yes, most likely. When you get a chance, can you try the patch?

Thanks!
Comment 8 Ryan C. Gordon 2015-02-19 02:54:48 UTC
Just pinging to see if we can close this bug with the changes Sam made, or if it needs further work.

--ryan.
Comment 9 Ryan C. Gordon 2015-02-19 02:55:48 UTC
Whoops, changing the bug status back to WAITING

--ryan.
Comment 10 Ryan C. Gordon 2015-05-31 05:57:12 UTC
Marking this as a duplicate of Bug #2625, under the assumption that it's the same problem and benefits from the same fix. Please feel free to reopen if this is still causing you problems!

--ryan.

*** This bug has been marked as a duplicate of bug 2625 ***