1. 01 Dec, 2014 3 commits
  2. 24 Nov, 2014 5 commits
  3. 30 Jul, 2014 1 commit
    • Dave Airlie's avatar
      arb_gpu_shader_fp64: add initial generated tests (v5) · 76cf55c3
      Dave Airlie authored
      
      
      This creates a bunch of built-in tests for GLSL 4.00,
      corresponding to the builtin uniform and constant array size tests.
      
      I copied the test generators into new files, as I wasn't really sure how
      to separate the float and double generation, maybe some sort of force double
      mode to generate the correct code, would need advice of original author.
      
      v2: fix dmat issue
      
      v3: emit glsl-4.00 and ARB_gpu_shader_fp64 tests,
          use a double precision value
          fix double precision emitting bugs
          fix generated constant test to work.
      
      v4: fix emitting extensions names so piglit can skip instead of fail
      
      v5: generate tests into a lowercase subdir.
      Acked-by: Ilia Mirkin's avatarIlia Mirkin <imirkin@alum.mit.edu>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      76cf55c3
  4. 19 May, 2014 1 commit
  5. 14 May, 2014 3 commits
  6. 01 Oct, 2013 1 commit
    • Ian Romanick's avatar
      glsl-1.30: Test interpolation qualifiers on built-in variables · d427fcfc
      Ian Romanick authored
      
      
      Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
      
          "If gl_Color is redeclared with an interpolation qualifier, then
          gl_FrontColor and gl_BackColor (if they are written to) must also be
          redeclared with the same interpolation qualifier, and vice versa. If
          gl_SecondaryColor is redeclared with an interpolation qualifier,
          then gl_FrontSecondaryColor and gl_BackSecondaryColor (if they are
          written to) must also be redeclared with the same interpolation
          qualifier, and vice versa. This qualifier matching on predeclared
          variables is only required for variables that are statically used
          within the shaders in a program."
      
      This adds five sets of tests from a single generator script:
      
          - Set an interpolation qualifier, possibly the default, for one of
            gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or
            gl_BackSecondaryColor in the vertex shader, and set a different
            interpolation qualifier, possibly the default, for the matching
            gl_Color or gl_SecondaryColor in the fragment shader.  This should
            fail to link.
      
          - Set a non-default interpolation qualifier for one of
            gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or
            gl_BackSecondaryColor in the vertex shader, and have no
            redeclaration in the fragment shader.  In the fragment shader,
            neither gl_Color nor gl_SecondaryColor is used.  This should
            successfully link.
      
          - Set a non-default interpolation qualifier for one of gl_Color or
            gl_SecondaryColor in the fragment shader, and have no
            redeclaration in the vertex shader.  In the vertex shader, none of
            the built-in color variables are used.  This should successfully
            link.
      
          - Set an interpolation qualifier, possibly the default, for one of
            gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or
            gl_BackSecondaryColor in the vertex shader, and set a different
            interpolation qualifier, possibly the default, for the matching
            gl_Color or gl_SecondaryColor in the fragment shader.  Neither
            stage uses any of the color variables.  This should successfully
            to link.
      
          - Set conflicting interpolation qualifiers for gl_FrontColor /
            gl_BackColor or gl_FrontSecondaryColor / gl_BackSecondaryColor in
            the vertex shader, and set a matching interpolation qualifier on
            gl_Color or gl_SecondaryColor in the fragment shader for one of
            the vertex shader built-in varaibles.  This should fail to link.
      
      On Mesa, all of the tests that expect linking failures fail.  Basically,
      Mesa's linker accepts everything.
      
      NVIDIA (304.64 on GTX 260) fails the same set of tests.
      
      v2: Use Python lists instead of "set literal" syntax (Python 2.7+ only).
      Change the names of several maps to include the suffix _map.  Rename
      some additional varibles that had a misleading "front" or "back" in the
      name.  All changes suggested by Paul.
      Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47755
      
      Reviewed-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
      d427fcfc
  7. 28 Sep, 2013 2 commits
  8. 16 Aug, 2013 1 commit
    • Matt Turner's avatar
      arb_shader_bit_encoding: Add test generator. · f7eabdf8
      Matt Turner authored
      Generates fragment and vertex shader execution tests for the built-in
      functions floatBitsToInt(), floatBitsToUint(), intBitsToFloat(), and
      uintBitsToFloat().
      
      Functions are tested under
      	GLSL 1.30 + ARB_shader_bit_encoding (uses uint, must be 1.30)
      	GLSL 1.50 + ARB_gpu_shader5 (requires 1.50)
      	GLSL 4.00
      
      Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
      
      v2: Do not test subnormal values, since some hardware flushes them to
          zero. Fix value of smallest normalized value.
      f7eabdf8
  9. 10 Aug, 2013 1 commit
  10. 29 Mar, 2013 1 commit
  11. 12 Mar, 2013 1 commit
  12. 24 Jan, 2013 1 commit
  13. 12 Jun, 2012 4 commits
  14. 13 Jan, 2012 1 commit
    • Ian Romanick's avatar
      glsl-1.10: Verify pre- and post-inc/dec cannot be l-values · 02550817
      Ian Romanick authored
      
      
      These generators create two kinds of tests.  The first verifies that
      pre- and post-increment/decrement operations cannot be assignment
      targets.  These look like:
      
      uniform float u;
      varying vec4 v;
      
      void main()
      {
          float t = u;
      
          ++t = float(v.x);
          gl_FragColor = vec4(t, v.yzw);
      }
      
      The second kind of test verifies that pre- and
      post-increment/decrement operations cannot be used for function 'out'
      parameters.  These look like:
      
      uniform ivec4 u;
      attribute vec4 v;
      
      void f(out ivec4 p)
      {
          p = ivec4(v);
      }
      
      void main()
      {
          ivec4 t = u;
      
          f(t--);
          gl_Position = vec4(t);
      }
      
      Function 'inout' parameters are not explicitly tested.
      
      A test is generated for both vertex and fragment targets for each
      int and float vector or scalar datatype.  Matrix types and GLSL 1.30
      unsigned types are not tested.
      Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
      Reviewed-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
      02550817
  15. 27 Oct, 2011 1 commit
    • 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
  16. 11 Aug, 2011 2 commits
    • Paul Berry's avatar
      Add constant array size builtin tests. · 8a3e129c
      Paul Berry authored
      This patch adds a new set of generated tests which parallels those
      introduced by commt cccc419e (Add comprehensive tests of builtin
      functions with uniform input.)
      
      The new tests validate the correctness of built-in functions when used
      to compute array sizes.  The tests work by creating arrays whose size
      is 1 if the result of applying the built-in function is within
      tolerance of the correct answer, and -1 if not.  Since negative array
      sizes are prohibited, any improperly computed values will generate a
      compile error.
      
      Though it may seem absurd to compute an array size based on the result
      of calling a built-in function, it's worth testing for two reasons:
      
      (1) It is explicitly allowed in GLSL versions since 1.20.
      
      (2) Since array sizes need to be computed at compile time, this is a
      convenient way of testing that the GLSL compiler properly implements
      constant folding of built-in functions.  Indeed, the original
      motivation for these tests was to validate bug fixes to Mesa's
      constant folding logic.
      
      Here is an example of one of the generated tests (this test is
      exp2-vec2.vert):
      
      /* [config]
       * expect_result: pass
       * glsl_version: 1.20
       * [end config]
       *
       * Check that the following test vectors are constant folded correctly:
       * exp2(vec2(-2.0, -0.66666669)) => vec2(0.25, 0.62996054)
       * exp2(vec2(0.66666669, 2.0)) => vec2(1.587401, 4.0)
       */
      
      void main()
      {
        float[distance(exp2(vec2(-2.0, -0.66666669)), vec2(0.25, 0.62996054)) <= 6.7775386e-06 ? 1 : -1] array0;
        float[distance(exp2(vec2(0.66666669, 2.0)), vec2(1.587401, 4.0)) <= 4.3034684e-05 ? 1 : -1] array1;
        gl_Position = vec4(array0.length() + array1.length());
      }
      8a3e129c
    • Paul Berry's avatar
      Refactor cmake script to generate tests for later reuse. · 3599bede
      Paul Berry authored
      This patch creates a function, piglit_make_generated_tests (in
      generated_tests/CMakeLists.txt), to encapsulate the logic that builds
      a custom command.  The new function can be reused to generate tests
      using other python scripts.
      3599bede
  17. 10 Aug, 2011 1 commit
    • Paul Berry's avatar
      Fix autogeneration of builtin uniform tests on Windows. · 1e773649
      Paul Berry authored
      This patch modifies the invocation of CMake's add_custom_command()
      function so that instead of specifying all 462 output files
      explicitly, it instead specifies a single file,
      builtin_uniform_tests.list, which receives a list of all the files
      generated.
      
      It is safe not to specify the individual output files since there are
      no other build steps that depend on them, so there is no danger of the
      build step happening at the wrong time.
      
      This prevents CMake from trying to output an outrageously long
      diagnostic message listing all the files generated by the custom
      command, a message that was too long to work with the NMake back-end
      used on Windows.
      
      Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=39873
      1e773649
  18. 09 Aug, 2011 1 commit
    • Paul Berry's avatar
      Fix test generation on Arch Linux. · 7a8d9b00
      Paul Berry authored
      
      
      On Arch Linux, "python" means Python 3.x, and Python 2.x is called
      "python2".  The test generation code requires Python 2.x.  In many
      other distributions, "python" refers to Python 2.x.
      
      This patch adds logic to the toplevel CMakeLists that checks both
      "python2" and "python" to see which one is Python 2.x, and once it is
      found, sets the cmake variable ${python} to point to it.
      Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
      7a8d9b00
  19. 06 Aug, 2011 1 commit
  20. 05 Aug, 2011 1 commit
    • Paul Berry's avatar
      Add comprehensive tests of builtin functions with uniform input. · cccc419e
      Paul Berry authored
      This patch adds 462 tests to piglit, which comprehensively test the
      behavior of GLSL built-in functions on vertex and fragment shaders.
      The test vectors are auto-generated in Python, by using the numpy
      library to simulate the behavior of the built-in functions on a
      variety of inputs (in builtin_function.py), and then producing
      shader_runner tests to verify the expected behavior (in
      gen_builtin_uniform_tests.py).
      
      Test generation happens as part of the piglit build process.  To run
      the test generation step by itself, use "make gen-tests" from the root
      of the piglit tree (after configuring using cmake).  The generated
      tests may be found in generated_tests/spec.
      
      The auto-generation code depends on Python 2.6 and on the numpy
      library (www.numpy.org).  I've updated the README to reflect these
      dependencies, and added code to CMakeLists.txt to check for them at
      configure time.  (Note: other parts of Piglit already depend on Python
      2.6, but the dependency wasn't previously explicit).
      cccc419e