Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: ATI - GL_CLIP_DISTANCE0 - Bug

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    11

    ATI - GL_CLIP_DISTANCE0 - Bug

    For reference to anyone else with the same problem:

    The following works on NVIDIA but not on "ATI Radeon HD 4800 Series"

    In the application:
    Code :
    	glDisable(GL_CLIP_DISTANCE0);
    	glDisable(GL_CLIP_DISTANCE1);
    	<-- Note Disable clip!

    In the GLSL vertex shader:
    Code :
    	gl_ClipDistance[0] = -1000;"
    	gl_ClipDistance[1] = -1000;"

    The gl_ClipDistance is used, although disabled in the application via glDisable(GL_CLIP_DISTANCEi)

  2. #2
    Intern Newbie
    Join Date
    Sep 2011
    Posts
    32

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    So how about when clipping is enabled in the CPU code?
    Senior Engineer, OpenGL driver, AMD

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    1

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    In the code posted by rombust the gl_ClipDistance variables are set to some value that will effectively discard the primitive.

    When GL_CLIP_DISTANCE0 or GL_CLIP_DISTANCE1 is enabled then both NVIDIA and AMD correctly renders nothing.

    If you disable the clip distances using glDisable, the AMD driver still renders nothing while the NVIDIA driver renders the primitive.

  4. #4
    Intern Newbie
    Join Date
    Sep 2011
    Posts
    32

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    Hmm, it is a rare case, but in my opinion, I think that GL state change at CPU side should have higher priority over shader code. I will talk to AMD shader team about this problem.
    Senior Engineer, OpenGL driver, AMD

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Apr 2009
    Posts
    530

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    just my 2 cents..

    I can imagine such a system where clip planes can be enabled and disabled by a user to look at different cut-aways of a model. The clipping planes might be displayed and moveable by an app and toggled on and off applied to a model.

    The current ATI behavior leaves the planes always applied. From the specification:

    Quote Originally Posted by GLSL 4.2 Specification, Section 7.1, page 100, 2nd paragraph, last sentence
    Values written into gl_ClipDistance for planes that are not enabled have no effect.


  6. #6
    Junior Member Newbie
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    16

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    I just programmed an example, which is setting gl_ClipDistance[0] in the vertex shader and disabling it with glDisable(GL_CLIP_DISTANCE0) in the main code. With the AMD Catalyst 12.1, the clip distance is still used. So I can confirm that this is a bug.

  7. #7
    Member Regular Contributor
    Join Date
    Apr 2009
    Posts
    258

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    I love redundant state in GL. It's just sooooo good.

  8. #8
    Junior Member Regular Contributor
    Join Date
    Apr 2004
    Posts
    205

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    I dislike redundant things too but the GL_CLIP_DISTANCE states are not one of them. They let you use the same shader with or without clipping.

    Also all shader outputs have undefined values if they are used afterwards but the shader does not write them.
    It wouldn't be very elegant if clip distances are exception from this and writing/not writing in them implicitly enables/disables clipping.

  9. #9
    Member Regular Contributor
    Join Date
    Apr 2009
    Posts
    258

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    Lets face it. GL stopped being elegant some time ago, and there is no coming back.

    This would simplify stuff to 'statically used - feature enabled', and be user business to fill the variable appropriately.

    Perf. impact would probably be negligible, as DX10 does it that way (if im not mistaken, don't know DX10 all that well).

  10. #10
    Junior Member Regular Contributor
    Join Date
    Apr 2004
    Posts
    205

    Re: ATI - GL_CLIP_DISTANCE0 - Bug

    While i am not against the idea to be able to switch clipping on/off from within the shader alone, i'm certainly against doing it in this particular way.
    Instead it could be some pragma or such.
    Output variable that is not being written to should remain with undefined value.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •