Quantcast
Channel: AMD Developer Forums: Message List - OpenGL & Vulkan
Viewing all articles
Browse latest Browse all 631

Problem with 3D texture generation.

$
0
0

Hi,

 

I have been working on a small OpenGl demo program on my A8-7600 Kaveri APU, in Qt5.4.

I would set a huge (1024x1024x1024 = 1Gbyte) byte array (volume) as single channel 3D texture.

On top of that, I would like to see the free memory after texture allocation.

Unfortunately the results confuse me, so any advise/explanation is welcome!

 

Here is the relevant code fragment:


void Widget::initializeGL()

    if (glewInit() != GLEW_OK) exit( EXIT_FAILURE );

    qDebug() << versionString; qDebug() << rendererString;

    ati_meminfo();

    glGenTextures( 1, &texture);

    glBindTexture(GL_TEXTURE_3D, texture);

    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);

    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);

    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);

    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glTexPaframeteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    glTexImage3D( GL_TEXTURE_3D, 0, GL_R8UI, 1024, 1024, 1024, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, data );

    HandleGLError();

    ati_meminfo();

}

void Widget::HandleGLError()

{

    GLenum error;

    int i = 1;

    while ((error = glGetError()) != GL_NO_ERROR)

    {

        qDebug("GL ERROR: %i, %s", i , gluErrorString(error));

        ++i;

    }

}

void Widget::ati_meminfo()

{

    GLint param[4] = {-1, -1, -1, -1};

    if ( GL_ATI_meminfo)

    {

     glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, param);

     qDebug("TEXTURE_FREE_MEMORY_ATI");

     qDebug("  Total memory free in the pool: %i Kbyte", param[0]);

     qDebug("  Largest available free block in the pool: %i Kbyte", param[1]);

     qDebug("  Total auxiliary memory free: %i Kbyte", param[2]);

     qDebug("  Largest auxiliary free block: %i Kbyte", param[3]);

     HandleGLError();

    }   

}


First case, Ubuntu 14.04:

Texture allocation is OK I think, because I can render the texture well. No GL error at all. But memory allocation query show NO memory allocation.

"4.4.13283 Compatibility Profile Context 14.501.1003"

"AMD Radeon(TM) R7 Graphics   "

TEXTURE_FREE_MEMORY_ATI     < before texture generation

  Total memory free in the pool: 1882239 Kbyte

  Largest available free block in the pool: 1700688 Kbyte

  Total auxiliary memory free: 1987760 Kbyte

  Largest auxiliary free block: 11612 Kbyte

TEXTURE_FREE_MEMORY_ATI     < after texture generation

  Total memory free in the pool: 1882239 Kbyte

  Largest available free block in the pool: 1700688 Kbyte

  Total auxiliary memory free: 1987824 Kbyte

  Largest auxiliary free block: 11612 Kbyte

 

Perhaps this method of memory monitoring is incorrect??

 

The 2nd case is Windows7, and this is more interesting, because the same code throw errors, and can not build/render the texture..

"4.4.13283 Compatibility Profile Context 14.501.1003.0"

"AMD Radeon(TM) R7 Graphics"

TEXTURE_FREE_MEMORY_ATI

  Total memory free in the pool: 2084864 Kbyte

  Largest available free block in the pool: 1822720 Kbyte

  Total auxiliary memory free: 2096128 Kbyte

  Largest auxiliary free block: 2096128 Kbyte

GL ERROR: 1, invalid enumerant

GL ERROR: 1, out of memory

TEXTURE_FREE_MEMORY_ATI

  Total memory free in the pool: 2084864 Kbyte

  Largest available free block in the pool: 1822720 Kbyte

  Total auxiliary memory free: 2096128 Kbyte

  Largest auxiliary free block: 2096128 Kbyte

GL ERROR: 1, invalid enumerant

 

1, Looks like TEXTURE_FREE_MEMORY_ATI tag is invalid, but then I get memory info.

2, Even if I have more free memory than in Linux case, I can not allocate the texture..

3, No memory usage as in the Linux case.. Hmm.

 

Any idea what is behind the win7 failure?

Thank you for your help in advance!


Viewing all articles
Browse latest Browse all 631

Trending Articles