PDA

View Full Version : Does transform feedback work on Catalyst 11.10?



Aleksandar
11-22-2011, 01:16 PM
Can anyone confirm that transform feedback works on Catalyst 11.10?
I have tried something that works on NV (from 8xxx to 4xx with different drivers), but fails on Win7 64-bit/HD 6850.

Driver returns no error, but values are always 0.

Maybe I missed something, so here it is a sample code:


// TF Shader output setup
if(!pVertSh->Compile()) //...
if(!pFragSh->Compile()) //...
AttachShader(pVertSh);
AttachShader(pFragSh);

static const char * varying_names[] ={ "out_Position" };
glTransformFeedbackVaryings(GetID(), 1, varying_names, GL_INTERLEAVED_ATTRIBS);

if(!Link())//...

// In the application ...
int index = 0;
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, index, m_TFvboID);
glEnable(GL_RASTERIZER_DISCARD);
glBeginTransformFeedback(GL_POINTS);
//---
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);
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);

By the way, besides this problem, I'm pleasantly surprised by new Catalyst drivers. Memory allocation is more flexible than on NV's counterparts, and rendering without attributes works fine.

aqnuep
11-23-2011, 01:42 AM
I'll check it for you this afternoon with one of my demos, but you can check it as well (in case I'll forget about it :) ):
http://rastergrid.com/blog/downloads/nature-demo/
http://rastergrid.com/blog/downloads/mountains-demo/

Aleksandar
11-23-2011, 03:25 AM
Thank you Daniel!

Your demos work, but there are some minor differences that might result in error.

1. You are using sf::ContextSettings to create GL context. I'm using API directly and setting attributs to following values:


WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB | WGL_CONTEXT_DEBUG_BIT_ARB,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,


2. Although VAO is selected it contains no active attributes. I don't need them. Maybe this is the problem. But it works for the rest of my program.

3. You are not using glMapBuffer() to get results from TF to the main memory.

The rest is more or less similar. Except your code works while mine doesn't. The strange thing is that GL doesn't report errors.

aqnuep
11-25-2011, 01:18 AM
I think your problem will be #2, attribute less rendering. This had always issues on ATI drivers.

Hongwei Li
11-29-2011, 02:38 AM
Will you send a compliable copy of your code to Hong-Wei.li<at>amd<dot>com? I'd like to look into this problem.

Hongwei Li
12-02-2011, 02:38 AM
Sorry to admit that the present AMD driver could not do attribute less rendering. The workaround is to have at least one foobar attribute to feed the glDrawArrays.

Aleksandar
12-02-2011, 07:36 AM
Thank you for the response!

I have problem with TF even when an attribute is set.
Can you take a look at the second function - ExecTFA(), please?

On the other hand, I have succeeded to execute my GLProfiler on HD 6850/Catalyst 11.10, which is purely attributeless, without noticeable problems.

Aleksandar
12-16-2011, 06:45 PM
With Catalyst 11.12 attributless rendering works fine; at least my sample code.

But glVertexAttrib works even worse. Instead of zeros, now it breaks after first iteration.

The precision of trigonometric functions on AMD is worse than on NVIDIA's implementation. I really don't understand why GLSL has such a bad trigonometry.

Alfonse Reinheart
12-16-2011, 08:32 PM
What is this problem with `glVertexAttrib`? This is something you've not mentioned thus far (or at least I didn't see it).

Aleksandar
12-17-2011, 02:42 AM
I'm sorry; it was a part of internal conversation with Hong-Wei.
Well, in short, glVertexAttrib cannot be used outside glBegin/glEnd block in pre-Catalyst 11.12 driver versions.

Now it succeeds, but just for the first call. Unfortunatelly, I cannot give more details, since I don't have AMD cards and the previous state is a report from a colleague of mine.

Dan Bartlett
12-17-2011, 06:18 AM
glVertexAttribXX(0, #value#) is the same as a glVertexXX(#value#) in that it issues a vertex so can only be called inside glBegin/glEnd. The others should be okay to call outside glBegin/glEnd though.

arekkusu
12-17-2011, 07:56 AM
That is true for Compatibility Profile.

It's not true for Core Profile, where all of the "Begin/End Paradigm" and "Array Element" language has been replaced with the much simpler "Transferring Array Elements" section.
In Core Profile, specifying vertex attrib zero no longer immediately submits a vertex, it just sets the generic attrib (and you can query the value, unlike Compatibility Profile.)

Aleksandar
12-17-2011, 06:16 PM
glVertexAttribXX(0, #value#) is the same as a glVertexXX(#value#) in that it issues a vertex so can only be called inside glBegin/glEnd.

And how could we call glVertexAttrib between glBegin/glEnd if glBegin/glEnd are not supported in the Core profile?

Hongwei Li
12-20-2011, 07:51 PM
glVertexAttribXX(0, #value#) is the same as a glVertexXX(#value#) in that it issues a vertex so can only be called inside glBegin/glEnd.


glVertexAttrib + glDrawArrays is working on AMD driver. I apologize for my previous mis-information.

Hongwei Li
12-22-2011, 10:40 PM
I later had such an interesting observation about glVertexAttrib with AMD driver. Theoritically, the follow two code snippet should have the same rendering result; a point sprite on the left.

** Code snippet A

GLfloat v[] =
{
-0.5f, 0.0f, 0.0f,
};
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, v);
glDrawArrays(GL_POINTS, 0, 1);

** Code snippet B
glVertexAttrib3f(0, -0.5f, 0.0f, 0.0f);
glDrawArrays(GL_POINTS, 0, 1);

However, code snippet B draws the point sprite at the center of the viewport, which means it has not passed data to shader.

Is it true on your Radeon cards? I am searching for more evidence. Thanks.

Ola Olsson
02-04-2012, 05:21 AM
I'll check it for you this afternoon with one of my demos, but you can check it as well (in case I'll forget about it :) ):
http://rastergrid.com/blog/downloads/nature-demo/
http://rastergrid.com/blog/downloads/mountains-demo/

On this topic, I've got problems with transform feedback on an AMD GPU (see below for vendor, version and renderer). It works as expected on an NVIDIA GPU, but not on AMD. It works when I use just one output from the vertex shader, but if I add more the result is incorrect, even if the additional output is not specified using glTransformFeedbackVaryings.

I looked at your demo source and noticed that you use GL_INTERLEAVED_ATTRIBS. I use GL_SEPARATE_ATTRIBS, so was wondering if anyone out there have successfully used GL_SEPARATE_ATTRIBS on AMD for more than one output, and if there are any gotchas.

ATI Technologies Inc.
3.3.11399 Compatibility Profile Context
ATI Radeon HD 3200 Graphics
AMD Catalyst 12.1

If anyone cares to test this I can cook up a small repro case.

Cheers
.ola

tksuoran
02-21-2012, 04:53 AM
If I change primitive mode in DrawTransformFeedback() to points (when transform feedback is capturing lines), it gives me invalid operation. Is this another bug in AMD*driver?

I think it should work.

I know there is a sentence "The error INVALID_OPERATION is generated by DrawArrays and the other drawing commands de&amp;#64257;ned in section 2.8.3 if mode is not one of the allowed modes in table 2.14" in the specification. But the whole paragraph only talks about transform feedback being active.