<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - glTexSubImage2D call with bad parameters"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=75251">75251</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>wayland-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>glTexSubImage2D call with bad parameters
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sheffmail@mail.ru
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>1.4.0
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>weston
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Wayland
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In gl-renderer.c:gl_renderer_attach_shm:

glBindTexture(GL_TEXTURE_2D, gs->textures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
         gs->pitch, buffer->height, 0,
         GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);

i.e. texture with GL_BGRA internal format is created for surface.
Later in gl-renderer.c:gl_renderer_flush_damage:

switch (wl_shm_buffer_get_format(buffer->shm_buffer)) {
...
case WL_SHM_FORMAT_RGB565:
    format = GL_RGB;
    pixel_type = GL_UNSIGNED_SHORT_5_6_5;
    break;
...
}

glTexSubImage2D(GL_TEXTURE_2D, 0, r.x1, r.y1,
        r.x2 - r.x1, r.y2 - r.y1,
        format, pixel_type, data);

i.e. glTexSubImage2D is called with format = GL_RGB and type =
GL_UNSIGNED_SHORT_5_6_5, while texture's internal format is GL_BGRA.
Such combination is incorrect and it works only because of OpenGL driver
implementor's good will</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>