1. 27 Oct, 2011 6 commits
    • Paul Berry's avatar
      Add tests of interpolation qualifier behavior. · f36a14a2
      Paul Berry authored
      
      
      This patch adds 160 generated tests to verify correct behavior of the
      GLSL 1.30 interpolation qualifiers under all combinations of the
      following circumstances:
      
      - When the interpolation qualifier is 'flat', 'noperspective',
        'smooth', or not specified.
      
      - When the variable in question is 'gl_FrontColor', 'gl_BackColor',
        'gl_FrontSecondaryColor', 'gl_BackSecondaryColor', or a non-built-in
        vertex shader output.
      
      - When the GL shade model (set with the glShadeModel command) is
        'GL_SMOOTH' or 'GL_FLAT'.
      
      - When the triangle is clipped using gl_ClipDistance, using
        gl_ClipVertex, using fixed clip planes, or not clipped at all.
      
      Note: in a perfect world, we wouldn't need to test all 160
      combinations of these possibilities (e.g. the GL shade model should
      only have an effect when no interpolation qualifier is specified, and
      clipping should have no effect whatsoever on interpolation).  However,
      based on what I know about how interpolation currently works in Mesa's
      i965 driver, it seems prudent to err on the side of caution and test
      all 160 possible combinations.
      
      The tests all operate by painting a triangle on the screen using a
      frustum projection, where the three vertices are colored red, green,
      and blue, and each vertex has a different Z coordinate (so that we can
      test proper perspective interpolation).  Then they use "relative probe
      rgba" on various points in the interior of the triangle to verify that
      the colors have been interpolated correctly.
      
      I've validated the tests using nVidia's proprietary Linux driver, and
      they all pass except for the tests that attempt to override the
      default interpolation behavior of one of the built-in gl_Color
      variables.  In those cases, the nVidia driver favors the interpolation
      mode that is set in GL state.  GLSL 1.30 section 4.3.7
      ("Interpolation") explicitly states that the interpolation behavior of
      these variables may be overridden, and that "When an interpolation
      qualifier is used, it overrides settings established through the
      OpenGL API."  So this seems pretty clearly to be due to a bug in the
      nVidia driver.
      
      As an aid in review, here is an example of one of the tests created by
      the test generator script.  This one is called
      "interpolation-noperspective-gl_FrontColor-flat-fixed.shader_test":
      
      [require]
      GLSL >= 1.30
      
      [vertex shader]
      in vec4 vertex;
      in vec4 input_data;
      noperspective out vec4 gl_FrontColor;
      void main()
      {
        gl_Position = gl_ModelViewProjectionMatrix * vertex;
        gl_FrontColor = input_data;
      }
      
      [fragment shader]
      noperspective in vec4 gl_Color;
      void main()
      {
        gl_FragColor = gl_Color;
      }
      
      [vertex data]
      vertex/float/3  input_data/float/4
       0.0  2.0 -2.0  0.0 1.0 0.0 1.0
      -1.0 -1.0 -1.0  1.0 0.0 0.0 1.0
       3.0 -3.0 -3.0  0.0 0.0 1.0 1.0
      
      [test]
      frustum -1.75 1.75 -1.75 1.75 1.75 3.0
      clear color 0.0 0.0 0.0 0.0
      clear
      enable GL_VERTEX_PROGRAM_TWO_SIDE
      shade model flat
      draw arrays GL_TRIANGLES 0 3
      relative probe rgba (0.444444444444, 0.222222222222) (0.0, 0.0, 0.0, 0.0)
      relative probe rgba (0.636363636364, 0.181818181818) (0.272727272727, 0.181818181818, 0.545454545455, 1.0)
      relative probe rgba (0.769230769231, 0.153846153846) (0.153846153846, 0.153846153846, 0.692307692308, 1.0)
      relative probe rgba (0.866666666667, 0.133333333333) (0.0666666666667, 0.133333333333, 0.8, 1.0)
      relative probe rgba (0.5, 0.4) (0.0, 0.0, 0.0, 0.0)
      relative probe rgba (0.666666666667, 0.333333333333) (0.166666666667, 0.333333333333, 0.5, 1.0)
      relative probe rgba (0.785714285714, 0.285714285714) (0.0714285714286, 0.285714285714, 0.642857142857, 1.0)
      relative probe rgba (0.545454545455, 0.545454545455) (0.181818181818, 0.545454545455, 0.272727272727, 1.0)
      relative probe rgba (0.692307692308, 0.461538461538) (0.0769230769231, 0.461538461538, 0.461538461538, 1.0)
      relative probe rgba (0.583333333333, 0.666666666667) (0.0833333333333, 0.666666666667, 0.25, 1.0)
      Reviewed-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
      f36a14a2
    • Paul Berry's avatar
      Add a "shade model" command to shader_runner. · 20d6a447
      Paul Berry authored
      
      
      This command is a thin wrapper around glShadeModel().  So for
      instance, the command "shade model flat" is equivalent to
      "glShadeModel(GL_FLAT)".
      Reviewed-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
      20d6a447
    • Paul Berry's avatar
      Add a "frustum" command to shader_runner. · 18c673cb
      Paul Berry authored
      
      Reviewed-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
      18c673cb
    • Paul Berry's avatar
      f1769a4e
    • Paul Berry's avatar
      Add vbo support to shader_runner. · f9d224d0
      Paul Berry authored
      This patch adds the ability for shader_runner tests to include a
      "[vertex data]" section containing data in columnar format, for example:
      
      [vertex data]
      vertex/float/3 foo/uint/1 bar/int/2
      0.0 0.0 0.0    0xe0000000 0 0
      0.0 1.0 0.0    0x70000000 1 1
      1.0 1.0 0.0    0x00000000 0 1
      
      Each column header is of the form ATTRNAME/TYPE/COUNT, where ATTRNAME
      is the name of the vertex attribute to be bound to this column, TYPE
      is the type of data that follows ("float", "int", or "uint"), and
      COUNT is the vector length of the data (e.g. "3" for vec3 data).
      
      To send vertex data to the shader, use the new shader_runner command
      "draw arrays".  The parameters are the same as for the glDrawArrays()
      command, so for example to draw triangle primitives using 3 elements
      from the vertex data array starting at element 0, use the command:
      
      draw arrays GL_TRIANGLES 0 3
      
      More detailed examples can be found in the tests/shaders/vbo
      directory.
      
      The implementation is largely in a new file, piglit-vbo....
      f9d224d0
    • Paul Berry's avatar
      Make all.tests add tests/shaders recursively. · 96b69297
      Paul Berry authored
      
      Reviewed-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
      96b69297
  2. 26 Oct, 2011 8 commits
  3. 25 Oct, 2011 1 commit
  4. 24 Oct, 2011 5 commits
  5. 23 Oct, 2011 1 commit
  6. 19 Oct, 2011 4 commits
  7. 18 Oct, 2011 15 commits