[Piglit] [PATCH 2/4] util: Make an even simpler interface for building simple shaders.

Paul Berry stereotype441 at gmail.com
Tue May 14 11:42:50 PDT 2013


On 14 May 2013 10:54, Eric Anholt <eric at anholt.net> wrote:

> Eric Anholt <eric at anholt.net> writes:
>
> > Brian Paul <brianp at vmware.com> writes:
> >
> >> On 05/08/2013 03:02 PM, Eric Anholt wrote:
> >>> The previous piglit_link_simple_program() interface required you to
> >>> compile your shaders up front, and tests routinely have issues with
> >>> either not checking that the component shaders compiled, or not
> >>> checking that the program linked, and then confusingly fail later in
> >>> the test.  This one enforces that the program actually compiled and
> >>> linked before continuing, so you don't need to worry about error
> >>> checking.
> >>> ---
> >>>   tests/util/piglit-shader.c | 35 +++++++++++++++++++++++++++++++++++
> >>>   tests/util/piglit-shader.h |  1 +
> >>>   2 files changed, 36 insertions(+)
> >>>
> >>> diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
> >>> index ca48f41..d715bab 100644
> >>> --- a/tests/util/piglit-shader.c
> >>> +++ b/tests/util/piglit-shader.c
> >>> @@ -263,3 +263,38 @@ GLint piglit_link_simple_program(GLint vs, GLint
> fs)
> >>>
> >>>     return prog;
> >>>   }
> >>> +
> >>> +/**
> >>> + * Builds and links a program from optional VS and FS sources,
> >>> + * throwing PIGLIT_FAIL on error.
> >>> + */
> >>> +GLint
> >>> +piglit_build_simple_program(const char *vs_source, const char
> *fs_source)
> >>
> >> How would you feel about adding a gs_source for geometry shaders too?
> >>
> >> Otherwise,
> >> Reviewed-by: Brian Paul <brianp at vmware.com>
> >
> > As long as we don't add tes/tcs as well, because damned if I'm ever
> > going to remember what order they all go in.
>
> On further thought, I think this interface is better mirroring
> piglit_link_simple_program and covering the 90% case of just a VS/FS.  I
> expect for GS-using tests, they will generally either be shader_runner
> tests (don't use this interface), or link failure tests (don't use this
> interface), or shader limits tests (usually have to manually link, to
> conditionally do things for beyond-the-limits cases).
>

I agree.  An additional complication with geometry shaders is that when
using ARB_geometry_shader4-style geometry shaders (which most of our GS
tests so far use), you need to make additional calls prior to linking, to
specify the input/output primitive types and maximum output primitive
count.  That's enough extra complication that it probably makes more sense
to just add a piglit_build_simple_program_with_gs() function if and when it
proves necessary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130514/8b8a15fc/attachment-0001.html>


More information about the Piglit mailing list