Skip to content
Permalink
Browse files

opengles2: keep cached texturing state correct.

  • Loading branch information
icculus committed Feb 5, 2019
1 parent a609c03 commit b7504f311b57dc666973558d29ff7b84edc335e5
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/render/opengles2/SDL_render_gles2.c
@@ -1400,6 +1400,8 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)

GLES2_ActivateRenderer(renderer);

renderdata->drawstate.texture = NULL; /* we trash this state. */

/* Determine the corresponding GLES texture format params */
switch (texture->format)
{
@@ -1595,6 +1597,8 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
return 0;
}

renderdata->drawstate.texture = NULL; /* we trash this state. */

/* Create a texture subimage with the supplied data */
data->glBindTexture(tdata->texture_type, tdata->texture);
GLES2_TexSubImage2D(data, tdata->texture_type,
@@ -1673,6 +1677,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
return 0;
}

renderdata->drawstate.texture = NULL; /* we trash this state. */

data->glBindTexture(tdata->texture_type, tdata->texture_v);
GLES2_TexSubImage2D(data, tdata->texture_type,
rect->x / 2,
@@ -1867,6 +1873,7 @@ static int GLES2_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, flo
GLES2_ActivateRenderer(renderer);

data->glBindTexture(texturedata->texture_type, texturedata->texture);
renderdata->drawstate.texture = texture;

if (texw) {
*texw = 1.0;
@@ -1885,6 +1892,7 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
GLES2_ActivateRenderer(renderer);

data->glBindTexture(texturedata->texture_type, 0);
data->drawstate.texture = NULL;

return 0;
}

0 comments on commit b7504f3

Please sign in to comment.