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 2632

Summary: Corrupted output when copying from a Surface to a Texture
Product: SDL Reporter: Maury Markowitz <maury.markowitz>
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: sdlbug
Version: 2.0.3   
Hardware: x86_64   
OS: Mac OS X 10.8   
Attachments: Problems blitting in SAIS

Description Maury Markowitz 2014-07-07 20:11:38 UTC
Created attachment 1740 [details]
Problems blitting in SAIS

I am porting an SDL game 1.x to 2.x on the Mac. I have most of the game ported and operating properly, but rendering is not working.

The game used a single 8-bit Surface to render into. It filled a number of malloc'ed uint8 buffers with data from picture files, then blitted them into the Surface, and then Flipped. So I did this:

sdltxtr = SDL_CreateTexture(sdlrend,
                            SDL_PIXELFORMAT_ARGB8888,
                            SDL_TEXTUREACCESS_STREAMING,
                            640, 480);
sdlsurf = SDL_CreateRGBSurface(0, 640, 480, 8, 0,0,0,0);

Then I let the code bit into the Surface as normal, and then do this:

SDL_UpdateTexture(sdltxtr, NULL, sdlsurf->pixels, 640 * sizeof (uint8));
SDL_RenderClear(sdlrend);
SDL_RenderCopy(sdlrend, sdltxtr, NULL, NULL);
SDL_RenderPresent(sdlrend);

This causes bad output - garbage from the background basically. You can't see it in the image, but I can see the actual "sprites" (some of which are the whole screen) in the display rotating like an analog TV with bad vertical hold. Code is PD, so I'm happy to upload.
Comment 1 Sam Lantinga 2014-07-08 04:14:37 UTC
Did you verify that there are no SDL errors along the way? Can you attach a link to a complete example showing the problem?

Thanks!
Comment 2 Sam Lantinga 2017-08-14 06:12:02 UTC
No response, hopefully this is fixed.