[Mesa-dev] SandyBridge not handling GL_TRIANGLE_STRIP_ADJACENCY with repeating vertex indices correctly
Kenneth Graunke
kenneth at whitecape.org
Tue Jul 29 10:16:24 PDT 2014
On Tuesday, July 29, 2014 10:12:23 AM Iago Toral Quiroga wrote:
> Hi,
>
> running the piglit tests on my implementation of geometry shaders for
> Sandy Bridge produces a GPU hang for the following test:
>
> ./glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_STRIP_ADJACENCY
> ffs
>
> That test checks primitive restarts but the hang seems to be unrelated
> to that, since it happens also when primitive restart is not enabled.
> The problem, which only affects GL_TRIANGLE_STRIP_ADJACENCY and no other
> primitive type -with our without adjacency-, is in this loop that the
> test uses to setup the indices for the vertices:
>
> elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_WRITE);
> num_elements = 0;
> for (i = 1; i <= LONGEST_INPUT_SEQUENCE; i++) {
> for (j = 0; j < i; j++) {
> /* Every element that isn't the primitive
> * restart index can just be element 0, since
> * we don't care about the actual vertex data.
> */
> elements[num_elements++] = 0;
> }
> elements[num_elements++] = prim_restart_index;
> }
> glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
>
> Setting all elements to the same index (0 in this case) is the one thing
> that causes the hang for GL_TRIANGLE_STRIP_ADJACENCY. A simple change
> like this removes the hang:
> - elements[num_elements++] = 0;
> + elements[num_elements++] = j != prim_restart_index ? j : j + 1;
>
> Skimming through the docs I have not seen any references to this being a
> known problem. In fact, I don't see any references to
> GL_TRIANGLE_STRIP_ADJACENCY being special in any way and it seems that
> this is not a problem in IvyBridge, since the test runs correctly there.
>
> Does this sound like a hardware bug specific to SandyBridge's handling
> of GL_TRIANGLE_STRIP_ADJACENCY or is there something else I should check
> before arriving to that conclusion?
Odd. It could very well be, but I don't see anything in the documentation, either. Could you post a branch with your preliminary code? I'd be happy to look into the hang and see if I come up with any more useful information...
> If it is a hardware bug I guess we want a workaround for it , at least
> to prevent the hang or something but I am not sure what would be the
> best option here, I think the only option for the driver would be to
> explore the list of indices provided when this primitive type is used
> and when we hit this scenario (I'd have to test how many repeating
> indices we need for it to hang), error out and do not execute the
> drawing command or something... any other suggestions?
>
> Iago
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140729/a499bcdc/attachment.sig>
More information about the mesa-dev
mailing list