From patchwork Thu Aug 14 21:57:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 'Timothy Arceri' via Patchwork Forward X-Patchwork-Id: 35419 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CCCCF202E4 for ; Thu, 14 Aug 2014 21:57:47 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf8195556oif.9 for ; Thu, 14 Aug 2014 14:57:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :reply-to:content-type:content-transfer-encoding; bh=xzEtvJh9ZUNDrt7AnQlY3WiMTR6JFAEVkkwwdqPnz0U=; b=aO+ESWQvojeJLelncQ3vNHjrpOOLedV5ZY0QGBhecvqkus/pbglxpbmD6qKGkLgoYu YzxbwctL2v45o7SkinyjXfkNEA/l1FV7EcQwwFaaOqawvaV4pDrlDotkFogoTb5rzVX/ inATPmvPLl8TeX1w2cf+lH6AyLETakeHgCipKkulXJUNfpcVdFMug6pj/IpNxHYdAzo8 gw9npc34ZTjl4x2iHNLRLxnZSlVp4JzETgahNXDwqN+QctzLmU8LvVS70unXNUiBpw4C u44f0Dl6tGJfoiySbFA2yZM4KxwL9oWimji+9U37JJS4CdJ6aKQ1KmCiiBwzEX0fYoFz +NJw== X-Gm-Message-State: ALoCoQknHzLNWKqZ5kENZXavgJNjqzCxL+GiMRemwWcleZmM/6ummJm2Ky1BqsLkiTCl9y3ZDsWk X-Received: by 10.43.64.202 with SMTP id xj10mr7378489icb.0.1408053467406; Thu, 14 Aug 2014 14:57:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.99 with SMTP id k90ls1296380qgk.78.gmail; Thu, 14 Aug 2014 14:57:47 -0700 (PDT) X-Received: by 10.224.115.134 with SMTP id i6mr21649164qaq.71.1408053467280; Thu, 14 Aug 2014 14:57:47 -0700 (PDT) Received: from mail-vc0-x22f.google.com (mail-vc0-x22f.google.com [2607:f8b0:400c:c03::22f]) by mx.google.com with ESMTPS id v7si9168127qap.118.2014.08.14.14.57.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Aug 2014 14:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22f as permitted sender) client-ip=2607:f8b0:400c:c03::22f; Received: by mail-vc0-f175.google.com with SMTP id ik5so2171171vcb.34 for ; Thu, 14 Aug 2014 14:57:46 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr4707544vcq.50.1408053466672; Thu, 14 Aug 2014 14:57:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp67145vcb; Thu, 14 Aug 2014 14:57:46 -0700 (PDT) X-Received: by 10.70.94.201 with SMTP id de9mr12847341pdb.103.1408053465583; Thu, 14 Aug 2014 14:57:45 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id w7si5445077pdr.166.2014.08.14.14.57.45 for ; Thu, 14 Aug 2014 14:57:45 -0700 (PDT) Received-SPF: none (google.com: piglit-bounces@lists.freedesktop.org does not designate permitted sender hosts) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C25B76E09B; Thu, 14 Aug 2014 14:57:44 -0700 (PDT) X-Original-To: piglit@lists.freedesktop.org Delivered-To: piglit@lists.freedesktop.org Received: from nm27-vm3.bullet.mail.gq1.yahoo.com (nm27-vm3.bullet.mail.gq1.yahoo.com [98.136.216.146]) by gabe.freedesktop.org (Postfix) with ESMTP id 613796E09B for ; Thu, 14 Aug 2014 14:57:44 -0700 (PDT) Received: from [98.137.12.188] by nm27.bullet.mail.gq1.yahoo.com with NNFMP; 14 Aug 2014 21:57:42 -0000 Received: from [98.136.164.73] by tm9.bullet.mail.gq1.yahoo.com with NNFMP; 14 Aug 2014 21:57:42 -0000 Received: from [127.0.0.1] by smtp235.mail.gq1.yahoo.com with NNFMP; 14 Aug 2014 21:57:42 -0000 X-Yahoo-Newman-Id: 729730.12023.bm@smtp235.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: SqwaNwwVM1lhr3fQ.Olpoos7Fx4WKVnk0G5PiNVbXaU2.gd gZLH9TA6rYf4JVG1pd39ku_wHSa47pGy4I_ckxV5zTvG1u6wcbuVkeK8SwQc Y3i2i9ZVt59lJ7RSKdyZcoXugm2qTDeCLZmAvB9Z4WkxNQmPv4nNWd6qGCsK dlNRLNA9ZvskEW4GIbZjDw_gqWZqnUxaa_IcrGFRywSesdQakcy7OA1El2Ki 4d_D3IHXAf1LX1Hbo.zhklUPvvDidEoN2m.A3IqWc5zulNfk2CXpGpEdNGQQ 9fRGunSBcUmb6WuRDGxDL5W1CAwnpprciQRGgtHZFyoZOq_0udezxtlONmrl VkCju7cOZjNj4oF8XbOgQeVv5AqeoRM_Vg2QhM2CI0r4rs6mifeMU7yoS4e3 YziwSu3pIQZPoPNY_jsqXDFqCwiOjuoBqJlZ.UubcOzr565E.Yi139r3wC.0 zo0cGWtbUq24S2rF0x6KP40ABelyFf.0H.qJ5raC6Q4VkmyUju828RJYfimc BqOAA.cd74bfkon0vtt3pVQh4LajVgwZeTvJgy0UjP2GDGXvkVWAJCTDjm2I 13hzo X-Yahoo-SMTP: 9BNlx.aswBAkr0D8mG_whiOP1dyU From: "'Timothy Arceri' via Patchwork Forward" To: piglit@lists.freedesktop.org Date: Fri, 15 Aug 2014 07:57:24 +1000 Message-Id: <1408053444-10012-1-git-send-email-t_arceri@yahoo.com.au> X-Mailer: git-send-email 1.9.3 Subject: [Piglit] [PATCH] gl-4.4: Test GL_MAX_VERTEX_ATTRIB_STRIDE X-BeenThere: piglit@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: piglit-bounces@lists.freedesktop.org Sender: "Piglit" X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22f as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=yahoo.com.au Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 X-Original-From: Timothy Arceri Reply-To: Timothy Arceri Signed-off-by: Timothy Arceri --- tests/all.py | 1 + tests/spec/CMakeLists.txt | 1 + tests/spec/gl-4.4/CMakeLists.gl.txt | 14 +++ tests/spec/gl-4.4/CMakeLists.txt | 1 + tests/spec/gl-4.4/gl_max_vertex_attrib_stride.c | 140 ++++++++++++++++++++++++ 5 files changed, 157 insertions(+) create mode 100644 tests/spec/gl-4.4/CMakeLists.gl.txt create mode 100644 tests/spec/gl-4.4/CMakeLists.txt create mode 100644 tests/spec/gl-4.4/gl_max_vertex_attrib_stride.c diff --git a/tests/all.py b/tests/all.py index 4541654..858bec6 100644 --- a/tests/all.py +++ b/tests/all.py @@ -976,6 +976,7 @@ spec['!OpenGL 3.3/required-texture-attachment-formats'] = concurrent_test('gl-3. spec['!OpenGL 4.2/required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 42') spec['!OpenGL 4.2/required-sized-texture-formats'] = concurrent_test('gl-3.0-required-sized-texture-formats 42') spec['!OpenGL 4.2/required-texture-attachment-formats'] = concurrent_test('gl-3.0-required-texture-attachment-formats 42') +spec['!OpenGL 4.4/gl-max-vertex-attrib-stride'] = concurrent_test('gl-4.4-max_vertex_attrib_stride') # Group spec/glsl-es-1.00 spec['glsl-es-1.00'] = {} diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 5148412..a73c4cb 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -93,6 +93,7 @@ add_subdirectory (gl-3.0) add_subdirectory (gl-3.1) add_subdirectory (gl-3.2) add_subdirectory (gl-3.3) +add_subdirectory (gl-4.4) add_subdirectory (gles-2.0) add_subdirectory (gles-3.0) add_subdirectory (glx_arb_create_context) diff --git a/tests/spec/gl-4.4/CMakeLists.gl.txt b/tests/spec/gl-4.4/CMakeLists.gl.txt new file mode 100644 index 0000000..3287f85 --- /dev/null +++ b/tests/spec/gl-4.4/CMakeLists.gl.txt @@ -0,0 +1,14 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (gl-4.4-max_vertex_attrib_stride gl_max_vertex_attrib_stride.c) + +# vim: ft=cmake: diff --git a/tests/spec/gl-4.4/CMakeLists.txt b/tests/spec/gl-4.4/CMakeLists.txt new file mode 100644 index 0000000..4a012b9 --- /dev/null +++ b/tests/spec/gl-4.4/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() \ No newline at end of file diff --git a/tests/spec/gl-4.4/gl_max_vertex_attrib_stride.c b/tests/spec/gl-4.4/gl_max_vertex_attrib_stride.c new file mode 100644 index 0000000..5623b6a --- /dev/null +++ b/tests/spec/gl-4.4/gl_max_vertex_attrib_stride.c @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2014 Timothy Arceri + * + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS + * 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. + */ + +#include "piglit-util-gl.h" +#include "minmax-test.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 44; + +PIGLIT_GL_TEST_CONFIG_END + +static bool check_invalid_stride(char *function) +{ + bool pass = true; + + if (!piglit_check_gl_error(GL_INVALID_VALUE)) { + fprintf(stderr, "GL_INVALID_VALUE should be generated when setting" + " %s stride to value large than MAX_VERTEX_ATTRIB_STRIDE\n", + function); + pass = false; + } + + return pass; +} + +static bool test_stride_to_large_vertex_attribl(GLint stride_max_plus_one) +{ + GLdouble vertices[4][4]; + + glVertexAttribLPointer(0, 4, GL_DOUBLE, stride_max_plus_one, vertices); + + return check_invalid_stride("glVertexAttribLPointer"); +} + +static bool test_stride_to_large_vertex_attribi(GLint stride_max_plus_one) +{ + GLuint vertices[4][4]; + + glVertexAttribIPointer(0, 4, GL_UNSIGNED_INT, + stride_max_plus_one, vertices); + + return check_invalid_stride("glVertexAttribIPointer"); +} + +static bool test_stride_to_large_vertex_attrib(GLint stride_max_plus_one) +{ + GLfloat vertices[4][4]; + + glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, + stride_max_plus_one, vertices); + + return check_invalid_stride("glVertexAttribPointer"); +} + +static bool test_stride_to_large_bind_buffers(GLint stride_max_plus_one) +{ + GLint strides[2]; + GLuint buf[2]; + GLintptr offsets[2] = { 1024, 1024 }; + + glGetIntegerv(GL_MAX_VERTEX_ATTRIB_STRIDE, &strides[0]); + strides[1] = stride_max_plus_one; + + /* Create buffer objects */ + glGenBuffers(2, buf); + glBindBuffer(GL_ARRAY_BUFFER, buf[0]); + glBindBuffer(GL_ARRAY_BUFFER, buf[1]); + + /* Try passing a stride value that is to large */ + glBindVertexBuffers(0, 2, buf, offsets, strides); + + return check_invalid_stride("glBindVertexBuffers"); +} + +static bool test_stride_to_large_bind_buffer(GLint stride_max_plus_one) +{ + GLuint vbo; + + /* Create a buffer object */ + glGenBuffers(1, &vbo); + glBindBuffer(GL_ARRAY_BUFFER, vbo); + + /* Try passing a stride value that is to large */ + glBindVertexBuffer(0, vbo, 1024, stride_max_plus_one); + + return check_invalid_stride("glBindVertexBuffer"); +} + +void piglit_init(int argc, char **argv) +{ + bool pass = true; + GLint stride_max_plus_one; + GLuint vao; + + /* Create and bind a vertex array object, this is needed + for glBindBuffer* tests */ + glGenVertexArrays(1, &vao); + glBindVertexArray(vao); + + glGetIntegerv(GL_MAX_VERTEX_ATTRIB_STRIDE, &stride_max_plus_one); + stride_max_plus_one++; + + piglit_test_min_int(GL_MAX_VERTEX_ATTRIB_STRIDE, 2048); + pass = piglit_minmax_pass; + pass = test_stride_to_large_bind_buffer(stride_max_plus_one) && pass; + pass = test_stride_to_large_bind_buffers(stride_max_plus_one) && pass; + pass = test_stride_to_large_vertex_attrib(stride_max_plus_one) && pass; + pass = test_stride_to_large_vertex_attribi(stride_max_plus_one) && pass; + pass = test_stride_to_large_vertex_attribl(stride_max_plus_one) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_PASS; +}