[Piglit] [PATCH 10/13] shader_runner: Add GLES workarounds

Ian Romanick idr at freedesktop.org
Tue Dec 4 18:50:51 PST 2012


Gak!  Sorry for the multiple sends.  My mailer kept telling me that 
delivery failed, and asked if I wanted to resend.  Apparently it was 
full of crap. :(

On 12/04/2012 05:43 PM, Ian Romanick wrote:
> On 12/03/2012 09:59 PM, Chad Versace wrote:
>> Since piglit-dispatch does not yet support GLES, in order to build
>> shader_runner.c against GLES3 we need some workarounds.
>>
>> 1. Add file shader_runner_gles_workarounds.h.
>>
>> 2. Let shader_runner.c include it.
>>
>> 3. For each GLenum used by shader_runner.c that is not found in
>>     <GLES3/gl3.h>, redefine it in shader_runner_gles_workarounds.h to
>> have
>>     the same values as in <GL/gl*.h>.
>>
>> 4. For each function used by shader_runner.c that is not found in
>>     <GLES3/gl3.h>, define a macro that prints an error message and skips
>>     the test, just as piglit-dispatch does for unsupported functions.
>>
>> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
>> ---
>>   tests/shaders/shader_runner.c                  |   2 +
>>   tests/shaders/shader_runner_gles_workarounds.h | 145
>> +++++++++++++++++++++++++
>>   2 files changed, 147 insertions(+)
>>   create mode 100644 tests/shaders/shader_runner_gles_workarounds.h
>>
>> diff --git a/tests/shaders/shader_runner.c
>> b/tests/shaders/shader_runner.c
>> index 11753f0..255d88d 100644
>> --- a/tests/shaders/shader_runner.c
>> +++ b/tests/shaders/shader_runner.c
>> @@ -36,6 +36,8 @@
>>   #include "piglit-util-gl-common.h"
>>   #include "piglit-vbo.h"
>>
>> +#include "shader_runner_gles_workarounds.h"
>> +
>>   static void
>>   get_required_versions(const char *script_name,
>>                 struct piglit_gl_test_config *config);
>> diff --git a/tests/shaders/shader_runner_gles_workarounds.h
>> b/tests/shaders/shader_runner_gles_workarounds.h
>> new file mode 100644
>> index 0000000..bde115e
>> --- /dev/null
>> +++ b/tests/shaders/shader_runner_gles_workarounds.h
>> @@ -0,0 +1,145 @@
>> +/*
>> + * Copyright © 2012 Intel Corporation
>> + *
>> + * 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.
>> + */
>> +
>> +/**
>> + * \file
>> + * \brief Workarounds for building with GLES.
>> + *
>> + * When building shader_runner against GLES3 and libpiglitutil_gles3,
>> there
>> + * are many macros and symbols that are not defined. This header
>> defines such
>> + * macros to have the same value found in <GL/gl*.h>, and defines such
>> + * functions to print an error message and then report PIGLIT_SKIP,
>> just as
>> + * piglit-dispatch does for unsupported extension functions.
>> + */
>> +
>> +#include <stdio.h>
>> +#include "piglit-util.h"
>> +
>> +#define GL_CLIP_PLANE0 0x3000
>> +#define GL_CLIP_PLANE1 0x3001
>> +#define GL_CLIP_PLANE2 0x3002
>> +#define GL_CLIP_PLANE3 0x3003
>> +#define GL_CLIP_PLANE4 0x3004
>> +#define GL_CLIP_PLANE5 0x3005
>> +#define GL_COMPARE_R_TO_TEXTURE 0x884E
>> +#define GL_DEPTH_TEXTURE_MODE 0x884B
>> +#define GL_FLAT 0x1D00
>> +#define GL_FRAGMENT_PROGRAM_ARB 0x8804
>> +#define GL_GEOMETRY_SHADER 0x8DD9
>> +#define GL_INTENSITY 0x8049
>> +#define GL_MAX_CLIP_PLANES 0x0D32
>> +#define GL_POLYGON 0x0009
>> +#define GL_POLYGON_OFFSET_EXT 0x8037
>> +#define GL_QUADS 0x0007
>> +#define GL_QUAD_STRIP 0x0008
>> +#define GL_SMOOTH 0x1D01
>> +#define GL_TEXTURE_1D 0x0DE0
>> +#define GL_TEXTURE_1D_ARRAY 0x8C18
>> +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
>> +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
>> +#define GL_TEXTURE_RECTANGLE 0x84F5
>> +#define GL_VERTEX_ARRAY 0x8074
>> +#define GL_VERTEX_PROGRAM_ARB 0x8620
>> +#define GL_VERTEX_PROGRAM_ARB 0x8620
>> +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
>> +#define GL_WRITE_ONLY 0x88B9
>> +
>> +static void __attribute__((unused))
>> +unsupported_function(const char *name)
>> +{
>> +    printf("Function \"%s\" not supported on this implementation\n",
>> name);
>> +    piglit_report_result(PIGLIT_SKIP);
>> +}
>> +
>> +/**
>> + * This macro should be sufficient for most functions. If one of the
>> actual
>> + * function's parameters causes an unused-variable warning, you must
>> + * special-case the function. See glBindProgramARB for example.
>> + *
>> + * GLES doesn't exist on Windows. So we're free to use the GCC/Clang
>> extension
>> + * for statement expressions.
>> + */
>> +#define UNSUPPORTED_FUNCTION(name, return_value) \
>> +    ({ \
>> +         unsupported_function(#name); \
>> +         return_value; \
>> +     })
>> +
>> +#ifndef glBindProgramARB
>> +#define glBindProgramARB(a, b) \
>> +    ({ \
>> +         (void) a; \
>> +         (void) b; \
>> +        unsupported_function("glBindProgramARB"); \
>> +     })
>> +#endif
>> +
>> +#ifndef glMapBuffer
>> +#define glMapBuffer(...) UNSUPPORTED_FUNCTION(glMapBuffer, NULL)
>> +#endif
>
> ES2 has glMapBufferOES, and ES3 has glMapBufferRange.  Perhaps we could
> work around this one differently?  I don't recall how it's used in
> shader_runner...
>
>> +
>> +#ifndef glVertexPointer
>> +#define glVertexPointer(a, b, c, d) \
>> +    ({ \
>> +         (void) a; \
>> +         (void) b; \
>> +         (void) c; \
>> +         (void) d; \
>> +        unsupported_function("glVertexPointer"); \
>> +     })
>> +#endif
>> +
>> +#ifndef glEnableClientState
>> +#define glEnableClientState(...)
>> UNSUPPORTED_FUNCTION(glEnableClientState, 0)
>> +#endif
>> +
>> +#ifndef glDisableClientState
>> +#define glDisableClientState(...)
>> UNSUPPORTED_FUNCTION(glDisableClientState, 0)
>> +#endif
>> +
>> +#ifndef glClipPlane
>> +#define glClipPlane(...) UNSUPPORTED_FUNCTION(glClipPlane, 0)
>> +#endif
>> +
>> +#ifndef glShadeModel
>> +#define glShadeModel(...) UNSUPPORTED_FUNCTION(glShadeModel, 0)
>> +#endif
>> +
>> +#ifndef glProgramEnvParameter4fvARB
>> +#define glProgramEnvParameter4fvARB(...)
>> UNSUPPORTED_FUNCTION(glProgramEnvParameter4fvARB, 0)
>> +#endif
>> +
>> +#ifndef glProgramLocalParameter4fvARB
>> +#define glProgramLocalParameter4fvARB(...)
>> UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0)
>> +#endif
>> +
>> +#ifndef PIGLIT_USE_OPENGL
>> +
>> +    #define piglit_frustum_projection(...)
>> UNSUPPORTED_FUNCTION(piglit_frustum_projection, 0)
>> +    #define piglit_gen_ortho_projection(...)
>> UNSUPPORTED_FUNCTION(piglit_gen_ortho_projection, 0)
>> +    #define piglit_miptree_texture(...)
>> UNSUPPORTED_FUNCTION(piglit_miptree_texture, 0)
>> +    #define piglit_depth_texture(...)
>> UNSUPPORTED_FUNCTION(piglit_depth_texture, 0)
>> +    #define piglit_ortho_projection(...)
>> UNSUPPORTED_FUNCTION(piglit_ortho_projection, 0)
>> +    #define piglit_compile_program(...)
>> UNSUPPORTED_FUNCTION(piglit_compile_program, 0)
>> +
>> +#endif /*PIGLIT_USE_OPENGL*/
>>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>



More information about the Piglit mailing list