From patchwork Fri Jan 11 19:48:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Gall X-Patchwork-Id: 14001 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 85B9923E27 for ; Fri, 11 Jan 2013 19:48:54 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id 1BFADA196FC for ; Fri, 11 Jan 2013 19:48:54 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so1798726vba.41 for ; Fri, 11 Jan 2013 11:48:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=PtMpMiSb2LYU/+R3CLtukhkThEVYvODHW0QSVEy3Qu8=; b=DiuAg8lYj4hfRBWuKd5k1I5PjKG8FKisgmc+MjIkOVoolgSqzL4rpChUTFA55GSf4b 5ob2UnUOzH5u8Mq+VBa2LSd0Za8+UyC4UpcymT7L46mjuReBqcFw33WBbCCofFhDtoaK COAJmrlbmN5TQUI+r9l04JDHAwoBb1/e9PUVafWDy/mUY6jUsFZ2sO3NigJb8f38/XG7 xTcD22ROfBO3YiPuh84DJqiIK4+UgVvl9DtfcQ7pxIjkYY37Ug+yqZbsexOBq7QxJF7n Y4TLeSCbYR3+I1bLHb/MyKz3BVvhsyvZxLCV6HbzNN5BNviroWynNYJ7tjn1vvAstys4 MhMQ== X-Received: by 10.58.74.196 with SMTP id w4mr3317210vev.7.1357933733557; Fri, 11 Jan 2013 11:48:53 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp129040veb; Fri, 11 Jan 2013 11:48:53 -0800 (PST) X-Received: by 10.50.57.200 with SMTP id k8mr316143igq.29.1357933732569; Fri, 11 Jan 2013 11:48:52 -0800 (PST) Received: from mail-ia0-f179.google.com (mail-ia0-f179.google.com [209.85.210.179]) by mx.google.com with ESMTPS id j14si400384iga.11.2013.01.11.11.48.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 11:48:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.179 is neither permitted nor denied by best guess record for domain of tom.gall@linaro.org) client-ip=209.85.210.179; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.179 is neither permitted nor denied by best guess record for domain of tom.gall@linaro.org) smtp.mail=tom.gall@linaro.org Received: by mail-ia0-f179.google.com with SMTP id i9so1579619iad.38 for ; Fri, 11 Jan 2013 11:48:52 -0800 (PST) X-Received: by 10.50.40.135 with SMTP id x7mr241258igk.79.1357933732310; Fri, 11 Jan 2013 11:48:52 -0800 (PST) Received: from localhost.localdomain ([70.35.96.184]) by mx.google.com with ESMTPS id ex10sm276081igc.15.2013.01.11.11.48.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 11:48:50 -0800 (PST) From: Tom Gall To: patches@linaro.org Cc: Tom Gall Subject: [PATCH 2/3] shader_runner: add gles2 support Date: Fri, 11 Jan 2013 13:48:39 -0600 Message-Id: <1357933720-23420-2-git-send-email-tom.gall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1357933720-23420-1-git-send-email-tom.gall@linaro.org> References: <1357933720-23420-1-git-send-email-tom.gall@linaro.org> X-Gm-Message-State: ALoCoQkJ5ThPZc4j0obs6xlcPOA0fUqjE4Td3T7nKMO5nlTlUypDoRntaByfK7Ag7lIbETHseXqw Add a number of GLES2 specific workarounds to shader_runner_gles_workarounds.h. Add CMakeLists.gles2 into shaders directory so that shader_runner is build when gles2 is selected. Add piglit-vbo.cpp to util/CMakeLists.gles2.txt. In tests/util/piglit-vbo.cpp add one small ifdef PIGLIT_USE_OPENGL_ES2, vertex_attrib_description::setup so the data_type GL_INTEGER for attributes is prevented from use and emits an error message. Reviewed-by: Chad Versace Signed-off-by: Tom Gall --- tests/shaders/CMakeLists.gles2.txt | 7 ++++ tests/shaders/shader_runner_gles_workarounds.h | 52 ++++++++++++++++++++++-- tests/util/CMakeLists.gles2.txt | 1 + tests/util/piglit-vbo.cpp | 4 ++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 tests/shaders/CMakeLists.gles2.txt diff --git a/tests/shaders/CMakeLists.gles2.txt b/tests/shaders/CMakeLists.gles2.txt new file mode 100644 index 0000000..2fde3e3 --- /dev/null +++ b/tests/shaders/CMakeLists.gles2.txt @@ -0,0 +1,7 @@ +link_libraries( + piglitutil_${piglit_target_api} +) + +piglit_add_executable(shader_runner_gles2 shader_runner.c) + +# vim: ft=cmake: diff --git a/tests/shaders/shader_runner_gles_workarounds.h b/tests/shaders/shader_runner_gles_workarounds.h index 5afd540..161f985 100644 --- a/tests/shaders/shader_runner_gles_workarounds.h +++ b/tests/shaders/shader_runner_gles_workarounds.h @@ -23,9 +23,9 @@ /** * \file - * \brief Workarounds for building with GLES. + * \brief Workarounds for building with GLES2 and GLES3. * - * When building shader_runner against GLES3 and libpiglitutil_gles3, there + * When building shader_runner against GLESX and libpiglitutil_glesX, there * are many macros and symbols that are not defined. This header defines such * macros to have the same value found in , and defines such * functions to print an error message and then report PIGLIT_SKIP, just as @@ -64,6 +64,26 @@ #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_WRITE_ONLY 0x88B9 +#if defined(PIGLIT_USE_OPENGL_ES2) +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_3D 0x806F +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_RED 0x1903 +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_INVALID_INDEX 0xFFFFFFFFu +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS GL_MAX_FRAGMENT_UNIFORM_VECTORS +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS GL_MAX_VERTEX_UNIFORM_VECTORS +#endif /*PIGLIT_USE_OPENGL_ES2 */ + static void #if defined(__GNUC__) __attribute__((unused)) @@ -88,7 +108,7 @@ unsupported_function(const char *name) return_value; \ }) -#if defined(PIGLIT_USE_OPENGL_ES3) +#if defined(PIGLIT_USE_OPENGL_ES3) || defined(PIGLIT_USE_OPENGL_ES2) #define piglit_frustum_projection(...) UNSUPPORTED_FUNCTION(piglit_frustum_projection, 0) #define piglit_gen_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_gen_ortho_projection, 0) @@ -104,6 +124,28 @@ unsupported_function(const char *name) #define glProgramLocalParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0) #define glShadeModel(...) UNSUPPORTED_FUNCTION(glShadeModel, 0) +#if defined(PIGLIT_USE_OPENGL_ES2) +#define glMapBuffer(...) UNSUPPORTED_FUNCTION(glMapBuffer, 0) +#define glUnmapBuffer(...) UNSUPPORTED_FUNCTION(glUnmapBuffer, 0) +#define glUniform1ui(...) UNSUPPORTED_FUNCTION(glUniform1ui, 0) +#define glUniform2uiv(...) UNSUPPORTED_FUNCTION(glUniform2uiv, 0) +#define glUniform3uiv(...) UNSUPPORTED_FUNCTION(glUniform3uiv, 0) +#define glUniform4uiv(...) UNSUPPORTED_FUNCTION(glUniform4uiv, 0) +#define glUniformMatrix2x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x3fv, 0) +#define glUniformMatrix2x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x4fv, 0) +#define glUniformMatrix3x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x2fv, 0) +#define glUniformMatrix3x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x4fv, 0) +#define glUniformMatrix4x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x2fv, 0) +#define glUniformMatrix4x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x3fv, 0) +#define glDrawArraysInstanced(...) UNSUPPORTED_FUNCTION(glDrawArrayInstanced, 0) +#define glGetActiveUniformBlockiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformBlockiv, 0) +#define glBindBufferBase(...) UNSUPPORTED_FUNCTION(glBindBufferiBase, 0) +#define glGetUniformIndices(...) UNSUPPORTED_FUNCTION(glGetUniformIndices, 0) +#define glGetActiveUniformsiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformsiv, 0) +#define glGenVertexArrays(...) UNSUPPORTED_FUNCTION(glGenVertexArrays, 0) +#define glBindVertexArray(...) UNSUPPORTED_FUNCTION(glBindVertexArray, 0) +#endif /* PIGLIT_USE_OPENGL_ES2 */ + #define glBindProgramARB(a, b) \ /* Custom definition to suppress unused-variable warnings. */ \ ({ \ @@ -122,6 +164,7 @@ unsupported_function(const char *name) unsupported_function("glVertexPointer"); \ }) +#if defined(PIGLIT_USE_OPENGL_ES3) static GLvoid* glMapBuffer(GLenum target, GLbitfield access) { @@ -135,5 +178,6 @@ glMapBuffer(GLenum target, GLbitfield access) return glMapBufferRange(target, 0, length, access); } +#endif /* PIGLIT_USE_OPENGL_ES3 */ -#endif /*PIGLIT_USE_OPENGL*/ +#endif /* PIGLIT_USE_OPENGL_ES3 || PIGLIT_USE_OPENGL_ES2 */ diff --git a/tests/util/CMakeLists.gles2.txt b/tests/util/CMakeLists.gles2.txt index 3df0f6b..b76d410 100644 --- a/tests/util/CMakeLists.gles2.txt +++ b/tests/util/CMakeLists.gles2.txt @@ -1,5 +1,6 @@ set(UTIL_GL_SOURCES ${UTIL_GL_SOURCES} + piglit-vbo.cpp piglit-shader.c piglit-shader-gles2.c piglit-util-gl-enum.c diff --git a/tests/util/piglit-vbo.cpp b/tests/util/piglit-vbo.cpp index f4fd890..4900931 100644 --- a/tests/util/piglit-vbo.cpp +++ b/tests/util/piglit-vbo.cpp @@ -286,9 +286,13 @@ vertex_attrib_description::setup(size_t *offset, size_t stride) const this->data_type, GL_FALSE, stride, (void *) *offset); } else { +#if defined(PIGLIT_USE_OPENGL_ES2) + fprintf(stderr,"vertex_attrib_description fail. no int support\n"); +#else glVertexAttribIPointer(this->index, this->count, this->data_type, stride, (void *) *offset); +#endif } glEnableVertexAttribArray(index); *offset += ATTRIBUTE_SIZE * this->count;