Re: [Piglit] [PATCH 2/2] variable-index-write.sh: extend to support glsl es 1.00

2013-03-28 Thread Tom Gall
On Thu, Mar 28, 2013 at 1:50 PM, Stuart Abercrombie
 wrote:
> The content looks good.  I'm just not sure if supplying 100 as a parameter
> should be the trigger for GLES GLSL 1.00.  It doesn't seem particularly
> obvious, although I know there is no regular GL GLSL version 1.00.

It's probably quite safe to say that a GLSL 1.00 will never happen and
that GLSL 1.00 will always mean GLSL ES 1.00.

I hate to drive from 100 by adding a 100es or something but I can see
the case for it.

> A separate preexisting issue is the location of the file, which is again
> misleading.

Yes these need to move. I think that's a separate patch and plan to
submit that as well.

Likewise the files that these scripts generate need to be deleted from
git and then a little bit of script added so that at build time all
these tests are generated in their respective glsl-xx-x.xx
directories.  I think that's a separate patch and also I plan to do
it.

> Stuart
>
>
> On Wed, Mar 20, 2013 at 3:15 PM, Tom Gall  wrote:
>>
>> From tests/spec/glsl-1.10 extend variable-index-write.sh so that
>> it can also correctly generates variable index write tests that
>> support glsl-es-1.00.
>>
>> 1.00 added as a valid parameter to generated tests for glsl-es-1.00.
>>
>> For 1.00 tests in the vertex shader an orthographic projection is
>> applied since ortho during the test portion isn't supported on
>> OpenGL ES.
>>
>> For 1.00 tests the fragent shader specifies default precision.
>>
>> For 1.00 tests emit in the [require] section the correct
>> GLSL ES and GL ES settings.
>>
>> Signed-off-by: Tom Gall 
>> ---
>>  tests/spec/glsl-1.10/variable-index-write.sh |   67
>> +++---
>>  1 file changed, 61 insertions(+), 6 deletions(-)
>>
>> diff --git a/tests/spec/glsl-1.10/variable-index-write.sh
>> b/tests/spec/glsl-1.10/variable-index-write.sh
>> index 96a4791..06802c4 100755
>> --- a/tests/spec/glsl-1.10/variable-index-write.sh
>> +++ b/tests/spec/glsl-1.10/variable-index-write.sh
>> @@ -177,6 +177,10 @@ function emit_fs
>>  fi
>>
>>  echo "[fragment shader]"
>> +if [ $v -eq 100 ]; then
>> +echo "precision highp float;"
>> +echo "precision highp int;"
>> +fi
>>
>>  emit_globals $*
>>
>> @@ -207,14 +211,24 @@ function emit_test_vectors
>>  index_value=$4
>>  col=$5
>>  value_type=$6
>> +v=${version/./}
>>
>> -cat <> +if [ "$v" -eq 100 ]; then
>> +cat <> +[test]
>> +clear color 0.5 0.5 0.5 0.5
>> +clear
>> +
>> +EOF
>> +else
>> +cat <>  [test]
>>  clear color 0.5 0.5 0.5 0.5
>>  clear
>>  ortho
>>
>>  EOF
>> +fi
>>
>>  # NOTE: shader_runner uses the matCxR names even for GLSL 1.10
>>  type="mat${matrix_dim}x${matrix_dim}"
>> @@ -321,15 +335,37 @@ EOF
>>
>>  function emit_fs_wr_test
>>  {
>> +v=${version/./}
>> +
>>  echo "# Test generated by:"
>>  echo "# ${cmd}"
>>  echo
>>  echo "[require]"
>> -echo "GLSL >= ${version}"
>> +if [ "$v" -eq 100 ]; then
>> +echo "GLSL ES >= ${version}"
>> +echo "GL ES >= 2.0"
>> +else
>> +echo "GLSL >= ${version}"
>> +fi
>>  echo
>>
>>  echo "[vertex shader]"
>> -echo "void main() { gl_Position = gl_ModelViewProjectionMatrix *
>> gl_Vertex; }"
>> +if [ "$v" -eq 100 ]; then
>> +echo "attribute vec4 vertex;"
>> +echo "mat4 projection = mat4("
>> +echo "2.0/250.0, 0.0, 0.0, -1.0,"
>> +echo "0.0, 2.0/250.0, 0.0, -1.0,"
>> +echo "0.0, 0.0, -1.0, 0.0,"
>> +echo "0.0, 0.0, 0.0, 1.0);"
>> +echo
>> +echo "void main()"
>> +echo "{"
>> +echo "gl_Position = vertex;"
>> +echo "gl_Position *= projection;"
>> +echo "}"
>> +else
>> +echo "void main() { gl_Position = gl_ModelViewProjectionMatrix *
>> gl_Vertex; }"
>> +fi
>>  echo
>>
>>  emit_fs $*
>> @@ -342,20 +378,39 @@ function emit_vs_wr_test
>>  matrix_dim=$1
>>  array_dim=$2
>>  mode=$3
>> +v=${version/./}
>>
>>  echo "# Test generated by:"
>>  echo "# ${cmd}"
>>  echo
>>  echo "[require]"
>> -echo "GLSL >= ${version}"
>> +if [ "$v" -eq 100 ]; then
>> +echo "GLSL ES >= ${version}"
>> +echo "GL ES >= 2.0"
>> +else
>> +echo "GLSL >= ${version}"
>> +fi
>>  echo
>>
>>  echo "[vertex shader]"
>> +if [ "$v" -eq 100 ]; then
>> +echo "attribute vec4 vertex;"
>> +echo "mat4 projection = mat4("
>> +echo "2.0/250.0, 0.0, 0.0, -1.0,"
>> +echo "0.0, 2.0/250.0, 0.0, -1.0,"
>> +echo "0.0, 0.0, -1.0, 0.0,"
>> +echo "0.0, 0.0, 0.0, 1.0);"
>> +fi
>>  emit_globals $*
>>
>>  echo "void main()"
>>  echo "{"
>> -echo "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
>> +if [ "$v" -eq 100 ]; then
>> +echo "gl_Position = vertex;"
>> +echo "gl_Position *= projection;"
>> +els

Re: [Piglit] [PATCH 2/2] variable-index-write.sh: extend to support glsl es 1.00

2013-03-28 Thread Stuart Abercrombie
The content looks good.  I'm just not sure if supplying 100 as a parameter
should be the trigger for GLES GLSL 1.00.  It doesn't seem particularly
obvious, although I know there is no regular GL GLSL version 1.00.

A separate preexisting issue is the location of the file, which is again
misleading.

Stuart


On Wed, Mar 20, 2013 at 3:15 PM, Tom Gall  wrote:

> From tests/spec/glsl-1.10 extend variable-index-write.sh so that
> it can also correctly generates variable index write tests that
> support glsl-es-1.00.
>
> 1.00 added as a valid parameter to generated tests for glsl-es-1.00.
>
> For 1.00 tests in the vertex shader an orthographic projection is
> applied since ortho during the test portion isn't supported on
> OpenGL ES.
>
> For 1.00 tests the fragent shader specifies default precision.
>
> For 1.00 tests emit in the [require] section the correct
> GLSL ES and GL ES settings.
>
> Signed-off-by: Tom Gall 
> ---
>  tests/spec/glsl-1.10/variable-index-write.sh |   67
> +++---
>  1 file changed, 61 insertions(+), 6 deletions(-)
>
> diff --git a/tests/spec/glsl-1.10/variable-index-write.sh
> b/tests/spec/glsl-1.10/variable-index-write.sh
> index 96a4791..06802c4 100755
> --- a/tests/spec/glsl-1.10/variable-index-write.sh
> +++ b/tests/spec/glsl-1.10/variable-index-write.sh
> @@ -177,6 +177,10 @@ function emit_fs
>  fi
>
>  echo "[fragment shader]"
> +if [ $v -eq 100 ]; then
> +echo "precision highp float;"
> +echo "precision highp int;"
> +fi
>
>  emit_globals $*
>
> @@ -207,14 +211,24 @@ function emit_test_vectors
>  index_value=$4
>  col=$5
>  value_type=$6
> +v=${version/./}
>
> -cat < +if [ "$v" -eq 100 ]; then
> +cat < +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +
> +EOF
> +else
> +cat <  [test]
>  clear color 0.5 0.5 0.5 0.5
>  clear
>  ortho
>
>  EOF
> +fi
>
>  # NOTE: shader_runner uses the matCxR names even for GLSL 1.10
>  type="mat${matrix_dim}x${matrix_dim}"
> @@ -321,15 +335,37 @@ EOF
>
>  function emit_fs_wr_test
>  {
> +v=${version/./}
> +
>  echo "# Test generated by:"
>  echo "# ${cmd}"
>  echo
>  echo "[require]"
> -echo "GLSL >= ${version}"
> +if [ "$v" -eq 100 ]; then
> +echo "GLSL ES >= ${version}"
> +echo "GL ES >= 2.0"
> +else
> +echo "GLSL >= ${version}"
> +fi
>  echo
>
>  echo "[vertex shader]"
> -echo "void main() { gl_Position = gl_ModelViewProjectionMatrix *
> gl_Vertex; }"
> +if [ "$v" -eq 100 ]; then
> +echo "attribute vec4 vertex;"
> +echo "mat4 projection = mat4("
> +echo "2.0/250.0, 0.0, 0.0, -1.0,"
> +echo "0.0, 2.0/250.0, 0.0, -1.0,"
> +echo "0.0, 0.0, -1.0, 0.0,"
> +echo "0.0, 0.0, 0.0, 1.0);"
> +echo
> +echo "void main()"
> +echo "{"
> +echo "gl_Position = vertex;"
> +echo "gl_Position *= projection;"
> +echo "}"
> +else
> +echo "void main() { gl_Position = gl_ModelViewProjectionMatrix *
> gl_Vertex; }"
> +fi
>  echo
>
>  emit_fs $*
> @@ -342,20 +378,39 @@ function emit_vs_wr_test
>  matrix_dim=$1
>  array_dim=$2
>  mode=$3
> +v=${version/./}
>
>  echo "# Test generated by:"
>  echo "# ${cmd}"
>  echo
>  echo "[require]"
> -echo "GLSL >= ${version}"
> +if [ "$v" -eq 100 ]; then
> +echo "GLSL ES >= ${version}"
> +echo "GL ES >= 2.0"
> +else
> +echo "GLSL >= ${version}"
> +fi
>  echo
>
>  echo "[vertex shader]"
> +if [ "$v" -eq 100 ]; then
> +echo "attribute vec4 vertex;"
> +echo "mat4 projection = mat4("
> +echo "2.0/250.0, 0.0, 0.0, -1.0,"
> +echo "0.0, 2.0/250.0, 0.0, -1.0,"
> +echo "0.0, 0.0, -1.0, 0.0,"
> +echo "0.0, 0.0, 0.0, 1.0);"
> +fi
>  emit_globals $*
>
>  echo "void main()"
>  echo "{"
> -echo "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
> +if [ "$v" -eq 100 ]; then
> +echo "gl_Position = vertex;"
> +echo "gl_Position *= projection;"
> +else
> +echo "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
> +fi
>  echo
>
>  emit_set_matrix $*
> @@ -387,7 +442,7 @@ if [ "x$1" = "x" ]; then
>  version="1.10"
>  else
>  case "$1" in
> -   1.[12]0) version="$1";;
> +   1.[012]0) version="$1";;
> *)
> echo "Bogus GLSL version \"$1\" specified."
> exit 1
> --
> 1.7.10.4
>
> ___
> 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


Re: [Piglit] [PATCH 1/1] glsl-es-1.00: sanity.shader_test fragment needs default precision

2013-03-28 Thread Stuart Abercrombie
Reviewed-by: Stuart Abercrombie 


On Wed, Mar 20, 2013 at 11:30 AM, Tom Gall  wrote:

> GLSL ES 1.00 spec 4.5.3 page 36:
> "The fragment language has no default precision qualifier for
> floating point types."
>
> Adding default precision for float in the fragment shader
> so this sanity testcase doesn't error out.
> mediump is choosen since according to 4.5.2 page 34:
> "The fragment language requires any uses of lowp and mediump to
> compile without error.  Support for highp is optional."
>
> Signed-off-by: Tom Gall 
> ---
>  tests/spec/glsl-es-1.00/execution/sanity.shader_test |2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tests/spec/glsl-es-1.00/execution/sanity.shader_test
> b/tests/spec/glsl-es-1.00/execution/sanity.shader_test
> index 0884e2c..5461167 100644
> --- a/tests/spec/glsl-es-1.00/execution/sanity.shader_test
> +++ b/tests/spec/glsl-es-1.00/execution/sanity.shader_test
> @@ -12,6 +12,8 @@ void main() {
>  }
>
>  [fragment shader]
> +precision mediump float;
> +
>  uniform vec4 u_color;
>
>  void main() {
> --
> 1.7.10.4
>
> ___
> 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


Re: [Piglit] [PATCH 1/3] piglit util: new functions piglit_program_pipeline_check_status/quiet

2013-03-28 Thread gregory hainaut
Sorry I did a forward which wrap my line. I resend it but it appears
before... 

Discard this patch please.

On Thu, 28 Mar 2013 18:45:33 +0100
gregory hainaut  wrote:

> Equivalent to piglit_link_check_status/quiet but with program object
> pipeline ---
>  tests/util/piglit-shader.c |   50
> 
> tests/util/piglit-shader.h |2 ++ 2 files changed, 52 insertions(+)
> 
> diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
> index c67e58a..d7a0266 100644
> --- a/tests/util/piglit-shader.c
> +++ b/tests/util/piglit-shader.c
> @@ -213,6 +213,45 @@ link_check_status(GLint prog, FILE *output)
>   return ok;
>  }
>  
> +/* Same function as above but for program pipeline */
> +static GLboolean
> +program_pipeline_check_status(GLuint pipeline, FILE *output)
> +{
> + GLchar *info = NULL;
> + GLint size;
> + GLint ok;
> +
> + piglit_require_extension("GL_ARB_separate_shader_objects");
> +
> + glValidateProgramPipeline(pipeline);
> + glGetProgramPipelineiv(pipeline, GL_VALIDATE_STATUS, &ok);
> +
> + /* Some drivers return a size of 1 for an empty log.  This is
> the size
> +  * of a log that contains only a terminating NUL character.
> +  */
> + glGetProgramPipelineiv(pipeline, GL_INFO_LOG_LENGTH, &size);
> + if (size > 1) {
> + info = malloc(size);
> + glGetProgramPipelineInfoLog(pipeline, size, NULL,
> info);
> + }
> +
> + if (!ok) {
> + fprintf(output, "Failed to validate the pipeline:
> %s\n",
> + (info != NULL) ? info : "");
> + }
> + else if (0 && info != NULL) {
> + /* Enable this to get extra linking info.
> +  * Even if there's no link errors, the info log may
> +  * have some remarks.
> +  */
> + printf("Pipeline validataion warning: %s\n", info);
> + }
> +
> + free(info);
> +
> + return ok;
> +}
> +
>  GLboolean
>  piglit_link_check_status(GLint prog)
>  {
> @@ -234,6 +273,17 @@ piglit_link_check_status_quiet(GLint prog)
>   return link_check_status(prog, stdout);
>  }
>  
> +GLboolean
> +piglit_program_pipeline_check_status(GLuint pipeline)
> +{
> + return program_pipeline_check_status(pipeline, stderr);
> +}
> +
> +GLboolean
> +piglit_program_pipeline_check_status_quiet(GLuint pipeline)
> +{
> + return program_pipeline_check_status(pipeline, stdout);
> +}
>  
>  GLint piglit_link_simple_program(GLint vs, GLint fs)
>  {
> diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
> index 12cf731..0bb7792 100644
> --- a/tests/util/piglit-shader.h
> +++ b/tests/util/piglit-shader.h
> @@ -34,6 +34,8 @@ GLuint piglit_compile_shader(GLenum target, const
> char *filename); GLuint piglit_compile_shader_text(GLenum target,
> const char *text); GLboolean piglit_link_check_status(GLint prog);
>  GLboolean piglit_link_check_status_quiet(GLint prog);
> +GLboolean piglit_program_pipeline_check_status(GLuint pipeline);
> +GLboolean piglit_program_pipeline_check_status_quiet(GLuint
> pipeline); GLint piglit_link_simple_program(GLint vs, GLint fs);
>  
>  #if defined(PIGLIT_USE_OPENGL_ES1)
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/3] update EXT_transform_feedback error detection

2013-03-28 Thread gregory hainaut
program pipeline add new INVALID_OPERATION (spec chapter 13.2.2)

Note: FGLRX don't report any of the expected errors...
---
 tests/all.tests|4 +-
 tests/spec/ext_transform_feedback/api-errors.c |   84 +++-
 2 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/tests/all.tests b/tests/all.tests
index 2cbf3c4..cd759b5 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1906,7 +1906,9 @@ for mode in ['interleaved_ok_base', 
'interleaved_ok_range',
  'bind_range_offset_2', 'bind_range_offset_3',
  'bind_range_offset_5', 'bind_offset_offset_1',
  'bind_offset_offset_2', 'bind_offset_offset_3',
- 'bind_offset_offset_5', 'not_a_program']:
+ 'bind_offset_offset_5', 'not_a_program',
+ 'useprogstage_noactive', 'useprogstage_active',
+ 'bind_pipeline']:
 test_name = 'api-errors {0}'.format(mode)
 ext_transform_feedback[test_name] = concurrent_test(
 'ext_transform_feedback-{0}'.format(test_name))
diff --git a/tests/spec/ext_transform_feedback/api-errors.c 
b/tests/spec/ext_transform_feedback/api-errors.c
index 04470b2..ba4fff8 100644
--- a/tests/spec/ext_transform_feedback/api-errors.c
+++ b/tests/spec/ext_transform_feedback/api-errors.c
@@ -78,6 +78,9 @@ enum test_mode {
BIND_BAD_SIZE,
BIND_BAD_OFFSET,
NOT_A_PROGRAM,
+   USEPROGSTAGE_ACTIVE,
+   USEPROGSTAGE_NOACTIVE,
+   BIND_PIPELINE
 };
 
 enum bind_mode {
@@ -97,6 +100,32 @@ static const char *vstext =
"  gl_Position = vec4(1.0);\n"
"}\n";
 
+static const char *vstext_sep_150 =
+   "#extension GL_ARB_separate_shader_objects : enable\n"
+   "out gl_PerVertex {\n"
+   "vec4 gl_Position;\n"
+   "};\n"
+   "varying vec4 foo;\n"
+   "varying vec4 bar;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "  foo = vec4(1.0);\n"
+   "  bar = vec4(1.0);\n"
+   "  gl_Position = vec4(1.0);\n"
+   "}\n";
+static const char *vstext_sep_140 =
+   "#extension GL_ARB_separate_shader_objects : enable\n"
+   "varying vec4 foo;\n"
+   "varying vec4 bar;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "  foo = vec4(1.0);\n"
+   "  bar = vec4(1.0);\n"
+   "  gl_Position = vec4(1.0);\n"
+   "}\n";
+
 static const char *varyings[] = { "foo", "bar" };
 
 static struct test_desc
@@ -151,6 +180,10 @@ static struct test_desc
{ "bind_offset_offset_3",BIND_BAD_OFFSET,  3, OFFSET, 
GL_INTERLEAVED_ATTRIBS, 1 },
{ "bind_offset_offset_5",BIND_BAD_OFFSET,  5, OFFSET, 
GL_INTERLEAVED_ATTRIBS, 1 },
{ "not_a_program",   NOT_A_PROGRAM,0, BASE,   
GL_INTERLEAVED_ATTRIBS, 1 },
+   { "useprogstage_noactive",   USEPROGSTAGE_NOACTIVE,0, BASE,   
GL_INTERLEAVED_ATTRIBS, 1 },
+   { "useprogstage_active", USEPROGSTAGE_ACTIVE,  0, BASE,   
GL_INTERLEAVED_ATTRIBS, 1 },
+   { "bind_pipeline",   BIND_PIPELINE,0, BASE,   
GL_INTERLEAVED_ATTRIBS, 1 },
+
 };
 
 static void
@@ -186,6 +219,7 @@ do_test(const struct test_desc *test)
 {
GLuint vs;
GLuint progs[2];
+   GLuint pipes[2];
GLuint bufs[NUM_BUFFERS];
float initial_xfb_buffer_contents[XFB_BUFFER_SIZE];
GLboolean pass = GL_TRUE;
@@ -193,6 +227,10 @@ do_test(const struct test_desc *test)
int num_varyings = test->mode == NO_VARYINGS ? 0 : test->num_buffers;
GLint max_separate_attribs;
 
+   if (test->mode == USEPROGSTAGE_ACTIVE || test->mode == 
USEPROGSTAGE_NOACTIVE || test->mode == BIND_PIPELINE) {
+   piglit_require_extension("GL_ARB_separate_shader_objects");
+   }
+
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
  &max_separate_attribs);
printf("MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTIBS=%i\n",
@@ -200,7 +238,19 @@ do_test(const struct test_desc *test)
 
printf("Compile vertex shader\n");
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
-   if (test->mode == NOT_A_PROGRAM) {
+   if (test->mode == USEPROGSTAGE_ACTIVE || test->mode == 
USEPROGSTAGE_NOACTIVE || test->mode == BIND_PIPELINE) {
+   /* Note, we can't use glCreateShaderProgramv because the setup 
of transform feedback
+* must be done before linking
+*/
+   if (piglit_get_gl_version() >= 32)
+   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, 
vstext_sep_150);
+   else
+   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, 
vstext_sep_140);
+   progs[0] = glCreateProgram();
+   glProgramParameteri(progs[0], GL_PROGRAM_SEPARABLE, GL_TRUE);
+   glAttachShader(progs[0], vs);
+
+   } else if (test->mode == NOT_A_PROGRAM) {
printf("Create a program and then delete it\n");
   

[Piglit] [PATCH 2/3] add 3 news tests for arb_separate_shader_objects

2013-03-28 Thread gregory hainaut
* new test IsProgramPipeline: check the Pipeline object state creation. 
GenPipeline
only reserved name. I also take the opportunity to test negative value
on glGenProgramPipelines and glDeleteProgramPipelines.
Note: FGLRX don't follow the spec besides crash on glGenProgramPipelines 
because of -1...
Note: Nvidia seems to crash on glDeleteProgramPipelines because of -1...

* new test mix_pipeline_useprogram: the goal is to test the state mix of
glUseProgram/glBindProgramPipeline/glActiveProgram. Ian quote:
 "In this case, either the UseProgram state or the BindProgramPipeline state.
  If UseProgram sets a non-zero program, that state is used.  Otherwise the
  BindProgramPipeline state is used.In this case, I think AMD's
  behavior is incorrect."

Note: Nvidia seems to be fine.

* new test GetProgramPipelineiv: bind various stages (including geometry and 
tesselation
to the pipeline and check the result with GetProgramPipelineiv. I take also the 
opportunity to use
glCreateShaderProgramv.  Note: I got an GL_INVALID_VALUE when 
glActiveShaderProgram is
called with a program that isn't bound to any stage to the pipeline. For me 
there isn't such limitation in the spec
but I could be wrong.
Spec quote:
"An INVALID_VALUE error is generated if program is not the name of ei-
ther a program or shader object.
An INVALID_OPERATION error is generated if program is the name of a
shader object."

General note: I duplicate the vertex shader for differents GL version. On GLSL 
150+ built-in must be
redeclared. However previous version doesn't support in/out block so it is up 
to the GLSL compiler to
include them inplicitely. I try to force on older version of GLSL but it 
doesn't work on FGLRX and still
need the redeclaration...
---
 tests/all.tests|7 +
 tests/spec/CMakeLists.txt  |1 +
 .../arb_separate_shader_objects/CMakeLists.gl.txt  |   14 +
 .../arb_separate_shader_objects/CMakeLists.txt |1 +
 .../GetProgramPipelineiv.c |  279 +++
 .../IsProgramPipeline.c|  113 ++
 .../mix_pipeline_useprogram.c  |  361 
 7 files changed, 776 insertions(+)
 create mode 100644 tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_separate_shader_objects/CMakeLists.txt
 create mode 100644 
tests/spec/arb_separate_shader_objects/GetProgramPipelineiv.c
 create mode 100644 tests/spec/arb_separate_shader_objects/IsProgramPipeline.c
 create mode 100644 
tests/spec/arb_separate_shader_objects/mix_pipeline_useprogram.c

diff --git a/tests/all.tests b/tests/all.tests
index 20120d1..2cbf3c4 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1079,6 +1079,13 @@ add_concurrent_test(arb_occlusion_query, 
'occlusion_query_meta_fragments')
 add_concurrent_test(arb_occlusion_query, 'occlusion_query_meta_no_fragments')
 add_concurrent_test(arb_occlusion_query, 'occlusion_query_order')
 
+# Group ARB_separate_shader_objects
+arb_separate_shader_objects = Group()
+spec['ARB_separate_shader_objects'] = arb_separate_shader_objects
+arb_separate_shader_objects['sso-GetProgramPipelineiv'] = 
concurrent_test('arb_separate_shader_object-GetProgramPipelineiv')
+arb_separate_shader_objects['sso-IsProgramPipeline'] = 
concurrent_test('arb_separate_shader_object-IsProgramPipeline')
+arb_separate_shader_objects['sso-mix_pipeline_useprogram'] = 
concurrent_test('arb_separate_shader_object-mix_pipeline_useprogram')
+
 # Group ARB_sampler_objects
 arb_sampler_objects = Group()
 spec['ARB_sampler_objects'] = arb_sampler_objects
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 18b1d37..97efd36 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -15,6 +15,7 @@ add_subdirectory (arb_robustness)
 add_subdirectory (arb_sampler_objects)
 add_subdirectory (arb_seamless_cube_map)
 add_subdirectory (amd_seamless_cubemap_per_texture)
+add_subdirectory (arb_separate_shader_objects)
 add_subdirectory (arb_shader_texture_lod/execution)
 add_subdirectory (arb_shader_objects)
 add_subdirectory (arb_sync)
diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt 
b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
new file mode 100644
index 000..e651956
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_separate_shader_object-IsProgramPipeline 
IsProgramPipeline.c)
+piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv 
GetProgramPipelineiv.c)
+piglit_add_executable (arb_separate_shader_object-mix_pipeline_useprogram 
mix_pipeline_useprogram.c)
diff --git a/tests/spec/arb_separate_shader_objects/CMak

[Piglit] [PATCH 1/3] piglit util: new functions piglit_program_pipeline_check_status/quiet

2013-03-28 Thread gregory hainaut
Equivalent to piglit_link_check_status/quiet but with program object pipeline
---
 tests/util/piglit-shader.c |   50 
 tests/util/piglit-shader.h |2 ++
 2 files changed, 52 insertions(+)

diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index c67e58a..d7a0266 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -213,6 +213,45 @@ link_check_status(GLint prog, FILE *output)
return ok;
 }
 
+/* Same function as above but for program pipeline */
+static GLboolean
+program_pipeline_check_status(GLuint pipeline, FILE *output)
+{
+   GLchar *info = NULL;
+   GLint size;
+   GLint ok;
+
+   piglit_require_extension("GL_ARB_separate_shader_objects");
+
+   glValidateProgramPipeline(pipeline);
+   glGetProgramPipelineiv(pipeline, GL_VALIDATE_STATUS, &ok);
+
+   /* Some drivers return a size of 1 for an empty log.  This is the size
+* of a log that contains only a terminating NUL character.
+*/
+   glGetProgramPipelineiv(pipeline, GL_INFO_LOG_LENGTH, &size);
+   if (size > 1) {
+   info = malloc(size);
+   glGetProgramPipelineInfoLog(pipeline, size, NULL, info);
+   }
+
+   if (!ok) {
+   fprintf(output, "Failed to validate the pipeline: %s\n",
+   (info != NULL) ? info : "");
+   }
+   else if (0 && info != NULL) {
+   /* Enable this to get extra linking info.
+* Even if there's no link errors, the info log may
+* have some remarks.
+*/
+   printf("Pipeline validataion warning: %s\n", info);
+   }
+
+   free(info);
+
+   return ok;
+}
+
 GLboolean
 piglit_link_check_status(GLint prog)
 {
@@ -234,6 +273,17 @@ piglit_link_check_status_quiet(GLint prog)
return link_check_status(prog, stdout);
 }
 
+GLboolean
+piglit_program_pipeline_check_status(GLuint pipeline)
+{
+   return program_pipeline_check_status(pipeline, stderr);
+}
+
+GLboolean
+piglit_program_pipeline_check_status_quiet(GLuint pipeline)
+{
+   return program_pipeline_check_status(pipeline, stdout);
+}
 
 GLint piglit_link_simple_program(GLint vs, GLint fs)
 {
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 12cf731..0bb7792 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -34,6 +34,8 @@ GLuint piglit_compile_shader(GLenum target, const char 
*filename);
 GLuint piglit_compile_shader_text(GLenum target, const char *text);
 GLboolean piglit_link_check_status(GLint prog);
 GLboolean piglit_link_check_status_quiet(GLint prog);
+GLboolean piglit_program_pipeline_check_status(GLuint pipeline);
+GLboolean piglit_program_pipeline_check_status_quiet(GLuint pipeline);
 GLint piglit_link_simple_program(GLint vs, GLint fs);
 
 #if defined(PIGLIT_USE_OPENGL_ES1)
-- 
1.7.10.4
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] piglit util: new functions piglit_program_pipeline_check_status/quiet

2013-03-28 Thread gregory hainaut
Equivalent to piglit_link_check_status/quiet but with program object
pipeline ---
 tests/util/piglit-shader.c |   50
 tests/util/piglit-shader.h
|2 ++ 2 files changed, 52 insertions(+)

diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index c67e58a..d7a0266 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -213,6 +213,45 @@ link_check_status(GLint prog, FILE *output)
return ok;
 }
 
+/* Same function as above but for program pipeline */
+static GLboolean
+program_pipeline_check_status(GLuint pipeline, FILE *output)
+{
+   GLchar *info = NULL;
+   GLint size;
+   GLint ok;
+
+   piglit_require_extension("GL_ARB_separate_shader_objects");
+
+   glValidateProgramPipeline(pipeline);
+   glGetProgramPipelineiv(pipeline, GL_VALIDATE_STATUS, &ok);
+
+   /* Some drivers return a size of 1 for an empty log.  This is
the size
+* of a log that contains only a terminating NUL character.
+*/
+   glGetProgramPipelineiv(pipeline, GL_INFO_LOG_LENGTH, &size);
+   if (size > 1) {
+   info = malloc(size);
+   glGetProgramPipelineInfoLog(pipeline, size, NULL,
info);
+   }
+
+   if (!ok) {
+   fprintf(output, "Failed to validate the pipeline:
%s\n",
+   (info != NULL) ? info : "");
+   }
+   else if (0 && info != NULL) {
+   /* Enable this to get extra linking info.
+* Even if there's no link errors, the info log may
+* have some remarks.
+*/
+   printf("Pipeline validataion warning: %s\n", info);
+   }
+
+   free(info);
+
+   return ok;
+}
+
 GLboolean
 piglit_link_check_status(GLint prog)
 {
@@ -234,6 +273,17 @@ piglit_link_check_status_quiet(GLint prog)
return link_check_status(prog, stdout);
 }
 
+GLboolean
+piglit_program_pipeline_check_status(GLuint pipeline)
+{
+   return program_pipeline_check_status(pipeline, stderr);
+}
+
+GLboolean
+piglit_program_pipeline_check_status_quiet(GLuint pipeline)
+{
+   return program_pipeline_check_status(pipeline, stdout);
+}
 
 GLint piglit_link_simple_program(GLint vs, GLint fs)
 {
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 12cf731..0bb7792 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -34,6 +34,8 @@ GLuint piglit_compile_shader(GLenum target, const
char *filename); GLuint piglit_compile_shader_text(GLenum target, const
char *text); GLboolean piglit_link_check_status(GLint prog);
 GLboolean piglit_link_check_status_quiet(GLint prog);
+GLboolean piglit_program_pipeline_check_status(GLuint pipeline);
+GLboolean piglit_program_pipeline_check_status_quiet(GLuint pipeline);
 GLint piglit_link_simple_program(GLint vs, GLint fs);
 
 #if defined(PIGLIT_USE_OPENGL_ES1)
-- 
1.7.10.4
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] Feature request: indirect rendering

2013-03-28 Thread Brian Paul

I happened to find a bug in NVIDIA's driver with indirect GLX rendering.

I was going to write a piglit test for it but found that we have no 
way to request an indirect GLX context in piglit.


We could either:

1. add a PIGLIT_GL_VISUAL_INDIRECT bit/flag
2. add a bol piglit_gl_test_config::indirect field (my preference)

If we can't create an indirect rendering context for a test, report 
PIGLIT_SKIP.


This would have to be plumbed down through waffle also.

I'll go ahead and write some patches if there's no concerns.

-Brian

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Rework the PIGLIT_GL_VISUAL flags, fix RGB vs RGBA vs ALPHA confusion

2013-03-28 Thread Chris Forbes
Looks good to me. I've fallen in this trap at least once, so it's
great to see it go away. Feel free to add my R-b.

-- Chris

On Wed, Mar 27, 2013 at 6:13 AM, Marek Olšák  wrote:
> Hi,
>
> would anyone like to comment on this? Or is it still stuck in the
> moderation queue?
>
> Marek
> ___
> 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


Re: [Piglit] [PATCH] Rework the PIGLIT_GL_VISUAL flags, fix RGB vs RGBA vs ALPHA confusion

2013-03-28 Thread Jose Fonseca
Me too FWIW

Jose

- Original Message -
> The patch seems to be too large for a mailing list. It's here:
> 
> http://cgit.freedesktop.org/~mareko/piglit/commit/?id=8fa85790a3e5a3caba3a6eba912e7858c893363b
> 
> Marek
> 
> On Wed, Mar 27, 2013 at 11:39 PM, Brian Paul  wrote:
> > On 03/26/2013 11:13 AM, Marek Olšák wrote:
> >>
> >> Hi,
> >>
> >> would anyone like to comment on this? Or is it still stuck in the
> >> moderation queue?
> >
> >
> > I can't find the patch you're referring to.  Repost?
> >
> > -Brian
> >
> ___
> 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


Re: [Piglit] [PATCH V2 2/2] arb_texture_multisample: add new negative-max-samples test

2013-03-28 Thread Kenneth Graunke

On 03/15/2013 02:13 AM, Chris Forbes wrote:

This covers the sample count limits for both renderbuffers and
multisample textures, when ARB_texture_multisample is supported.

Skips if ARB_internalformat_query is supported, since that extension
allows the overall sample count limits to be exceeded on a
per-internalformat basis.

V2: - Emit a useful message when skipping.

Signed-off-by: Chris Forbes 
---
  tests/all.tests|   1 +
  .../spec/arb_texture_multisample/CMakeLists.gl.txt |   1 +
  .../arb_texture_multisample/negative-max-samples.c | 130 +
  3 files changed, 132 insertions(+)
  create mode 100644 tests/spec/arb_texture_multisample/negative-max-samples.c

diff --git a/tests/all.tests b/tests/all.tests
index 20120d1..451aef7 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -898,6 +898,7 @@ add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-sample-mas
  add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-sample-mask-value')
  add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-sample-mask-execution')
  add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-sample-mask-execution -tex')
+add_concurrent_test(arb_texture_multisample, 
'arb_texture_multisample-negative-max-samples')
  for stage in ['vs', 'fs']:
# textureSize():
for sampler in samplers_atm:
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index ce9cb82..1339d62 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ piglit_add_executable (arb_texture_multisample-texstate 
texstate.c)
  piglit_add_executable (arb_texture_multisample-sample-mask sample-mask.c)
  piglit_add_executable (arb_texture_multisample-sample-mask-value 
sample-mask-value.c)
  piglit_add_executable (arb_texture_multisample-sample-mask-execution 
sample-mask-execution.c)
+piglit_add_executable (arb_texture_multisample-negative-max-samples 
negative-max-samples.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_multisample/negative-max-samples.c 
b/tests/spec/arb_texture_multisample/negative-max-samples.c
new file mode 100644
index 000..250c89b
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/negative-max-samples.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2013 Chris Forbes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-gl-common.h"
+
+/**
+ * @file negative-max-samples.c
+ *
+ * Tests that asking for more than the appropriate sample count limit fails,
+ * with the correct errors.
+ *
+ * See also EXT_framebuffer_multisample/negative-max-samples for the simpler
+ * case prior to ARB_texture_multisample.
+ *
+ * Skips if ARB_internalformat_query is supported -- ARB_internalformat_query 
allows
+ * the limit to be higher for particular internalformats.
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+/* UNREACHED */
+return PIGLIT_FAIL;
+}
+
+struct subtest
+{
+const char *name;
+int use_texture;
+GLenum internalformat;
+GLenum limit;
+GLenum error;
+} subtests[] =
+{
+/* multisample textures have separate limits for each of 
color/depth/integer,
+ * all of which must be <= MAX_SAMPLES; GL_INVALID_OPERATION is generated 
if the
+ * limit is exceeded. */
+{ "tex_color", GL_TRUE, GL_RGBA,
+GL_MAX_COLOR_TEXTURE_SAMPLES, GL_INVALID_OPERATION },
+{ "tex_depth", GL_TRUE, GL_DEPTH_COMPONENT,
+GL_MAX_DEPTH_TEXTURE_SAMPLES, GL_INVALID_OPERATION },
+{ "tex_integer", GL_TRUE, GL_RGBA16I,
+GL_MAX_INTEGER_SAMPLES, GL

Re: [Piglit] [PATCH V2 1/2] ext_framebuffer_multisample: skip negative-max-samples

2013-03-28 Thread Kenneth Graunke

On 03/15/2013 02:13 AM, Chris Forbes wrote:

If ARB_texture_multisample or ARB_internalformat_query are supported,
the limits and/or errors generated are different, so skip this test.

V2: - Emit a useful message when skipping.

Signed-off-by: Chris Forbes 
---
  .../ext_framebuffer_multisample/negative-max-samples.c   | 16 
  1 file changed, 16 insertions(+)

diff --git a/tests/spec/ext_framebuffer_multisample/negative-max-samples.c 
b/tests/spec/ext_framebuffer_multisample/negative-max-samples.c
index cb6bf97..ff39575 100644
--- a/tests/spec/ext_framebuffer_multisample/negative-max-samples.c
+++ b/tests/spec/ext_framebuffer_multisample/negative-max-samples.c
@@ -33,6 +33,11 @@
   * "If either  or  is greater than
   *  MAX_RENDERBUFFER_SIZE_EXT, or if  is greater than
   *  MAX_SAMPLES_EXT, then the error INVALID_VALUE is generated."
+ *
+ * Skips if ARB_texture_multisample or ARB_internalformat_query are
+ * supported. ARB_texture_multisample changes the error which should
+ * be generated; ARB_internalformat_query allows the limit for particular
+ * internalformats to be >MAX_SAMPLES.
   */

  PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -60,6 +65,17 @@ piglit_init(int argc, char **argv)

piglit_require_extension("GL_EXT_framebuffer_multisample");

+   if (piglit_is_extension_supported("GL_ARB_internalformat_query")) {
+   printf("ARB_internalformat_query is supported and "
+   "redefines this behavior; skipping\n");


There's an extra level of indentation here for some reason.  Both " 
marks should line up.



+   piglit_report_result(PIGLIT_SKIP);
+   }
+   if (piglit_is_extension_supported("GL_ARB_texture_multisample")) {
+   printf("ARB_texture_multisample is supposed and "
+   "redefines this behavior; skipping\n");


Ditto.

Otherwise, patch 1 is:
Reviewed-by: Kenneth Graunke 


+   piglit_report_result(PIGLIT_SKIP);
+   }
+
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);

glGenRenderbuffersEXT(1, &rb);



___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit