Reviewed-by: Chris Forbes <chr...@ijw.co.nz>
On Thu, Aug 14, 2014 at 5:56 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote: > Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu> > --- > tests/all.py | 9 +++++++ > .../arb_derivative_control/compiler/define.frag | 29 > ++++++++++++++++++++++ > .../execution/dfdx-coarse.shader_test | 22 ++++++++++++++++ > .../execution/dfdx-dfdy.shader_test | 22 ++++++++++++++++ > .../execution/dfdx-fine.shader_test | 26 +++++++++++++++++++ > .../execution/dfdy-coarse.shader_test | 22 ++++++++++++++++ > .../execution/dfdy-fine.shader_test | 26 +++++++++++++++++++ > 7 files changed, 156 insertions(+) > create mode 100644 tests/spec/arb_derivative_control/compiler/define.frag > create mode 100644 > tests/spec/arb_derivative_control/execution/dfdx-coarse.shader_test > create mode 100644 > tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test > create mode 100644 > tests/spec/arb_derivative_control/execution/dfdx-fine.shader_test > create mode 100644 > tests/spec/arb_derivative_control/execution/dfdy-coarse.shader_test > create mode 100644 > tests/spec/arb_derivative_control/execution/dfdy-fine.shader_test > > diff --git a/tests/all.py b/tests/all.py > index 4541654..0f69a66 100644 > --- a/tests/all.py > +++ b/tests/all.py > @@ -4098,6 +4098,15 @@ arb_shader_atomic_counters['semantics'] = > concurrent_test('arb_shader_atomic_cou > arb_shader_atomic_counters['unique-id'] = > concurrent_test('arb_shader_atomic_counters-unique-id') > arb_shader_atomic_counters['unused-result'] = > concurrent_test('arb_shader_atomic_counters-unused-result') > > +arb_derivative_control = {} > +spec['ARB_derivative_control'] = arb_derivative_control > +add_shader_test_dir(arb_derivative_control, > + os.path.join(testsDir, 'spec', 'arb_derivative_control'), > + recursive=True) > +import_glsl_parser_tests(arb_derivative_control, > + testsDir + '/spec/arb_derivative_control', ['']) > + > + > profile.tests['hiz'] = hiz > profile.tests['fast_color_clear'] = fast_color_clear > profile.tests['glean'] = glean > diff --git a/tests/spec/arb_derivative_control/compiler/define.frag > b/tests/spec/arb_derivative_control/compiler/define.frag > new file mode 100644 > index 0000000..4e31dd7 > --- /dev/null > +++ b/tests/spec/arb_derivative_control/compiler/define.frag > @@ -0,0 +1,29 @@ > +// [config] > +// expect_result: pass > +// glsl_version: 1.50 > +// require_extensions: GL_ARB_derivative_control > +// [end config] > + > +#version 150 > +#extension GL_ARB_derivative_control: require > + > +#if !defined GL_ARB_derivative_control > +# error GL_ARB_derivative_control is not defined > +#elif GL_ARB_derivative_control != 1 > +# error GL_ARB_derivative_control is not equal to 1 > +#endif > + > +/* Make sure that the functions are defined */ > +in vec4 val; > +out vec4 color; > +void main() { > + color = dFdx(val); > + color += dFdy(val); > + color += fwidth(val); > + color += dFdxCoarse(val); > + color += dFdyCoarse(val); > + color += fwidthCoarse(val); > + color += dFdxFine(val); > + color += dFdyFine(val); > + color += fwidthFine(val); > +} > diff --git > a/tests/spec/arb_derivative_control/execution/dfdx-coarse.shader_test > b/tests/spec/arb_derivative_control/execution/dfdx-coarse.shader_test > new file mode 100644 > index 0000000..b3205c2 > --- /dev/null > +++ b/tests/spec/arb_derivative_control/execution/dfdx-coarse.shader_test > @@ -0,0 +1,22 @@ > +[require] > +GLSL >= 1.50 > +GL_ARB_derivative_control > + > +[vertex shader passthrough] > + > +[fragment shader] > +#extension GL_ARB_derivative_control: require > + > +void main() > +{ > + float xy = gl_FragCoord.x * gl_FragCoord.y; > + float dx = dFdxCoarse(xy); > + if (distance(dx, gl_FragCoord.y) <= 1) > + gl_FragColor = vec4(0, 1, 0, 1); > + else > + gl_FragColor = vec4(1, 0, 0, 1); > +} > + > +[test] > +draw rect -1 -1 2 2 > +probe all rgba 0.0 1.0 0.0 1.0 > diff --git > a/tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test > b/tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test > new file mode 100644 > index 0000000..6f36dc0 > --- /dev/null > +++ b/tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test > @@ -0,0 +1,22 @@ > +[require] > +GLSL >= 1.50 > +GL_ARB_derivative_control > + > +[vertex shader passthrough] > + > +[fragment shader] > +#extension GL_ARB_derivative_control: require > + > +void main() > +{ > + float xy = gl_FragCoord.x * gl_FragCoord.y; > + float dxdy = dFdxFine(dFdyFine(xy)); > + if (dxdy == 1) > + gl_FragColor = vec4(0, 1, 0, 1); > + else > + gl_FragColor = vec4(1, 0, 0, 1); > +} > + > +[test] > +draw rect -1 -1 2 2 > +probe all rgba 0.0 1.0 0.0 1.0 > diff --git > a/tests/spec/arb_derivative_control/execution/dfdx-fine.shader_test > b/tests/spec/arb_derivative_control/execution/dfdx-fine.shader_test > new file mode 100644 > index 0000000..e0dbd9f > --- /dev/null > +++ b/tests/spec/arb_derivative_control/execution/dfdx-fine.shader_test > @@ -0,0 +1,26 @@ > +[require] > +GLSL >= 1.50 > +GL_ARB_derivative_control > + > +[vertex shader passthrough] > + > +[fragment shader] > +#extension GL_ARB_derivative_control: require > + > +void main() > +{ > + float x = gl_FragCoord.x; > + bool alt = bool(int(gl_FragCoord.y) % 2); > + float altx = alt ? -x : x; > + float dx = dFdxFine(altx); > + // Alternating rows are now descending, so check the direction > + // of the derivative based on the row we're in. > + if (alt && dx >= 0 || !alt && dx <= 0) > + gl_FragColor = vec4(1, 0, 0, 1); > + else > + gl_FragColor = vec4(0, 1, 0, 1); > +} > + > +[test] > +draw rect -1 -1 2 2 > +probe all rgba 0.0 1.0 0.0 1.0 > diff --git > a/tests/spec/arb_derivative_control/execution/dfdy-coarse.shader_test > b/tests/spec/arb_derivative_control/execution/dfdy-coarse.shader_test > new file mode 100644 > index 0000000..f3a366d > --- /dev/null > +++ b/tests/spec/arb_derivative_control/execution/dfdy-coarse.shader_test > @@ -0,0 +1,22 @@ > +[require] > +GLSL >= 1.50 > +GL_ARB_derivative_control > + > +[vertex shader passthrough] > + > +[fragment shader] > +#extension GL_ARB_derivative_control: require > + > +void main() > +{ > + float xy = gl_FragCoord.x * gl_FragCoord.y; > + float dy = dFdyCoarse(xy); > + if (distance(dy, gl_FragCoord.x) <= 1) > + gl_FragColor = vec4(0, 1, 0, 1); > + else > + gl_FragColor = vec4(1, 0, 0, 1); > +} > + > +[test] > +draw rect -1 -1 2 2 > +probe all rgba 0.0 1.0 0.0 1.0 > diff --git > a/tests/spec/arb_derivative_control/execution/dfdy-fine.shader_test > b/tests/spec/arb_derivative_control/execution/dfdy-fine.shader_test > new file mode 100644 > index 0000000..871826d > --- /dev/null > +++ b/tests/spec/arb_derivative_control/execution/dfdy-fine.shader_test > @@ -0,0 +1,26 @@ > +[require] > +GLSL >= 1.50 > +GL_ARB_derivative_control > + > +[vertex shader passthrough] > + > +[fragment shader] > +#extension GL_ARB_derivative_control: require > + > +void main() > +{ > + float y = gl_FragCoord.y; > + bool alt = bool(int(gl_FragCoord.x) % 2); > + float alty = alt ? -y : y; > + float dy = dFdyFine(alty); > + // Alternating columns are now descending, so check the direction > + // of the derivative based on the row we're in. > + if (alt && dy >= 0 || !alt && dy <= 0) > + gl_FragColor = vec4(1, 0, 0, 1); > + else > + gl_FragColor = vec4(0, 1, 0, 1); > +} > + > +[test] > +draw rect -1 -1 2 2 > +probe all rgba 0.0 1.0 0.0 1.0 > -- > 1.8.5.5 > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/piglit _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit