...
 
Commits (7)
......@@ -238,6 +238,33 @@ add_vpfpgeneric('vp-sge-alias')
add_vpfpgeneric('vp-two-constants')
shaders['vpfp-generic'] = vpfpgeneric
glslgeneric = Group()
def add_glslgeneric(name):
glslgeneric[name] = PlainExecTest(['shader_runner', testBinDir + '../tests/shaders/generic/' + name + '.shader_test', '-auto'])
add_glslgeneric('glsl-algebraic-add-zero')
add_glslgeneric('glsl-algebraic-div-one')
add_glslgeneric('glsl-algebraic-logicand-false-2')
add_glslgeneric('glsl-algebraic-logicand-false')
add_glslgeneric('glsl-algebraic-logicand-true-2')
add_glslgeneric('glsl-algebraic-logicand-true')
add_glslgeneric('glsl-algebraic-logicor-false-2')
add_glslgeneric('glsl-algebraic-logicor-false')
add_glslgeneric('glsl-algebraic-logicor-true-2')
add_glslgeneric('glsl-algebraic-logicor-true')
add_glslgeneric('glsl-algebraic-logicxor-false')
add_glslgeneric('glsl-algebraic-logicxor-true')
add_glslgeneric('glsl-algebraic-mul-one')
add_glslgeneric('glsl-algebraic-mul-zero')
add_glslgeneric('glsl-algebraic-not-equals')
add_glslgeneric('glsl-algebraic-not-notequals')
add_glslgeneric('glsl-algebraic-pow-two')
add_glslgeneric('glsl-algebraic-rcp-rcp')
add_glslgeneric('glsl-algebraic-rcp-rsq')
add_glslgeneric('glsl-algebraic-rcp-sqrt')
add_glslgeneric('glsl-algebraic-sub-zero-2')
add_glslgeneric('glsl-algebraic-sub-zero')
shaders['glsl-generic'] = glslgeneric
bugs = Group()
add_plain_test(bugs, 'crash-cubemap-order')
add_plain_test(bugs, 'crash-texparameter-before-teximage')
......
......@@ -88,3 +88,4 @@ add_executable (glsl-preprocessor-comments glsl-preprocessor-comments.c)
add_executable (vp-ignore-input vp-ignore-input.c)
add_executable (glsl-empty-vs-no-fs glsl-empty-vs-no-fs.c)
add_executable (glsl-useprogram-displaylist glsl-useprogram-displaylist.c)
add_executable (shader_runner shader_runner.c)
\ No newline at end of file
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color + vec4(0.0);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color / vec4(1.0);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b != 0.0 && false)
gl_FragColor = red;
else
gl_FragColor = green;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (false && color.b != 0.0)
gl_FragColor = red;
else
gl_FragColor = green;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b != 0.0 && true)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (true && color.b != 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b != 0.0 || false)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (false || color.b != 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (true || color.b == 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b == 0.0 || true)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (false ^^ color.b != 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (true ^^ color.b == 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color * 1.0;
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0) - (color * 0.0);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = -(-color);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (!(color.b == 0.0))
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (!(color.b != 0.0))
gl_FragColor = red;
else
gl_FragColor = green;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, pow(color.b, 2), 0.0, 0.0);
}
[test]
uniform color vec4 0.0 0.0 0.5 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 0.25 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 2.0, 0.0, 0.0) / (1.0 / color);
}
[test]
uniform color vec4 0.0 0.5 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 0.5 / inversesqrt(color.g), 0.0, 0.0);
}
[test]
uniform color vec4 0.0 2.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 0.7071 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 1.0 / sqrt(color.g), 0.0, 0.0);
}
[test]
uniform color vec4 0.0 2.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 0.7071 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = 0.0 - color;
}
[test]
uniform color vec4 0.0 -1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color - 0.0;
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
[fragment shader]
uniform vec4 args1, args2;
void main()
{
gl_FragColor = log2(args1) + args2;
}
[test]
clear color 1.0 0.0 0.0 0.0
clear
ortho
uniform args1 vec4 1.0 2.0 4.0 0.0
uniform args2 vec4 0.5 -0.5 -1.5 0.0
draw rect 10 10 10 10
probe rgb 15 15 0.5 0.5 0.5
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
if (gl_Vertex.x < 30.0)
gl_FrontColor = vec4(1.0, 0.0, 0.0, 0.0);
else
gl_FrontColor = vec4(0.0, 1.0, 0.0, 0.0);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
[fragment shader]
void main()
{
gl_FragColor = gl_Color;
}
[test]
ortho
clear color 0.5 0.5 0.5 0.5
clear
draw rect 10 10 10 10
draw rect 30 10 10 10
probe rgb 15 15 1.0 0.0 0.0
probe rgb 35 15 0.0 1.0 0.0
This diff is collapsed.
......@@ -140,6 +140,14 @@ void piglit_require_extension(const char *name)
}
}
void piglit_require_not_extension(const char *name)
{
if (glutExtensionSupported(name)) {
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
/**
* Read a pixel from the given location and compare its RGBA value to the
* given expected values.
......@@ -424,17 +432,11 @@ piglit_compile_shader(GLenum target, char *filename)
return prog;
}
/**
* Convenience function to compile a GLSL shader.
*/
GLuint
piglit_compile_shader_text(GLenum target, const char *text)
static GLuint
compile_shader(GLuint prog, GLenum target)
{
GLuint prog;
GLint ok;
prog = glCreateShader(target);
glShaderSource(prog, 1, (const GLchar **) &text, NULL);
glCompileShader(prog);
glGetShaderiv(prog, GL_COMPILE_STATUS, &ok);
......@@ -465,6 +467,35 @@ piglit_compile_shader_text(GLenum target, const char *text)
return prog;
}
/**
* Convenience function to compile a GLSL shader.
*/
GLuint
piglit_compile_shader_text_with_length(GLenum target, const char *text,
GLint length)
{
GLuint prog;
prog = glCreateShader(target);
glShaderSource(prog, 1, (const GLchar **) &text, &length);
return compile_shader(prog, target);
}
/**
* Convenience function to compile a GLSL shader.
*/
GLuint
piglit_compile_shader_text(GLenum target, const char *text)
{
GLuint prog;
prog = glCreateShader(target);
glShaderSource(prog, 1, (const GLchar **) &text, NULL);
return compile_shader(prog, target);
}
GLint piglit_link_simple_program(GLint vs, GLint fs)
{
GLint prog, ok;
......
......@@ -76,6 +76,7 @@ extern const unsigned int fdo_bitmap_height;
int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
void piglit_require_extension(const char *name);
void piglit_require_not_extension(const char *name);
int piglit_probe_pixel_rgb(int x, int y, const float* expected);
int piglit_probe_pixel_rgba(int x, int y, const float* expected);
int piglit_probe_texel_rgb(int target, int level, int x, int y,
......@@ -90,6 +91,8 @@ void piglit_require_vertex_program(void);
GLuint piglit_compile_program(GLenum target, const char* text);
GLuint piglit_compile_shader(GLenum target, char *filename);
GLuint piglit_compile_shader_text(GLenum target, const char *text);
GLuint piglit_compile_shader_text_with_length(GLenum target, const char *text,
GLint length);
GLint piglit_link_simple_program(GLint vs, GLint fs);
GLvoid piglit_draw_rect(float x, float y, float w, float h);
GLvoid piglit_draw_rect_tex(float x, float y, float w, float h,
......