From patchwork Sat Jun 6 14:09:10 2015 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: 49601 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97072245C8 for ; Sat, 6 Jun 2015 14:11:47 +0000 (UTC) Received: by wgez8 with SMTP id z8sf23537637wge.2 for ; Sat, 06 Jun 2015 07:11:46 -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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:reply-to; bh=TNY8U419E0U4aHFYc6laJkgkNR9RDTshE3xXYS0naF4=; b=fREH+2xoeoBWhmMvV4CBPayn65/io3ud1uAlXXVbHCFb35Ulj1R0EO0HxwHPD1DIPI UVMiBdeOm3ripNS7A+jBYynomG/YzjVyabn35ptRk3uQJcpCBV3KeKAKb6rghllePSZu vVyIzgTn/oNmHqj0B1D+gSUfKLPxP9qmlo16u30gn9TyzumsaD7vCj9ARauYXSdjuHyJ kjuCXCHcmEb7B6+u1gEFZ5g3EWbZk0BWodQujcY33A7e4gb5Mdpr3X71lHAq7lZqjtBJ JOMTAIr0aL0N1NLqoEqwqM1DDwHsxK6f8NuLnZ0cA1sOICNgdjftA9Gyc2UKia1IfWSl HJ1w== X-Gm-Message-State: ALoCoQmPZkeZUkFC1hg4/G0jRibzJ+kvWMLTTMQQiQqCzpuitkdr16dfptmFp1olYU/Et8nmZN8D X-Received: by 10.180.36.172 with SMTP id r12mr3506471wij.6.1433599906938; Sat, 06 Jun 2015 07:11:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.36 with SMTP id g4ls508164lah.33.gmail; Sat, 06 Jun 2015 07:11:46 -0700 (PDT) X-Received: by 10.112.213.108 with SMTP id nr12mr8119548lbc.42.1433599906802; Sat, 06 Jun 2015 07:11:46 -0700 (PDT) Received: from mail-lb0-x231.google.com (mail-lb0-x231.google.com. [2a00:1450:4010:c04::231]) by mx.google.com with ESMTPS id dj9si7502926lac.131.2015.06.06.07.11.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Jun 2015 07:11:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::231 as permitted sender) client-ip=2a00:1450:4010:c04::231; Received: by lbcmx3 with SMTP id mx3so59944645lbc.1 for ; Sat, 06 Jun 2015 07:11:46 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr8021466lae.19.1433599906597; Sat, 06 Jun 2015 07:11: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.112.108.230 with SMTP id hn6csp612564lbb; Sat, 6 Jun 2015 07:11:44 -0700 (PDT) X-Received: by 10.68.133.131 with SMTP id pc3mr14282292pbb.107.1433599904280; Sat, 06 Jun 2015 07:11:44 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id w10si15270930pas.70.2015.06.06.07.11.43; Sat, 06 Jun 2015 07:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of piglit-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E518E6E18D; Sat, 6 Jun 2015 07:11:42 -0700 (PDT) X-Original-To: piglit@lists.freedesktop.org Delivered-To: piglit@lists.freedesktop.org Received: from nm2-vm6.bullet.mail.gq1.yahoo.com (nm2-vm6.bullet.mail.gq1.yahoo.com [98.136.218.133]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CCC86E18D for ; Sat, 6 Jun 2015 07:11:41 -0700 (PDT) Received: from [216.39.60.183] by nm2.bullet.mail.gq1.yahoo.com with NNFMP; 06 Jun 2015 14:11:40 -0000 Received: from [208.71.42.193] by tm19.bullet.mail.gq1.yahoo.com with NNFMP; 06 Jun 2015 14:11:40 -0000 Received: from [127.0.0.1] by smtp204.mail.gq1.yahoo.com with NNFMP; 06 Jun 2015 14:11:40 -0000 X-Yahoo-Newman-Id: 481307.26856.bm@smtp204.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 7t1VaRQVM1mC.82LUW_G7mRrFrfRfLx8K1IVFPwtMkS8nkx KKZWy8wQFH4UJDvzGC.hpsI2YHON_MZxwMlB5dp5EhB97P7Zk22tHjy7PNJ9 1nlYGAlOJwZVw_FDRIWyKRBe7_YsPQfxnN0pZDack9NgbXtulLtIrP3wz0cx IhAgTcapqFbF_VCT7r43LMcYHQtXzkC1iucx4BGuljNRgCYxQpyvtvH3hUQy 2midce1a3ZCUgNtuYkWrPQh.rOsok27kqC4CKmWgBnVUOXRmN3INiy8OU60r AFPvA_dRumXWIT7_uD0A7FjI9AU2Jm18HqOpBP_pwI0SY6B73U9pTyom6iY_ QtnUtUOxRCtTq4OezlBjFuNQdTVLHl7vw.tojJPCqGzfgdg9VP7Ie_wrsQOV VLK.wN0wxPKGqI.9kPlDdgw7uoLeO7E57gbwXW9D71eW1qrHhJ6u06LEBPVW iXqkYc5nupMKF92r_9iM0QlpGVBB0QgOJYaWn.SAIQdgrsawsIEvEmSAafaj vyp1mg9y4YaDUBRUdTyZmJ1Ghq95Sl7KO8mo- X-Yahoo-SMTP: 9BNlx.aswBAkr0D8mG_whiOP1dyU From: "'Timothy Arceri' via Patchwork Forward" To: piglit@lists.freedesktop.org Date: Sun, 7 Jun 2015 00:09:10 +1000 Message-Id: <1433599750-10737-1-git-send-email-t_arceri@yahoo.com.au> X-Mailer: git-send-email 2.1.0 Subject: [Piglit] [PATCH] arb_arrays_of_arrays: add some sampler tests X-BeenThere: piglit@lists.freedesktop.org X-Mailman-Version: 2.1.18 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 2a00:1450:4010:c04::231 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@yahoo.com.au; 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 Test results: Nvidia GeForce 840M - NVIDIA 346.47 sampler-precision-qualifier.frag - pass fs-const-index-three-dimensions.shader_test - pass fs-const-index.shader_test - pass fs-initializer-const-index.shader_test - fail fs-initializer-non-const-index.shader_test - fail fs-mixed-const-and-non-const-index.shader_test - pass fs-mixed-const-and-non-const-index2.shader_test - fail fs-non-const-index.shader_test - pass fs-struct-const-index.shader_test - pass --- .../compiler/sampler-precision-qualifier.frag | 19 ++++++ .../fs-const-index-three-dimensions.shader_test | 32 +++++++++ .../execution/sampler/fs-const-index.shader_test | 32 +++++++++ .../sampler/fs-initializer-const-index.shader_test | 47 +++++++++++++ .../fs-initializer-non-const-index.shader_test | 79 ++++++++++++++++++++++ .../fs-mixed-const-and-non-const-index.shader_test | 60 ++++++++++++++++ ...fs-mixed-const-and-non-const-index2.shader_test | 67 ++++++++++++++++++ .../sampler/fs-non-const-index.shader_test | 75 ++++++++++++++++++++ .../sampler/fs-struct-const-index.shader_test | 34 ++++++++++ 9 files changed, 445 insertions(+) create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/sampler-precision-qualifier.frag create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index2.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test diff --git a/tests/spec/arb_arrays_of_arrays/compiler/sampler-precision-qualifier.frag b/tests/spec/arb_arrays_of_arrays/compiler/sampler-precision-qualifier.frag new file mode 100644 index 0000000..687550a --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/compiler/sampler-precision-qualifier.frag @@ -0,0 +1,19 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.30 + * require_extensions: GL_ARB_arrays_of_arrays + * [end config] + * + * Precision qualifiers apply to floating point, integer and sampler + * types. Test to see if and array of samplers correctly compiles. + */ +#version 130 +#extension GL_ARB_arrays_of_arrays: enable + +uniform lowp sampler2D sampler[1][1]; +in highp vec2 coord; + +void main() +{ + gl_FragColor = texture2D(sampler[0][0], coord); +} diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test new file mode 100644 index 0000000..2972fa3 --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test @@ -0,0 +1,32 @@ +[require] +GLSL >= 1.20 +GL_ARB_arrays_of_arrays + +[vertex shader] +#extension GL_ARB_arrays_of_arrays: enable +varying vec4 texcoords; + +void main() +{ + gl_Position = gl_Vertex; + texcoords = (gl_Vertex + 1.0) / 2.0; +} + +[fragment shader] +#extension GL_ARB_arrays_of_arrays: enable +varying vec4 texcoords; +uniform sampler2D tex[2][2][2]; + +void main() +{ + gl_FragColor = texture2D(tex[1][0][1], texcoords.xy); +} + +[test] +uniform int tex[1][0][1] 1 +texture rgbw 1 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0) diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test new file mode 100644 index 0000000..b323ae9 --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test @@ -0,0 +1,32 @@ +[require] +GLSL >= 1.20 +GL_ARB_arrays_of_arrays + +[vertex shader] +#extension GL_ARB_arrays_of_arrays: enable +varying vec4 texcoords; + +void main() +{ + gl_Position = gl_Vertex; + texcoords = (gl_Vertex + 1.0) / 2.0; +} + +[fragment shader] +#extension GL_ARB_arrays_of_arrays: enable +varying vec4 texcoords; +uniform sampler2D tex[2][2]; + +void main() +{ + gl_FragColor = texture2D(tex[0][1], texcoords.xy); +} + +[test] +uniform int tex[0][1] 1 +texture rgbw 1 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0) diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test new file mode 100644 index 0000000..9ed59dd --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test @@ -0,0 +1,47 @@ +# Normally, uniform array variables are initialized by array literals. +# +# However, samplers are different. Consider a declaration such as: +# +# layout(binding = 5) uniform sampler2D[3]; +# +# The initializer value is a single integer (5), while the storage has 3 +# array elements. The proper behavior is to increment one for each +# element; they should be initialized to 5, 6, and 7. + +[require] +GLSL >= 1.40 +GL_ARB_arrays_of_arrays +GL_ARB_shading_language_420pack + +[vertex shader] +#extension GL_ARB_arrays_of_arrays: enable +in vec4 piglit_vertex; +out vec4 texcoords; + +void main() +{ + gl_Position = piglit_vertex; + texcoords = (piglit_vertex + 1.0) / 2.0; +} + +[fragment shader] +#extension GL_ARB_arrays_of_arrays: enable +#extension GL_ARB_shading_language_420pack: enable + +layout(binding = 0) uniform sampler2D tex[2][2][2]; + +in vec4 texcoords; +out vec4 color; + +void main() +{ + color = texture2D(tex[0][1][1], texcoords.xy); +} + +[test] +texture rgbw 3 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0) diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test new file mode 100644 index 0000000..cb714a8 --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test @@ -0,0 +1,79 @@ +# Normally, uniform array variables are initialized by array literals. +# +# However, samplers are different. Consider a declaration such as: +# +# layout(binding = 5) uniform sampler2D[3]; +# +# The initializer value is a single integer (5), while the storage has 3 +# array elements. The proper behavior is to increment one for each +# element; they should be initialized to 5, 6, and 7. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 +GL_ARB_arrays_of_arrays +GL_ARB_shading_language_420pack + +[vertex shader passthrough] + +[fragment shader] +#version 150 +#extension GL_ARB_shading_language_420pack : enable +#extension GL_ARB_gpu_shader5: require +#extension GL_ARB_arrays_of_arrays: enable + +layout(binding = 0) uniform sampler2D tex[2][2]; + +uniform int n; +uniform int m; + +out vec4 color; + +void main() +{ + color = texture(tex[n][m], vec2(0.5, 0.5)); +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +texture checkerboard 0 0 (32, 32) (1.0, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 1 0 (32, 32) (0.0, 1.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 2 0 (32, 32) (0.0, 0.0, 1.0, 0.0) (0.0, 0.0, 1.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 3 0 (32, 32) (1.0, 1.0, 1.0, 1.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 0 +uniform int m 0 +draw rect -1 -1 1 1 + +relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0) + +uniform int n 0 +uniform int m 1 +draw rect 0 -1 1 1 + +relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0) + +uniform int n 1 +uniform int m 0 +draw rect -1 0 1 1 + +relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0) + +uniform int n 1 +uniform int m 1 +draw rect 0 0 1 1 + +relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0) diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index.shader_test new file mode 100644 index 0000000..097d7b6 --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index.shader_test @@ -0,0 +1,60 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the fragment shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 +GL_ARB_arrays_of_arrays + +[vertex shader passthrough] + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require +#extension GL_ARB_arrays_of_arrays: enable + +uniform sampler2D s[2][2]; + +uniform int n; + +out vec4 color; + +void main() +{ + color = texture(s[n][1], vec2(0.5, 0.5)); +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0][0] 0 +uniform int s[0][1] 1 +uniform int s[1][0] 2 +uniform int s[1][1] 3 + +texture checkerboard 0 0 (32, 32) (1.0, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 1 0 (32, 32) (0.0, 1.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 2 0 (32, 32) (0.0, 0.0, 1.0, 0.0) (0.0, 0.0, 1.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 3 0 (32, 32) (1.0, 1.0, 1.0, 1.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 0 +draw rect 0 -1 1 1 + +relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0) + +uniform int n 1 +draw rect 0 0 1 1 + +relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0) diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index2.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index2.shader_test new file mode 100644 index 0000000..782fc6c --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index2.shader_test @@ -0,0 +1,67 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the fragment shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 +GL_ARB_arrays_of_arrays + +[vertex shader passthrough] + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require +#extension GL_ARB_arrays_of_arrays: enable + +uniform sampler2D s[2][2]; + +uniform int n; + +out vec4 color; + +void main() +{ + color = texture(s[1][n], vec2(0.5, 0.5)); +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0][0] 0 +uniform int s[0][1] 1 +uniform int s[1][0] 2 +uniform int s[1][1] 3 + +texture checkerboard 0 0 (32, 32) (1.0, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 1 0 (32, 32) (0.0, 1.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 2 0 (32, 32) (0.0, 0.0, 1.0, 0.0) (0.0, 0.0, 1.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 3 0 (32, 32) (1.0, 1.0, 1.0, 1.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 0 +draw rect -1 0 1 1 +# real outcome? +relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0) + +#uniform int n 0 +#draw rect 0 -1 1 1 +#relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0) + +uniform int n 1 +draw rect 0 0 1 1 + +relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0) + + + diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test new file mode 100644 index 0000000..fe1f18e --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test @@ -0,0 +1,75 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the fragment shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 +GL_ARB_arrays_of_arrays + +[vertex shader passthrough] + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require +#extension GL_ARB_arrays_of_arrays: enable + +uniform sampler2D s[2][2]; + +uniform int n; +uniform int m; + +out vec4 color; + +void main() +{ + color = texture(s[n][m], vec2(0.5, 0.5)); +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0][0] 0 +uniform int s[0][1] 1 +uniform int s[1][0] 2 +uniform int s[1][1] 3 + +texture checkerboard 0 0 (32, 32) (1.0, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 1 0 (32, 32) (0.0, 1.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 2 0 (32, 32) (0.0, 0.0, 1.0, 0.0) (0.0, 0.0, 1.0, 0.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +texture checkerboard 3 0 (32, 32) (1.0, 1.0, 1.0, 1.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 0 +uniform int m 0 +draw rect -1 -1 1 1 + +relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0) + +uniform int n 0 +uniform int m 1 +draw rect 0 -1 1 1 + +relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0) + +uniform int n 1 +uniform int m 0 +draw rect -1 0 1 1 + +relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0) + +uniform int n 1 +uniform int m 1 +draw rect 0 0 1 1 + +relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0) diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test new file mode 100644 index 0000000..ba8ec8c --- /dev/null +++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +varying vec4 texcoords; + +void main() +{ + gl_Position = gl_Vertex; + texcoords = (gl_Vertex + 1.0) / 2.0; +} + +[fragment shader] +#extension GL_ARB_arrays_of_arrays: enable +varying vec4 texcoords; +struct S { + sampler2D tex; +}; + +uniform S i[2]; + +void main() +{ + gl_FragColor = texture2D(i[1].tex, texcoords.xy); +} + +[test] +uniform int i[1].tex 1 +texture rgbw 1 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)