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 1589

Summary: Creating a Texture for image of size 64x64 doesn't quite work
Product: SDL Reporter: Pallav Nawani <pallavnawani>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: adam, icculus
Version: HG 2.0Keywords: triage-2.0.4
Hardware: x86_64   
OS: Mac OS X 10.7   
Attachments: test app

Description Pallav Nawani 2012-08-30 04:54:12 UTC
What: Trying to create a texture for image of size 64x64. Image of size 65x65 works fine.
Problem: Texture is created but it isn't visible, we have to do SDL_UpdateTexture() to get it to show itself.

Following piece of code in SDL_render_gl.c (Lines 574-583) seems to be the culprit:

    if (texture->access == SDL_TEXTUREACCESS_STREAMING
        && texture->format == SDL_PIXELFORMAT_ARGB8888
        && (texture->w % 8) == 0) {
        renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
        renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
        renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
                          (data->pitch / SDL_BYTESPERPIXEL(texture->format)));
        renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
                                 texture_h, 0, format, type, data->pixels);
        renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);

Commenting this code seems to solve the problem.
Comment 1 Sam Lantinga 2012-09-28 02:48:26 UTC
Do you have a simple test case?  Maybe something adapted from the programs in the test directory?

Thanks!
Comment 2 Adam M. 2014-05-10 03:09:42 UTC
Is this only for Mac OS X? If not, it seems like a very serious bug.
Comment 3 Pallav Nawani 2014-05-10 10:38:28 UTC
It has been quite some time since I worked on this, so I cannot quite recall the issue. It was for Mac OSX only, caused by the use of some apple specific extensions.
Comment 4 Sam Lantinga 2014-05-10 19:50:04 UTC
Still waiting for a test case... ?
Comment 5 Ryan C. Gordon 2015-02-19 05:22:22 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 6 Ryan C. Gordon 2015-02-21 06:41:31 UTC
Going to try to reproduce this here.

--ryan.
Comment 7 Ryan C. Gordon 2015-02-21 23:36:15 UTC
Created attachment 2040 [details]
test app


I couldn't reproduce this (but it's possible we fixed it since 2012).

I'm attaching my test case. This works if TEXTURESIZE is 64.

--ryan.
Comment 8 Ryan C. Gordon 2015-02-21 23:47:33 UTC
Anyhow, marking this as FIXED. If this is still a problem (or my test case is incorrect!), reopen and we'll investigate further.

Thanks,
--ryan.