Commit f03cab2b authored by Sam Lantinga's avatar Sam Lantinga

Fixed the shader fragment problems using 2 byte YUV data in a 4 byte RGB

texture.  This is a total hack though.  Maybe we should be using a different
texture format?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403304
parent 21f72458
...@@ -184,6 +184,7 @@ typedef struct ...@@ -184,6 +184,7 @@ typedef struct
void *pixels; void *pixels;
int pitch; int pitch;
SDL_DirtyRectList dirty; SDL_DirtyRectList dirty;
int HACK_RYAN_FIXME;
} GL_TextureData; } GL_TextureData;
...@@ -732,8 +733,11 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -732,8 +733,11 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
/* YUV formats use RGBA but are really two bytes per pixel */ /* YUV formats use RGBA but are really two bytes per pixel */
if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) { if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) {
texture_w = (texture_w * bytes_per_pixel(texture->format)) / 4; data->HACK_RYAN_FIXME = 2;
} else {
data->HACK_RYAN_FIXME = 1;
} }
texture_w /= data->HACK_RYAN_FIXME;
data->format = format; data->format = format;
data->formattype = type; data->formattype = type;
...@@ -863,7 +867,7 @@ SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture, ...@@ -863,7 +867,7 @@ SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture,
} }
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
pitch / bytes_per_pixel(texture->format)); (pitch / bytes_per_pixel(texture->format) / ((GL_TextureData *)texture->driverdata)->HACK_RYAN_FIXME));
} }
static int static int
...@@ -1011,7 +1015,7 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -1011,7 +1015,7 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
rect->x * bpp); rect->x * bpp);
printf("texsubimage2d(%d,%d,%d,%d)\n", (int) rect->x, (int) rect->y, (int) rect->w, (int) rect->h); printf("texsubimage2d(%d,%d,%d,%d)\n", (int) rect->x, (int) rect->y, (int) rect->w, (int) rect->h);
data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y, data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
rect->w, rect->h, texturedata->format, rect->w / texturedata->HACK_RYAN_FIXME, rect->h, texturedata->format,
texturedata->formattype, pixels); texturedata->formattype, pixels);
} }
SDL_ClearDirtyRects(&texturedata->dirty); SDL_ClearDirtyRects(&texturedata->dirty);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment