opengles2: keep cached texturing state correct.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 04 Feb 2019 23:32:28 -0500
changeset 1259489dbef84cdcb
parent 12593 307b9da13612
child 12595 4ecb6ce33406
opengles2: keep cached texturing state correct.
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengles2/SDL_render_gles2.c	Mon Feb 04 23:24:10 2019 -0500
     1.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Mon Feb 04 23:32:28 2019 -0500
     1.3 @@ -1400,6 +1400,8 @@
     1.4  
     1.5      GLES2_ActivateRenderer(renderer);
     1.6  
     1.7 +    renderdata->drawstate.texture = NULL;  /* we trash this state. */
     1.8 +
     1.9      /* Determine the corresponding GLES texture format params */
    1.10      switch (texture->format)
    1.11      {
    1.12 @@ -1595,6 +1597,8 @@
    1.13          return 0;
    1.14      }
    1.15  
    1.16 +    renderdata->drawstate.texture = NULL;  /* we trash this state. */
    1.17 +
    1.18      /* Create a texture subimage with the supplied data */
    1.19      data->glBindTexture(tdata->texture_type, tdata->texture);
    1.20      GLES2_TexSubImage2D(data, tdata->texture_type,
    1.21 @@ -1673,6 +1677,8 @@
    1.22          return 0;
    1.23      }
    1.24  
    1.25 +    renderdata->drawstate.texture = NULL;  /* we trash this state. */
    1.26 +
    1.27      data->glBindTexture(tdata->texture_type, tdata->texture_v);
    1.28      GLES2_TexSubImage2D(data, tdata->texture_type,
    1.29                      rect->x / 2,
    1.30 @@ -1867,6 +1873,7 @@
    1.31      GLES2_ActivateRenderer(renderer);
    1.32  
    1.33      data->glBindTexture(texturedata->texture_type, texturedata->texture);
    1.34 +    renderdata->drawstate.texture = texture;
    1.35  
    1.36      if (texw) {
    1.37          *texw = 1.0;
    1.38 @@ -1885,6 +1892,7 @@
    1.39      GLES2_ActivateRenderer(renderer);
    1.40  
    1.41      data->glBindTexture(texturedata->texture_type, 0);
    1.42 +    data->drawstate.texture = NULL;
    1.43  
    1.44      return 0;
    1.45  }