From patchwork Fri Apr 26 21:53:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Gall X-Patchwork-Id: 16453 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f200.google.com (mail-gg0-f200.google.com [209.85.161.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B6252397A for ; Fri, 26 Apr 2013 21:55:46 +0000 (UTC) Received: by mail-gg0-f200.google.com with SMTP id w6sf6675115ggk.3 for ; Fri, 26 Apr 2013 14:54:49 -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=BnhznhvfcZF/WRG68Vi0/f/BR1WCBNjF7iSRxBAJzI8=; b=HJqVnCHiMarV0b8EtCsJZcBkS643+tRwNtbc0K+eMsl+o44JaW8yHSO+ZHq89J7HNe vJPhWLoep78YMLKi78MM8sRvpupauPaw+TXnKtz55CRiyxQzx0/nhxZhaezWigOWHSG9 3yurnKYEZuM+EsOV0i1T7i39O6f+AER+zsx81pujDIhOTl+vNkBses5R9SUNOUHbFU8U 7PzDg5IHk9zNBuLHfGNaxvR1IhjR1cMeGDsnN3KWlSQSMDdKQhyxPJVl8oPnfmGrcG9w wgp8hT+OSv7KLTz4Csr+eO4xxw1Lktd8gAeEkZmr8q1/mwh6BX0yLmEMBrcBBncO+C7R eWJg== X-Received: by 10.236.111.106 with SMTP id v70mr22977973yhg.34.1367013289840; Fri, 26 Apr 2013 14:54:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.25.162 with SMTP id d2ls2001581qeg.24.gmail; Fri, 26 Apr 2013 14:54:49 -0700 (PDT) X-Received: by 10.52.18.173 with SMTP id x13mr16185493vdd.121.1367013289621; Fri, 26 Apr 2013 14:54:49 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id ij9si6144567vdb.56.2013.04.26.14.54.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 14:54:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id gf12so1987732vcb.8 for ; Fri, 26 Apr 2013 14:54:49 -0700 (PDT) X-Received: by 10.52.228.71 with SMTP id sg7mr24549308vdc.51.1367013289468; Fri, 26 Apr 2013 14:54:49 -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 nf2csp86646veb; Fri, 26 Apr 2013 14:54:49 -0700 (PDT) X-Received: by 10.50.49.41 with SMTP id r9mr201449ign.13.1367013288736; Fri, 26 Apr 2013 14:54:48 -0700 (PDT) Received: from mail-ie0-x22d.google.com (mail-ie0-x22d.google.com [2607:f8b0:4001:c03::22d]) by mx.google.com with ESMTPS id uk17si4686555igb.36.2013.04.26.14.54.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 14:54:48 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:4001:c03::22d is neither permitted nor denied by best guess record for domain of tom.gall@linaro.org) client-ip=2607:f8b0:4001:c03::22d; Received: by mail-ie0-f173.google.com with SMTP id k5so5526483iea.4 for ; Fri, 26 Apr 2013 14:54:48 -0700 (PDT) X-Received: by 10.50.154.72 with SMTP id vm8mr3194103igb.1.1367013288459; Fri, 26 Apr 2013 14:54:48 -0700 (PDT) Received: from localhost.localdomain ([70.35.96.184]) by mx.google.com with ESMTPSA id s16sm5043264ign.4.2013.04.26.14.54.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 14:54:47 -0700 (PDT) From: Tom Gall To: piglit@lists.freedesktop.org Cc: patches@linaro.org, Tom Gall Subject: [PATCH 10/10] glsl-es-1.00: array length, preinc, predec, var index, attribute, ctor and assign tests Date: Fri, 26 Apr 2013 16:53:44 -0500 Message-Id: <1367013224-21359-10-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: ALoCoQn9I2Go9jFzt4rdKb0BK2GrNpKQx9VcS1BftZRslYAZ6CLvoi57Y8JUls3+Bg3b/zif8zq6 X-Original-Sender: tom.gall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 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 assignment using implicit size, attributes, array constructor tests, array length() fn, array preincrement, array predecrement, and array variable index tests using implicit array sizes. Signed-off-by: Tom Gall --- .../array-assign-implicit-size.vert | 28 ++++++++++++++++ .../array-attribute.vert | 18 +++++++++++ .../array-ctor-mismatched-size.vert | 15 +++++++++ .../structure-and-array-operations/array-ctor.vert | 29 +++++++++++++++++ .../array-length-implicit-size.vert | 21 ++++++++++++ .../array-length-with-argument.vert | 13 ++++++++ .../array-length.vert | 15 +++++++++ .../array-predecrement.vert | 19 +++++++++++ .../array-preincrement.vert | 19 +++++++++++ .../array-variable-index-implicit-size-global.vert | 29 +++++++++++++++++ .../array-variable-index-implicit-size-local.vert | 34 ++++++++++++++++++++ 11 files changed, 240 insertions(+) create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert new file mode 100644 index 0000000..49ae6be --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert @@ -0,0 +1,28 @@ +/* [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" + */ + + +uniform float a[5]; + +void main() +{ + float b[]; + b = a; + + gl_Position = vec4(0); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert new file mode 100644 index 0000000..aef953c --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert @@ -0,0 +1,18 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 30 of the GLSL ES 1.00.17 spec: + * + * "Attribute variables cannot be declared as arrays or structures." + */ + + +attribute vec4 a[2] +uniform int i; + +void main() +{ + gl_Position = a[i]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert new file mode 100644 index 0000000..42dc232 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert @@ -0,0 +1,15 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * Page 41, GLSL ES 1.00.17 spec: + * + * "Semantically, the number of parameters much be of sufficient size + * and correct type to perform the initialization." + */ + + +vec4 a[] = vec4[2](vec4(0.0), vec4(1.0), vec4(2.0)); + +void main() { gl_Position = a[0]; } diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert new file mode 100644 index 0000000..e57e0f6 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert @@ -0,0 +1,29 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.00 + * [end config] + * + * From page 79 of the GLSL ES 1.00.17 spec: + * + * expression: + * assignment_expression + * expression COMMA assignment_expression + * + * constant_expression: + * conditional_expression + * + * ... + * + * init_declarator_list: + * single_declaration + * init_declarator_list COMMA IDENTIFIER + * init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET + * init_declarator_list COMMA IDENTIFIER EQUAL initializer + */ + + +vec4 a[2] = vec4[2](vec4(0.0), vec4(2.0)); +vec4 b[2] = vec4[ ](vec4(0.5), vec4(2.0)); +vec4 c[ ] = vec4[ ](vec4(1.0), vec4(2.0)); + +void main() { gl_Position = a[0] + b[0] + c[0]; } diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert new file mode 100644 index 0000000..847733e --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * Page 24, GLSL ES 1.00 spec: + * + * "The array size must be an integral constant expression (see + * Section 4.3.3 "Integral Constant Expressions") greater than + * zero." + */ + + +void main() +{ + float b[]; + + b[2] = 1.0; // Implicitly size array to have at least 3 elements + + gl_Position = vec4(b.length()); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert new file mode 100644 index 0000000..1767ab7b --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + */ + + +uniform vec4 a[2]; + +void main() +{ + gl_Position = vec4(a.length(5)); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert new file mode 100644 index 0000000..d20bd97 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert @@ -0,0 +1,15 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.00 + * [end config] + * + * The GLSL ES 1.00.17 spec appears to be silent on this. + */ + + +uniform vec4 a[2]; + +void main() +{ + gl_Position = vec4(a.length()); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert new file mode 100644 index 0000000..6b73258 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert @@ -0,0 +1,19 @@ +/* [config] + * expect_result: fail + * glsles_version: 1.00 + * [end config] + * + * From page 48 of the GLSL ES 1.00.17 spec: + * + * "The arithmetic unary operators negate (-), post- and pre-increment + * and decrement (-- and ++) operate on integer or floating point + * values (including vectors and matrices). + */ + + +uniform vec4 a[2]; + +void main() +{ + gl_Position = (--a)[0]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert new file mode 100644 index 0000000..d4c84c3 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert @@ -0,0 +1,19 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.00 + * [end config] + * + * From page 48 of the GLSL ES 1.00.17 spec: + * + * "The arithmetic unary operators negate (-), post- and pre-increment + * and decrement (-- and ++) operate on integer or floating point + * values (including vectors and matrices). + */ + + +uniform vec4 a[2]; + +void main() +{ + gl_Position = (++a)[0]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert new file mode 100644 index 0000000..042dbd3 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert @@ -0,0 +1,29 @@ +/* [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" + */ + + +/* Assume the array is sized in a different compilation unit. + */ +vec4 [] an_array; + +uniform int i; + +void main() +{ + gl_Position = an_array[i]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert new file mode 100644 index 0000000..d24e0ee --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.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" + */ + + +attribute vec4 a; +attribute vec4 b; + +uniform int i; + +void main() +{ + vec4 [] an_array; + + an_array[0] = a; + an_array[1] = vec4(0); + an_array[2] = b; + + gl_Position = an_array[i]; +}