Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Weird ImageStore Behaviour

  1. #1
    Newbie Newbie
    Join Date
    Oct 2018
    Posts
    2

    Weird ImageStore Behaviour

    I found that my fragment or compute shader cannot imageStore anything to the multi-channel image texture initialized in this way.

    Method A:
    Code :
            glGenTextures(1, &tex);
    	glBindTexture(GL_TEXTURE_2D, tex);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, imgWidth, imgHeight, 0, GL_RGBA, GL_FLOAT, NULL);

    I got an all zero buffer when I read back using glGetTextureImage.

    However, when I changed the initialization to this:

    Method B:
    Code :
            glGenTextures(1, &tex);
    	glBindTexture(GL_TEXTURE_2D, tex);
    	glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, imgWidth, imgHeight);

    The problem was fixed.

    (For both, I bind the texture to the image unit by
    Code :
    	glBindImageTexture(1, tex, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
    )

    The weird thing is that method A works when I use single channel texture (e.g. GL32F).

    Is that incorrect use of API or is it the driver's problem?

    Thanks.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    Are you using glMemoryBarrier?

  3. #3
    Newbie Newbie
    Join Date
    Oct 2018
    Posts
    2
    Quote Originally Posted by Dark Photon View Post
    Are you using glMemoryBarrier?
    I added glMemoryBarrier(GL_ALL_BARRIER_BITS) between the draw call and the glGetTextureImage call, but still got a zero image when using initialization method A.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    It looks like it might be a driver bug. Which GPU and driver are you using?

    If you post a short, standalone test program, folks here could try your code and give you testing results, as well as help check that you're not missing something important.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •