shader_runner: Add basic SSO support to shader runner

Graphics / Mesa 3D Graphics Library / Piglit - Timothy Arceri [collabora.com] - 9 December 2015 18:07 UTC

This sets up the basics for using SSO with shader runner. This will only support vertex and fragment shaders but is easily extended.

V2: delete pipeline in cleanup code rather than calling gen again, output error message when SSO fails to link

V3: add new option to [require] to allow separate shader objects to be enabled for the entire test.

V4:- remove infrastructure left over from V2 (as suggested by Ken)- rework linking so that we dont use glCreateShaderProgram() this allows us to support multiple shaders per stage.

Example use: [require] SSO ENABLED

Adding the ENABLED field rather than just using SSO will allow us to use DISABLED in future should we ever add the ability to automatically run all tests as SSO.

Example shader:

[require] GLSL >= 1.50 SSO ENABLED

[vertex shader]

layout(location = 0) in vec4 piglit_vertex;

layout(location = 2) out vec3 a; layout(location = 3) out vec3 b;

void main() { gl_Position = piglit_vertex; a = vec3(0, 0, 1); b = vec3(1, 0, 0); }

[fragment shader]

layout(location = 0) out vec4 out_color;

layout(location = 2) in vec3 b; /* should get vec3(0, 0, 1) */ layout(location = 3) in vec3 a; /* should get vec3(1, 0, 0) */

void main() { out_color = vec4(cross(b, a), 1); }

[test] draw rect -1 -1 2 2 probe all rgb 0 1 0

0a63c5a shader_runner: Add basic SSO support to shader runner
tests/shaders/shader_runner.c | 158 +++++++++++++++++++++++++++++------------
1 file changed, 111 insertions(+), 47 deletions(-)

Upstream: cgit.freedesktop.org


  • Share