From patchwork Thu Jun 18 13:28:57 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: 50048 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6F12F228CC for ; Thu, 18 Jun 2015 13:29:40 +0000 (UTC) Received: by wizw5 with SMTP id w5sf21896524wiz.2 for ; Thu, 18 Jun 2015 06:29:39 -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=orSI9R+hPaNfHJPNyHXltepIu95I6qfDpxcbIpyVzmg=; b=W2O4SJwlBhZh5NCy7dR2wF65V9EM5kg2TV1NgXZ/LMfW/ICmfX3T7o5Lo+/M5PuMHF pQ2PIuU/p39Q+LEscZEMM89XBdKP76CUTMpeSeVZ7Hd0Pbus3VXp/oGQto/JnGRMTaHx XxtBNXDlbAj4R+Phls4eR+BehYQZbhmXGfVbNl3LEHW59S5yT895YZ5JZMAa0u0woQUD EvF2nyuo/kpo7trYcvkeEvO3DVBKo44p/kDnR8mTRCnKUHrwZqqCGDUc6yvuhifWUOim HDLC1I0TS9+WZ9CxyY6QFaO+tUbi5w9qycIVZviNDag49lAU+NmG6G8fgZ67QcEGWMqs e0Og== X-Gm-Message-State: ALoCoQnbEB8Ub9o3YJ30wpxcb4Sf9SKVng8QNu8kRTEm0j9d/7ohv3rss5T4P6KKw66k9+FbSvl9 X-Received: by 10.112.14.101 with SMTP id o5mr10210906lbc.3.1434634179703; Thu, 18 Jun 2015 06:29:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.67 with SMTP id da3ls506358lad.49.gmail; Thu, 18 Jun 2015 06:29:39 -0700 (PDT) X-Received: by 10.112.161.197 with SMTP id xu5mr12834669lbb.69.1434634179578; Thu, 18 Jun 2015 06:29:39 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com. [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id p1si6453482lag.52.2015.06.18.06.29.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 06:29:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a; Received: by laka10 with SMTP id a10so54450496lak.0 for ; Thu, 18 Jun 2015 06:29:39 -0700 (PDT) X-Received: by 10.152.179.234 with SMTP id dj10mr6349624lac.73.1434634179458; Thu, 18 Jun 2015 06:29:39 -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 hn6csp1185568lbb; Thu, 18 Jun 2015 06:29:38 -0700 (PDT) X-Received: by 10.70.43.136 with SMTP id w8mr21100378pdl.157.1434634177557; Thu, 18 Jun 2015 06:29:37 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id tu8si11402246pab.6.2015.06.18.06.29.36; Thu, 18 Jun 2015 06:29:37 -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 7269B7A154; Thu, 18 Jun 2015 06:29:36 -0700 (PDT) X-Original-To: piglit@lists.freedesktop.org Delivered-To: piglit@lists.freedesktop.org Received: from nm4-vm6.bullet.mail.gq1.yahoo.com (nm4-vm6.bullet.mail.gq1.yahoo.com [98.136.218.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 613897A154 for ; Thu, 18 Jun 2015 06:29:34 -0700 (PDT) Received: from [98.137.12.57] by nm4.bullet.mail.gq1.yahoo.com with NNFMP; 18 Jun 2015 13:29:33 -0000 Received: from [208.71.42.195] by tm2.bullet.mail.gq1.yahoo.com with NNFMP; 18 Jun 2015 13:29:33 -0000 Received: from [127.0.0.1] by smtp206.mail.gq1.yahoo.com with NNFMP; 18 Jun 2015 13:29:33 -0000 X-Yahoo-Newman-Id: 825884.44628.bm@smtp206.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EMLHKBUVM1mA0.y_x9yeIE_kuF7N.rbkkjDpQpkCAngn4eD U8vrTSNQOLDCDKijb_xPtpQl9ph0xoVlgvawE8Y.6nueWEzlOQwHjJUWdQ7A dI1ubaVilIUdL5NI95oKvSA8luoxaPX7dfE.R6s9Kp7iVjgBeu3cwPA9jDSX 7_9KC5x0J6BeXHIh2z.IMOKBdovA_rMQwcVoX84PPQNWCR1bw0sywjdqp.0R Mz1KDHYhGSNLVGsrV70_9UVidWt.YUcpYaJzJPMMchj6TBsoTxZlLZcxHevS QmES9Qm9NymvC.6caIan_hMPz5yvTqe.Znsc9E5sxPEpA8owHXVKW6ej6LNG rnKpAiz.e.bh1x4ntCQnfK9JvwHkTCpB7xT0i_5N_s3HXmKgSNDVOwV2I7Ug RQ0DAwi0pfrk6v649XlCbLBv7hHDMGaSBjrPzSU1B8e72SOEI3qlR9DH21yT QTGNZxZP6QmQErvj0.EZb2ev9s0yAe1O0OUw00nDDJfFQ1ZXgIetcxJ3DEWr RwPJ9WrlB93d2NBVf0bNsnxh45ibN X-Yahoo-SMTP: 9BNlx.aswBAkr0D8mG_whiOP1dyU From: "'Timothy Arceri' via Patchwork Forward" To: piglit@lists.freedesktop.org Date: Thu, 18 Jun 2015 23:28:57 +1000 Message-Id: <1434634137-4135-1-git-send-email-t_arceri@yahoo.com.au> X-Mailer: git-send-email 2.1.0 Subject: [Piglit] [PATCH] arb_gpu_shader5: test indexing of samplers inside structs 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:c03::22a 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 fragment shader tests already exist, this adds vertex and geometry tests for completeness. Test results: Nvidia GeForce 840M - NVIDIA 346.47: pass Cc: Ilia Mirkin --- .../gs-struct-nonconst-sampler-const.shader_test | 91 ++++++++++++++++++++ ...gs-struct-nonconst-sampler-nonconst.shader_test | 96 ++++++++++++++++++++++ .../gs-struct-nonconst.shader_test | 91 ++++++++++++++++++++ .../vs-struct-nonconst-sampler-const.shader_test | 84 +++++++++++++++++++ ...vs-struct-nonconst-sampler-nonconst.shader_test | 89 ++++++++++++++++++++ .../vs-struct-nonconst.shader_test | 84 +++++++++++++++++++ 6 files changed, 535 insertions(+) create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-const.shader_test create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-nonconst.shader_test create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst.shader_test create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-const.shader_test create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-nonconst.shader_test create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst.shader_test diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-const.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-const.shader_test new file mode 100644 index 0000000..8010d31 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-const.shader_test @@ -0,0 +1,91 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the geometry shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader passthrough] + +[geometry shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +struct S { + sampler2D tex[2]; +}; + +uniform S s[4]; + +uniform int n; + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; +out vec4 color; + +void main() +{ + for (int i = 0; i < 3; i++) { + gl_Position = gl_in[i].gl_Position; + color = texture(s[n].tex[1], vec2(0.75, 0.25)); + EmitVertex(); + } + EndPrimitive(); +} + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0].tex[1] 0 +uniform int s[1].tex[1] 1 +uniform int s[2].tex[1] 2 +uniform int s[3].tex[1] 3 + +texture checkerboard 0 0 (32, 32) (0.5, 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.5, 0.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.5, 0.0, 0.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) (0.5, 0.0, 0.0, 0.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 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 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 2 +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 3 +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_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-nonconst.shader_test new file mode 100644 index 0000000..6f34154 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst-sampler-nonconst.shader_test @@ -0,0 +1,96 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the geometry shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader passthrough] + +[geometry shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +struct S { + sampler2D tex[2]; +}; + +uniform S s[2]; + +uniform int n; +uniform int m; + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; +out vec4 color; + +void main() +{ + for (int i = 0; i < 3; i++) { + gl_Position = gl_in[i].gl_Position; + color = texture(s[n].tex[m], vec2(0.75, 0.25)); + EmitVertex(); + } + EndPrimitive(); +} + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0].tex[0] 0 +uniform int s[0].tex[1] 1 +uniform int s[1].tex[0] 2 +uniform int s[1].tex[1] 3 + +texture checkerboard 0 0 (32, 32) (0.5, 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.5, 0.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.5, 0.0, 0.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) (0.5, 0.0, 0.0, 0.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_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst.shader_test new file mode 100644 index 0000000..a36d295 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/gs-struct-nonconst.shader_test @@ -0,0 +1,91 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the geometry shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader passthrough] + +[geometry shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +struct S { + sampler2D tex; +}; + +uniform S s[4]; + +uniform int n; + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; +out vec4 color; + +void main() +{ + for (int i = 0; i < 3; i++) { + gl_Position = gl_in[i].gl_Position; + color = texture(s[n].tex, vec2(0.75, 0.25)); + EmitVertex(); + } + EndPrimitive(); +} + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0].tex 0 +uniform int s[1].tex 1 +uniform int s[2].tex 2 +uniform int s[3].tex 3 + +texture checkerboard 0 0 (32, 32) (0.5, 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.5, 0.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.5, 0.0, 0.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) (0.5, 0.0, 0.0, 0.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 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 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 2 +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 3 +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_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-const.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-const.shader_test new file mode 100644 index 0000000..9588b25 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-const.shader_test @@ -0,0 +1,84 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the vertex shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +struct S { + sampler2D tex[2]; +}; + +uniform S s[4]; + +uniform int n; + +in vec4 piglit_vertex; +out vec4 color; + +void main() +{ + gl_Position = piglit_vertex; + color = texture(s[n].tex[1], vec2(0.75, 0.25)); +} + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0].tex[1] 0 +uniform int s[1].tex[1] 1 +uniform int s[2].tex[1] 2 +uniform int s[3].tex[1] 3 + +texture checkerboard 0 0 (32, 32) (0.5, 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.5, 0.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.5, 0.0, 0.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) (0.5, 0.0, 0.0, 0.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 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 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 2 +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 3 +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_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-nonconst.shader_test new file mode 100644 index 0000000..57d7961 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst-sampler-nonconst.shader_test @@ -0,0 +1,89 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the vertex shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +struct S { + sampler2D tex[2]; +}; + +uniform S s[2]; + +uniform int n; +uniform int m; + +in vec4 piglit_vertex; +out vec4 color; + +void main() +{ + gl_Position = piglit_vertex; + color = texture(s[n].tex[m], vec2(0.75, 0.25)); +} + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0].tex[0] 0 +uniform int s[0].tex[1] 1 +uniform int s[1].tex[0] 2 +uniform int s[1].tex[1] 3 + +texture checkerboard 0 0 (32, 32) (0.5, 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.5, 0.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.5, 0.0, 0.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) (0.5, 0.0, 0.0, 0.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_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst.shader_test new file mode 100644 index 0000000..7e02cdd --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-struct-nonconst.shader_test @@ -0,0 +1,84 @@ +# This test verifies that dynamically uniform indexing of sampler arrays +# in the vertex shader behaves correctly. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +struct S { + sampler2D tex; +}; + +uniform S s[4]; + +uniform int n; + +in vec4 piglit_vertex; +out vec4 color; + +void main() +{ + gl_Position = piglit_vertex; + color = texture(s[n].tex, vec2(0.75, 0.25)); +} + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +uniform int s[0].tex 0 +uniform int s[1].tex 1 +uniform int s[2].tex 2 +uniform int s[3].tex 3 + +texture checkerboard 0 0 (32, 32) (0.5, 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.5, 0.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.5, 0.0, 0.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) (0.5, 0.0, 0.0, 0.0) (1.0, 1.0, 1.0, 1.0) +texparameter 2D min nearest +texparameter 2D mag nearest + +uniform int n 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 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 2 +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 3 +draw rect 0 0 1 1 + +relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)