Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-46826

setData triggers additional glTextureSubImage call for 1D array texture layer 0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.4.2
    • GUI: OpenGL
    • None
    • Arch Linux
    • a05d8c73ffd38414c22be801d6c9d27c1d34ab93

    Description

      When calling setData on a layered texture (I did not test others) there is an additonal call to glTextureSubImage that is unexpected (for me).

      When tracing the attached program with apitrace, the setData line creates the following trace entries:

      glTextureSubImage2DEXT(texture = 1, target = GL_TEXTURE_1D_ARRAY, level = 0, xoffset = 0, yoffset = 1, width = 100, height = 1, format = GL_RGBA, type = GL_FLOAT, pixels = [binary data, size = 1.5625 kb])
      glTextureSubImage2DEXT(texture = 1, target = GL_TEXTURE_1D_ARRAY, level = 0, xoffset = 0, yoffset = 0, width = 100, height = 1, format = GL_RGBA, type = GL_FLOAT, pixels = [binary data, size = 1.5625 kb])

      The first call to TextureSubImage does what I expected from the setData call and the second one sets exactly the same data but on level zero which I didn't expect.

      I noticed this in an application where the level zero contained invalid data: the data from the last level. Each setData call triggered two glTextureSubImage calls of which the latter was always assigning the data to level 0.

      At first I thought I could work around this by using the setData overload without a layer to upload all layers at once but this overload also just works on layer 0. This is somewhat confusing and should probably be noted in the documentation. (I guessed from the apitrace and confirmed it by perusing the Qt sources.)

      This leaves me the following workarounds:

      • not using the setData members for data upload on (1D)Array textures
      • calling setData for layer 0 after all other layers

      Maybe I made a mistake when setting up the texture (I find the documentation about this lacking). However, I believe the unconditional upload to layer 0 indicates an error.

      Attachments

        1. main.cpp
          0.8 kB
        2. test.pro
          0.0 kB
        For Gerrit Dashboard: QTBUG-46826
        # Subject Branch Project Status CR V

        Activity

          People

            seanharmer Sean Harmer
            spynacker Martin Schulze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes