Results 1 to 3 of 3

Thread: possible ati driver bug?

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    2

    possible ati driver bug?

    Hello!

    I'm posting this here in the hope that I missed something and my code is to blame, currently I'm lost and think ATI has a driver bug.
    The following code simply writes some values to a float tex and reads them back in - but the values read back appear to be garbled. If NUM_READ_CHANNELS is changed to 4, the output is correct. I reproduced the problem on different cards and on Win and Linux. Any hints? Otherwise I'll turn to ATI with this issue.

    thx,
    chris

    Ouput:
    1 2 3 1 2 3 1 2 3 255 510 765
    1 2 3 1 2 3 1 2 3 255 510 765
    1 2 3 1 2 3 1 2 3 255 510 765
    1 2 3 1 2 3 1 2 3 255 510 765
    Code :
     
     
    #include <string>
    #include <vector>
    #include <iostream>
     
    #include <assert.h>
     
    #include <GL/glew.h>
    #include <GL/glut.h>
     
     
    const unsigned TEX_SIZE = 4;
    const unsigned NUM_READ_CHANNELS = 3;
     
     
    int main( int argc, char **argv )
    {
        glutInit            ( &amp;argc, argv ); 
        glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE ); 
        glutInitWindowSize  ( 500, 500 ); 
        glutCreateWindow    ( "" );
     
     
        GLenum err = glewInit();
        assert (GLEW_OK == err);
        assert(glewIsSupported("GL_ATI_texture_float"));
     
        GLfloat init_values[TEX_SIZE*TEX_SIZE*4];
        for (unsigned i=0; i<TEX_SIZE; ++i)
        {
            for (unsigned j=0; j<TEX_SIZE; ++j)
            {
                init_values[3*(i+TEX_SIZE*j)  ] = 1.0f;
                init_values[3*(i+TEX_SIZE*j)+1] = 2.0f;
                init_values[3*(i+TEX_SIZE*j)+2] = 3.0f;
            }
        }
     
        GLuint tex;
        glGenTextures(1, &amp;tex);
        assert(tex);
     
        glBindTexture(GL_TEXTURE_2D, tex);
        glTexImage2D(GL_TEXTURE_2D, 0,
                     GL_RGB_FLOAT16_ATI,
                     TEX_SIZE, TEX_SIZE, 0,
                     GL_RGB, GL_FLOAT,
                     init_values);
     
     
     
        glGetTexImage(GL_TEXTURE_2D,
                      0, NUM_READ_CHANNELS == 3 ? GL_RGB : GL_RGBA,
                      GL_FLOAT,
                      init_values);
     
     
        for (unsigned i=0; i<TEX_SIZE; ++i)
        {
            for (unsigned j=0; j<TEX_SIZE; ++j)
            {
                for (unsigned c=0; c<NUM_READ_CHANNELS; ++c)
                {
                    std::cout << init_values[NUM_READ_CHANNELS*(j + i*TEX_SIZE)+c] << " ";
                }
     
            }
            std::cout << "\n";
        }
     
        std::cout << "\n";
     
     
     
        return 0;
    }

  2. #2
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Re: possible ati driver bug?

    Seems like a driver bug indeed. 255/510/765 are actually 1*255, 2*255 and 3*255 so it seems like conversion from internal storage to client side format fails when you call glGetTexImage. If I'll find some time during next 2-3 days I'll run this on NVIDIA to compare results but I allready assume they'll be different.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    2

    Re: possible ati driver bug?

    Thx, that is what I concluded too. I just wonder how this bug could go unnoticed - general purpose GPU algorithms which involve reading back results aren't so uncommon anymore...
    At least there is the workaround of reading RGBA format.

    greetings
    chris

Similar Threads

  1. Convert 32bit Driver or Fix OpenGL Driver Issue?
    By GelBlok in forum OpenGL: Drivers
    Replies: 0
    Last Post: 06-26-2018, 08:12 PM
  2. Replies: 10
    Last Post: 07-15-2014, 01:57 AM
  3. does opengl use the OS video driver or is it a video driver?
    By jean-bobby in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-24-2004, 08:19 AM
  4. nVidia OpenGL driver: Driver component sizes mis-match
    By in forum OpenGL: User Software
    Replies: 1
    Last Post: 06-15-2003, 10:20 AM
  5. How can I make a driver the default driver?
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 06-12-2000, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean