Problem with NV 3xx.xx drivers and TF

Hi All,

I have an interesting anomaly on NV 3xx.xx drivers. Namely, transform feedback that works correctly on NV 2xx.xx drivers breaks application on Win7 with newest drivers (currently 314.07).
Probably there is an error somewhere in my code, but I cannot realize what could cause the problem.
Here’s the code:


void GLRenderer::DebugTF(int bufSize, int i, bool bFullBuf)
{
    unsigned int size = 4 * sizeof(float) * bufSize;
    unsigned int m_TFvboID;
    glGenBuffers(1, &m_TFvboID);
    glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, m_TFvboID);
    glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, size, NULL, GL_DYNAMIC_COPY);
    int index = 0;
    glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, index, m_TFvboID);
    glEnable(GL_RASTERIZER_DISCARD);
    glBeginTransformFeedback(GL_POINTS);

    int first = 0, count = bufSize;
    glDrawArrays(GL_POINTS, first, count); 
 
    glEndTransformFeedback();
    glDisable(GL_RASTERIZER_DISCARD);
    glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, m_TFvboID);

     float* ptr = (float*)glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, GL_READ_ONLY); //<- malicious line
...

glMapBuffer() call cause the problem. Obviously the problem is in the invalid pointers, since the code reports meaningless errors like “fragment shader loading error”, and that’s my message in the code executed far before DebugTF().

Any idea what might be the cause of the problem? Again, it works on another computer with NV 27x.xx driver. :frowning:

I wonder if it might be the whole arrayed vs. non-arrayed bind point thing I recently brought up in another thread.

Try doing an end-run around the whole bind point issue and use DSA:


void *ptr = glMapNamedBufferRangeEXT( handle, offset, size, access );
...
glUnmapNamedBufferEXT( handle );

I would try sending some dummy data to glBufferData instead of passing NULL. NVIDIA has similar problem with textures and ARB_shader_image_load_store. When I initialy pass NULL to glTexImage2D texture does not work correctly as an image. But when I send dummy data to glTexImage2D (instead of just passing NULL) everything works correctly.

In your case I would try this:


std::vector<GLubyte> data(size);
glGenBuffers(1, &m_TFvboID);
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, m_TFvboID);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, size, &data[0], GL_DYNAMIC_COPY);

Thank you for the suggestions guys, but the problem was in totally different place.
I have completely forgotten on that. When debug_output catches some error I’m opening AfxMessageBox().
Well… that makes a problem with new NV drivers. I had a confirmation form NV guys a long time ago, but I have forgotten.

The message is:

Buffer performance warning: Buffer object 16 (bound to GL_TRANSFORM_FEEDBACK_BUFFER_NV (0), and GL_TRANSFORM_FEEDBACK_BUFFER_NV, usage hint is GL_DYNAMIC_COPY) is being copied/moved from VIDEO memory to DMA CACHED memory.

After all, this can be a warning for the community not to use AfxMessageBox(). :slight_smile:

Sorry for bothering you, and thank you for the help!

When debug_output catches some error I’m opening AfxMessageBox().

Is this a problem with ::MessageBoxA as well?

I just started seeing

Buffer performance warning: …

message about video buffer being copied to main memory.

Yes, ::MessageBoxA() makes the same problem. The problem lies in the way MessageBox is implemented in combination with debug_output. MessageBox send WM_PAINT, an the previous call has already been interrupted by debug_output. Probably it makes cumulative effect that driver cannot solve and pointers start to be invalid. Whatever, don’t display debug_output messages in a message box and everything will be just fine. :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.