From patchwork Fri Apr 26 21:53:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Gall X-Patchwork-Id: 16452 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D088B2397A for ; Fri, 26 Apr 2013 21:55:43 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id bs12sf1043227qab.6 for ; Fri, 26 Apr 2013 14:54:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=2oZbiYZAExM0SbwU4AAprkorKnfuiI7ZBI3+uPtly04=; b=SEl/LsTpajlmOBgpoYpPKWto+znI14yDnRSrPw89WBR+T0AipVksEwjmI57/WjRDUk f+jhf0NhsIyJBZTcZYyRa4UDUq+DwJ6oEVUuLp3rPwhNOEQko421DIayX3IK1gu5Uzp8 mY/6W+ts45ukr3stwjc5zmJvElaaanNR6SLvbnXMiO9CnaPHaY9eq6vrGN4AjOF7FeTP EFDleuvMklonFr5JEWohZo421JaU60zmiPGgNlCc+8b/ILglDahIGxVTVhzy+llV2IOr bDFDuqa0GJ8v6LAiz0nsQas4aXtHfdc7q0+4am7N6L0TehhlSFdhivt0lFhSVAzfAKQY CT+A== X-Received: by 10.236.210.114 with SMTP id t78mr14889370yho.29.1367013287490; Fri, 26 Apr 2013 14:54:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.4 with SMTP id 4ls2075279qei.68.gmail; Fri, 26 Apr 2013 14:54:47 -0700 (PDT) X-Received: by 10.221.9.9 with SMTP id ou9mr10405582vcb.15.1367013286986; Fri, 26 Apr 2013 14:54:46 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ec8si6158989vdb.20.2013.04.26.14.54.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 14:54:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ht10so538834vcb.13 for ; Fri, 26 Apr 2013 14:54:46 -0700 (PDT) X-Received: by 10.220.189.9 with SMTP id dc9mr16304580vcb.8.1367013286800; Fri, 26 Apr 2013 14:54:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp86645veb; Fri, 26 Apr 2013 14:54:46 -0700 (PDT) X-Received: by 10.50.41.5 with SMTP id b5mr3048883igl.58.1367013286119; Fri, 26 Apr 2013 14:54:46 -0700 (PDT) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [2607:f8b0:4001:c03::231]) by mx.google.com with ESMTPS id ng9si4705293igb.22.2013.04.26.14.54.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 14:54:46 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:4001:c03::231 is neither permitted nor denied by best guess record for domain of tom.gall@linaro.org) client-ip=2607:f8b0:4001:c03::231; Received: by mail-ie0-f177.google.com with SMTP id 9so5320553iec.8 for ; Fri, 26 Apr 2013 14:54:45 -0700 (PDT) X-Received: by 10.50.55.8 with SMTP id n8mr2961153igp.28.1367013285848; Fri, 26 Apr 2013 14:54:45 -0700 (PDT) Received: from localhost.localdomain ([70.35.96.184]) by mx.google.com with ESMTPSA id s16sm5043264ign.4.2013.04.26.14.54.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 14:54:44 -0700 (PDT) From: Tom Gall To: piglit@lists.freedesktop.org Cc: patches@linaro.org, Tom Gall Subject: [PATCH 09/10] glsl-es-1.00: array fn, array structure and redeclaration tests Date: Fri, 26 Apr 2013 16:53:43 -0500 Message-Id: <1367013224-21359-9-git-send-email-tom.gall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367013224-21359-1-git-send-email-tom.gall@linaro.org> References: <1367013224-21359-1-git-send-email-tom.gall@linaro.org> X-Gm-Message-State: ALoCoQlU0PeKcY5IwG0PoCr/GZJYlwaRGKg9GrQnouesyXL8iwllwMy4RzCezInaStoxmRpT91PU X-Original-Sender: tom.gall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add to tests/spec/glsl-es-1.00/compiler/structure-and-array-operations glslparser tests for array declarations, array of structures and redeclarations. Signed-off-by: Tom Gall --- .../array-of-any-type.vert | 43 ++++++++++++++++++++ ...ay-of-array-function-parameter-declaration.frag | 19 +++++++++ ...ay-of-array-function-parameter-declaration.vert | 19 +++++++++ ...ray-of-array-function-parameter-definition.frag | 22 ++++++++++ ...ray-of-array-function-parameter-definition.vert | 22 ++++++++++ .../array-of-array-structure-field.frag | 21 ++++++++++ .../array-of-array-structure-field.vert | 21 ++++++++++ .../array-of-struct-of-array.vert | 21 ++++++++++ .../array-of-struct.vert | 21 ++++++++++ .../array-redeclaration-01.vert | 36 ++++++++++++++++ .../array-redeclaration-initializer.vert | 33 +++++++++++++++ .../array-redeclaration-too-small.vert | 33 +++++++++++++++ .../array-redeclaration-wrong-base-type.vert | 34 ++++++++++++++++ .../array-shadow-redeclaration.vert | 29 +++++++++++++ 14 files changed, 374 insertions(+) create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-any-type.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.frag create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.frag create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.frag create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct-of-array.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-01.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-initializer.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-too-small.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-wrong-base-type.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-shadow-redeclaration.vert diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-any-type.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-any-type.vert new file mode 100644 index 0000000..35b8a0a --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-any-type.vert @@ -0,0 +1,43 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00.17 spec: + * + * "All basic types and structures can be formed into arrays." + */ + + +uniform float array01[1]; +uniform int array02[1]; +uniform bool array03[1]; +uniform vec2 array04[1]; +uniform vec3 array05[1]; +uniform vec4 array06[1]; +uniform ivec2 array07[1]; +uniform ivec3 array08[1]; +uniform ivec4 array09[1]; +uniform bvec2 array10[1]; +uniform bvec3 array11[1]; +uniform bvec4 array12[1]; +uniform mat2 array13[1]; +uniform mat2x2 array14[1]; +uniform mat2x3 array15[1]; +uniform mat2x4 array16[1]; +uniform mat3 array17[1]; +uniform mat3x2 array18[1]; +uniform mat3x3 array19[1]; +uniform mat3x4 array20[1]; +uniform mat4 array21[1]; +uniform mat4x2 array22[1]; +uniform mat4x3 array23[1]; +uniform mat4x4 array24[1]; +uniform sampler1D array25[1]; +uniform sampler2D array26[1]; +uniform sampler3D array27[1]; +uniform samplerCube array28[1]; +uniform sampler1DShadow array29[1]; +uniform sampler2DShadow array30[1]; + +void main() { gl_Position = vec4(0.0); } diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.frag b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.frag new file mode 100644 index 0000000..5a8c086 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.frag @@ -0,0 +1,19 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00.17 spec: + * + * "Only one-dimensional arrays may be declared." + */ + + +attribute vec4 vert; + +void foo(vec4 [2] x[2]); + +void main() +{ + gl_FragData[0] = vec4(0.0); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.vert new file mode 100644 index 0000000..54e972f --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-declaration.vert @@ -0,0 +1,19 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00.17 spec: + * + * "Only one-dimensional arrays may be declared." + */ + + +attribute vec4 vert; + +void foo(vec4 [2] x[2]); + +void main() +{ + gl_Position = vert; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.frag b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.frag new file mode 100644 index 0000000..4dde84f --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.frag @@ -0,0 +1,22 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00 spec: + * + * "Only one-dimensional arrays may be declared." + */ + + +attribute vec4 vert; + +void foo(vec4 [2] x[2]) +{ + gl_Position = vert; +} + +void main() +{ + gl_FragData[0] = vec4(0.0); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.vert new file mode 100644 index 0000000..b19d95f --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-function-parameter-definition.vert @@ -0,0 +1,22 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00 spec: + * + * "Only one-dimensional arrays may be declared." + */ + + +attribute vec4 vert; + +void foo(vec4 [2] x[2]) +{ + gl_Position = vert; +} + +void main() +{ + gl_Position = vert; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.frag b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.frag new file mode 100644 index 0000000..8cf163f --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.frag @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00 spec: + * + * "Only one-dimensional arrays may be declared." + */ + + +attribute vec4 vert; + +struct S { + vec4 [2] x[2]; +}; + +void main() +{ + gl_FragData[0] = vec4(0.0); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.vert new file mode 100644 index 0000000..cab65c5 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-array-structure-field.vert @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00 spec: + * + * "Only one-dimensional arrays may be declared." + */ + + +attribute vec4 vert; + +struct S { + vec4 [2] x[2]; +}; + +void main() +{ + gl_Position = vert; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct-of-array.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct-of-array.vert new file mode 100644 index 0000000..1036068 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct-of-array.vert @@ -0,0 +1,21 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00.17 spec: + * + * "All basic types and structures can be formed into arrays." + */ + + +struct s { + float x[3]; + int y; +}; + +void main() +{ + s a[2]; + gl_Position = vec4(a.length() + a.x.length()); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct.vert new file mode 100644 index 0000000..19409c0 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-of-struct.vert @@ -0,0 +1,21 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.00 + * [end config] + * + * From page 24 of the GLSL ES 1.00.17 spec: + * + * "All basic types and structures can be formed into arrays." + */ + + +struct s { + float x; + int y; +}; + +void main() +{ + s a[2]; + gl_Position = vec4(a.length()); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-01.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-01.vert new file mode 100644 index 0000000..db0ab6b --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-01.vert @@ -0,0 +1,36 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * Page 24, GLSL ES 1.00.17 spec: + * + * " The array size must be an integral constant expression (see Section 4.3.3 + * "Integral Constant Expressions") greater than zero." + * + * Further Section 10.17 Unsized Array Declarations on page 93 states: + * + * "gl_TexCoord is part of fixed functionality so unsigned arrays should be + * removed for GLSL ES + * + * RESOLUTION: Remove unsized array declarations" + */ + + +float a_function(vec4[6]); + +void main() +{ + vec4 [] an_array; + + an_array[0] = vec4(0); + an_array[1] = vec4(1); + an_array[2] = vec4(2); + an_array[3] = vec4(3); + an_array[4] = vec4(4); + an_array[5] = vec4(5); + + vec4 [6] an_array; + + gl_Position = vec4(a_function(an_array)); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-initializer.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-initializer.vert new file mode 100644 index 0000000..02ad37b --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-initializer.vert @@ -0,0 +1,33 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.00 + * [end config] + * + * Page 24, GLSL ES 1.00.17 spec: + * + * " The array size must be an integral constant expression (see Section 4.3.3 + * "Integral Constant Expressions") greater than zero." + * + * Further Section 10.17 Unsized Array Declarations on page 93 states: + * + * "gl_TexCoord is part of fixed functionality so unsigned arrays should be + * removed for GLSL ES + * + * RESOLUTION: Remove unsized array declarations" + */ + + +float a_function(float[3]); + +void main() +{ + float [] an_array; + + an_array[0] = 0.0; + an_array[1] = 1.0; + an_array[2] = 2.0; + + float [] an_array = float[](2.0, 1.0, 0.0); + + gl_Position = vec4(a_function(an_array)); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-too-small.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-too-small.vert new file mode 100644 index 0000000..6ed8a05 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-too-small.vert @@ -0,0 +1,33 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * Page 24, GLSL ES 1.00.17 spec: + * + * " The array size must be an integral constant expression (see Section 4.3.3 + * "Integral Constant Expressions") greater than zero." + * + * Further Section 10.17 Unsized Array Declarations on page 93 states: + * + * "gl_TexCoord is part of fixed functionality so unsigned arrays should be + * removed for GLSL ES + * + * RESOLUTION: Remove unsized array declarations" + */ + + +float a_function(float[2]); + +void main() +{ + float [] an_array; + + an_array[0] = 0.0; + an_array[1] = 1.0; + an_array[2] = 2.0; + + float [2] an_array; + + gl_Position = vec4(a_function(an_array)); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-wrong-base-type.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-wrong-base-type.vert new file mode 100644 index 0000000..c41b23c --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-redeclaration-wrong-base-type.vert @@ -0,0 +1,34 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * Page 24, GLSL ES 1.00.17 spec: + * + * " The array size must be an integral constant expression (see Section 4.3.3 + * "Integral Constant Expressions") greater than zero." + * + * Further Section 10.17 Unsized Array Declarations on page 93 states: + * + * "gl_TexCoord is part of fixed functionality so unsigned arrays should be + * removed for GLSL ES + * + * RESOLUTION: Remove unsized array declarations" + */ + + +float a_function(float[3]); +float a_function(vec4[3]); + +void main() +{ + float [] an_array; + + an_array[0] = 0.0; + an_array[1] = 1.0; + an_array[2] = 2.0; + + vec4 [3] an_array; + + gl_Position = vec4(a_function(an_array)); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-shadow-redeclaration.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-shadow-redeclaration.vert new file mode 100644 index 0000000..38b1133 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-shadow-redeclaration.vert @@ -0,0 +1,29 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * Page 26 of the GLSL ES 1.00.17 spec: + * + * "Within a compilation unit a variable with the same name cannot + * be re-declared in the same scope. However a nested scope can + * override an outer scope's declaration of a particular variable name." + */ + + +attribute vec4 v; + +void main() +{ + float a[]; + + a[3] = 1.2; // Implicitly size "a" to have 4 elements. + + { + float a[4]; // this declaration shadows the previous + } + + a.length(); // illegal - "a' is not explicitly sized + + gl_Position = v; +}