[Piglit] [PATCH 3/5] s3tc-teximage: port to gles2
Erik Faye-Lund
erik.faye-lund at collabora.com
Thu Oct 25 14:50:06 UTC 2018
On Thu, 2018-10-25 at 10:44 -0400, Ilia Mirkin wrote:
> On Wed, Oct 24, 2018 at 12:30 PM Erik Faye-Lund
> <erik.faye-lund at collabora.com> wrote:
> >
> > This specification is also supported on gles2, so let's add support
> > for gles2 to the test also.
> > ---
> > tests/texturing/CMakeLists.gles2.txt | 5 +++
> > tests/texturing/s3tc-teximage.c | 48
> > ++++++++++++++++++++++++++++
> > 2 files changed, 53 insertions(+)
> > create mode 100644 tests/texturing/CMakeLists.gles2.txt
> >
> > diff --git a/tests/texturing/CMakeLists.gles2.txt
> > b/tests/texturing/CMakeLists.gles2.txt
> > new file mode 100644
> > index 000000000..1ba3fcbf9
> > --- /dev/null
> > +++ b/tests/texturing/CMakeLists.gles2.txt
> > @@ -0,0 +1,5 @@
> > +link_libraries(piglitutil_${piglit_target_api})
> > +
> > +piglit_add_executable (s3tc-teximage s3tc-teximage.c)
>
> Won't this just overwrite the GL binary? Normally these have a _es2
> suffix to differentiate. (Same applies to your other patches.)
>
Whoops, yes. I was building either with only GL or only GLES, which I
suppose is why this didn't cause issues for me. I'll fix it up!
> > +
> > +# vim: ft=cmake:
> > diff --git a/tests/texturing/s3tc-teximage.c
> > b/tests/texturing/s3tc-teximage.c
> > index a7225f6f0..1b65f6ce1 100644
> > --- a/tests/texturing/s3tc-teximage.c
> > +++ b/tests/texturing/s3tc-teximage.c
> > @@ -36,7 +36,11 @@
> >
> > PIGLIT_GL_TEST_CONFIG_BEGIN
> >
> > +#ifdef PIGLIT_USE_OPENGL
> > config.supports_gl_compat_version = 11;
> > +#else // PIGLIT_USE_OPENGL_ES2
> > + config.supports_gl_es_version = 20;
> > +#endif
> >
> > config.window_width = 500;
> > config.window_height = 600;
> > @@ -52,12 +56,45 @@ const float green[4] = {0.0, 1.0, 0.0, 1.0};
> > const float blue[4] = {0.0, 0.0, 1.0, 1.0};
> > const float white[4] = {1.0, 1.0, 1.0, 1.0};
> >
> > +#ifdef PIGLIT_USE_OPENGL_ES2
> > +
> > +const char *vs_source =
> > + "#version 100\n"
> > + "attribute vec4 piglit_vertex;\n"
> > + "attribute vec2 piglit_texcoord;\n"
> > + "varying mediump vec2 tex_coord;\n"
> > + "uniform mat4 proj;\n"
> > + "\n"
> > + "void main()\n"
> > + "{\n"
> > + " gl_Position = proj * piglit_vertex;\n"
> > + " tex_coord = piglit_texcoord;\n"
> > + "}\n";
> > +
> > +const char *fs_source =
> > + "#version 100\n"
> > + "varying mediump vec2 tex_coord;\n"
> > + "uniform sampler2D tex;\n"
> > + "\n"
> > + "void main()\n"
> > + "{\n"
> > + " gl_FragColor = texture2D(tex, tex_coord);\n"
> > + "}\n";
> > +
> > +#include "piglit-matrix.h"
> > +
> > +GLint tex_program;
> > +
> > +#endif
> > +
> > static void
> > display_mipmaps(int start_x, int start_y)
> > {
> > int i;
> >
> > +#ifdef PIGLIT_USE_OPENGL
> > glEnable(GL_TEXTURE_2D);
> > +#endif
> >
> > /* Disply all the mipmap levels */
> > for (i = SIZE; i > 0; i /= 2) {
> > @@ -144,5 +181,16 @@ piglit_init(int argc, char **argv)
> > {
> > piglit_require_extension("GL_EXT_texture_compression_s3tc")
> > ;
> >
> > +#ifdef PIGLIT_USE_OPENGL
> > +
> > piglit_ortho_projection(piglit_width, piglit_height,
> > GL_FALSE);
> > +
> > +#else // PIGLIT_USE_OPENGL_ES2
> > +
> > + tex_program = piglit_build_simple_program(vs_source,
> > fs_source);
> > + glUseProgram(tex_program);
> > + GLint proj_loc = glGetUniformLocation(tex_program, "proj");
> > + piglit_ortho_uniform(proj_loc, piglit_width,
> > piglit_height);
> > +
> > +#endif
> > }
> > --
> > 2.17.2
> >
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list