[Piglit] RFC: New test runner for GLSL linker tests

Chad Versace chad at chad-versace.us
Fri Mar 4 16:09:39 PST 2011


I propose that Piglit have a new test runner for testing the GLSL
linker. Syntax for linker tests will resemble that of shader_runner.


Rationale
---------

In implementing GLSL 1.30, many many many new linker tests need to be
written. Currently, the only method by which to write a linker test is
to write it in C, with a large dose of boilerplate. Writing a simple
linker test should not be that laborious.

If tests are quick and easy to write, people will write them. If a test
is painful to write, it will likely not be written.


Example
--------

Below is an example of a non-trivial linker test in the proposed syntax.
Observe the assertion on the last line.

---------------------------------------
file: active-uniforms.hunny_linker_test
---------------------------------------
[description]
Check that GL_ACTIVE_UNIFORMS counts
gl_ModelViewProjectionMatrixTranspose as
a uniform. See section 7.5 of the GLSL 1.20 spec.

Bug: https://bugs.freedesktop.org//show_bug.cgi?id=32403

[config]
    # Indentation is not required; it just makes the eyes happy.
    require GL >= 2.1
    require GLSL >= 1.20

[vertex_shader]
    #version 120
    uniform vec4 color;
    void main() {
       gl_Position = gl_ModelViewProjectionMatrixTranspose * gl_Vertex;
       gl_FrontColor = color;
    }

[fragment_shader_files]
    glsl-color.frag

[linker_test]
    link_program
    assert GL_LINK_STATUS == GL_TRUE
    assert GL_ACTIVE_UNIFORMS == 2

---------------------------------------
EOF
---------------------------------------



Request for Comment
-------------------
Dear fellow Piglit contributors, I wish to know:
1. Do you have any (useful) critiques or suggestions on the syntax?
2. Do you have any strong opinions on the linker test syntax?
3. Are they additional features you would like to have in a linker test?
   (idr has already mentioned desire for the ability to iterate over
    multiple versions of GLSL in a single test file. I think such an
    iteration statement could go in the [config] section.)
4. Do you have any (useful) critiques or suggestions for the test
   runner's source code?



Try it
----------

The new linker test has been pushed to the Piglit branch 'hunny':
    git clone --branch hunny git://anongit.freedesktop.org/piglit.git

Source code, documentation, and new tests are located in:
    /src/piglit/hunny
    /documentation/hunny
    /tests/spec/glsl-1.30/linker

You can execute some linker tests with:
    env INTEL_GLSL_VERSION=130 ./piglit-run.py -t glsl-1.30/linker
	
The actual executables are hunny_gl and hunny_gles2.

-- 
Chad Versace
chad at chad-versace.us


More information about the Piglit mailing list