[Piglit] [PATCH 02/25] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
Francisco Jerez
currojerez at riseup.net
Thu Oct 9 02:17:20 PDT 2014
Ian Romanick <idr at freedesktop.org> writes:
> On 10/05/2014 11:00 PM, Francisco Jerez wrote:
>> Define a variant of piglit_compile_shader_text() that doesn't call
>> piglit_report_result() on failure killing the program, which is quite
>> annoying for tests that expect a compilation to fail and for tests
>
> All of the existing negative-compile tests use glslparsertest. By using
> glslparsertest, it is very easy to skip all the negative-compile tests
> when you're just trying to test hardware changes.
>
Right, but the current behavior doesn't work for tests with subtests
either, that's the actual reason why the ARB_shader_image_load_store
tests need this change.
>> that are structured in a number of subtests, because a single sub-test
>> failing to compile a shader will prevent the remaining tests from
>> running.
>>
>> I guess this would ideally be the default behavior of
>> piglit_compile_shader_text(), but with >300 callers in tree it seems
>> rather difficult to change at this stage.
>> ---
>> tests/util/piglit-shader.c | 20 ++++++++++++++++++--
>> tests/util/piglit-shader.h | 1 +
>> 2 files changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
>> index e8fe9c4..37cc7cc 100644
>> --- a/tests/util/piglit-shader.c
>> +++ b/tests/util/piglit-shader.c
>> @@ -122,7 +122,7 @@ shader_name(GLenum target)
>> * Convenience function to compile a GLSL shader.
>> */
>> GLuint
>> -piglit_compile_shader_text(GLenum target, const char *text)
>> +piglit_compile_shader_text_nothrow(GLenum target, const char *text)
>> {
>> GLuint prog;
>> GLint ok;
>> @@ -149,7 +149,8 @@ piglit_compile_shader_text(GLenum target, const char *text)
>> info);
>>
>> fprintf(stderr, "source:\n%s", text);
>> - piglit_report_result(PIGLIT_FAIL);
>> + glDeleteShader(prog);
>> + prog = 0;
>> }
>> else if (0) {
>> /* Enable this to get extra compilation info.
>> @@ -164,6 +165,21 @@ piglit_compile_shader_text(GLenum target, const char *text)
>> return prog;
>> }
>>
>> +/**
>> + * Convenience function to compile a GLSL shader. Throws PIGLIT_FAIL
>> + * on error terminating the program.
>> + */
>> +GLuint
>> +piglit_compile_shader_text(GLenum target, const char *text)
>> +{
>> + GLuint shader = piglit_compile_shader_text_nothrow(target, text);
>> +
>> + if (!shader)
>> + piglit_report_result(PIGLIT_FAIL);
>> +
>> + return shader;
>> +}
>> +
>> static GLboolean
>> link_check_status(GLint prog, FILE *output)
>> {
>> diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
>> index e2eef03..9208451 100644
>> --- a/tests/util/piglit-shader.h
>> +++ b/tests/util/piglit-shader.h
>> @@ -31,6 +31,7 @@
>> void piglit_get_glsl_version(bool *es, int* major, int* minor);
>>
>> GLuint piglit_compile_shader(GLenum target, const char *filename);
>> +GLuint piglit_compile_shader_text_nothrow(GLenum target, const char *text);
>> 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);
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20141009/33e00fb9/attachment.sig>
More information about the Piglit
mailing list