Commit ce2aa2ee authored by Sam Lantinga's avatar Sam Lantinga

Zero streaming textures at the driver level

parent c506aacb
...@@ -427,7 +427,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -427,7 +427,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
/* Need to add size for the U and V planes */ /* Need to add size for the U and V planes */
size += (2 * (texture->h * data->pitch) / 4); size += (2 * (texture->h * data->pitch) / 4);
} }
data->pixels = SDL_malloc(size); data->pixels = SDL_calloc(1, size);
if (!data->pixels) { if (!data->pixels) {
SDL_OutOfMemory(); SDL_OutOfMemory();
SDL_free(data); SDL_free(data);
......
...@@ -322,7 +322,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -322,7 +322,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (texture->access == SDL_TEXTUREACCESS_STREAMING) { if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
data->pixels = SDL_malloc(texture->h * data->pitch); data->pixels = SDL_calloc(1, texture->h * data->pitch);
if (!data->pixels) { if (!data->pixels) {
SDL_OutOfMemory(); SDL_OutOfMemory();
SDL_free(data); SDL_free(data);
......
...@@ -272,7 +272,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) ...@@ -272,7 +272,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
if (texture->access == SDL_TEXTUREACCESS_STREAMING) if (texture->access == SDL_TEXTUREACCESS_STREAMING)
{ {
tdata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); tdata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
tdata->pixel_data = SDL_malloc(tdata->pitch * texture->h); tdata->pixel_data = SDL_calloc(1, tdata->pitch * texture->h);
if (!tdata->pixel_data) if (!tdata->pixel_data)
{ {
SDL_OutOfMemory(); SDL_OutOfMemory();
......
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