From 1efc0ac7400de8e87138b71dc6c46d517e0a3f72 Mon Sep 17 00:00:00 2001 From: Feifan He Date: Mon, 4 Nov 2024 18:54:30 +0800 Subject: [PATCH] tests/shader_runner_metal: Implement draws. --- tests/hlsl/array-size-expr.shader_test | 2 +- tests/hlsl/asfloat.shader_test | 2 +- tests/hlsl/cbuffer.shader_test | 20 +++++++------- tests/hlsl/default-values.shader_test | 8 +++--- tests/hlsl/determinant.shader_test | 6 ++--- tests/hlsl/expr-indexing.shader_test | 4 +-- tests/hlsl/half.shader_test | 2 +- tests/hlsl/majority-pragma.shader_test | 26 +++++++++---------- tests/hlsl/majority-syntax.shader_test | 2 +- tests/hlsl/matrix-indexing.shader_test | 8 +++--- tests/hlsl/nested-arrays.shader_test | 2 +- tests/hlsl/precise-modifier.shader_test | 6 ++--- .../register-reservations-numeric.shader_test | 24 ++++++++--------- tests/hlsl/struct-array.shader_test | 2 +- tests/hlsl/swizzle-matrix.shader_test | 6 ++--- tests/hlsl/swizzles.shader_test | 4 +-- tests/hlsl/uniform-parameters.shader_test | 2 +- tests/hlsl/uniform-semantics.shader_test | 6 ++--- tests/hlsl/vector-indexing.shader_test | 2 +- tests/shader_runner_metal.m | 22 ++++++++++++++-- 20 files changed, 87 insertions(+), 69 deletions(-) diff --git a/tests/hlsl/array-size-expr.shader_test b/tests/hlsl/array-size-expr.shader_test index a9bc390b..e3ce257d 100644 --- a/tests/hlsl/array-size-expr.shader_test +++ b/tests/hlsl/array-size-expr.shader_test @@ -88,5 +88,5 @@ uniform 4 float 0.0 uniform 8 float 0.0 uniform 12 float 0.0 uniform 16 float 42.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (42, 42, 42, 42) diff --git a/tests/hlsl/asfloat.shader_test b/tests/hlsl/asfloat.shader_test index ba73aefc..08f6c693 100644 --- a/tests/hlsl/asfloat.shader_test +++ b/tests/hlsl/asfloat.shader_test @@ -20,7 +20,7 @@ float4 main() : sv_target [test] uniform 0 float4 123.0 -2.0 456 0.01 -todo(msl) draw quad +draw quad probe (320,240) rgba (123.0, -2.0, 456.0, 0.01) [pixel shader] diff --git a/tests/hlsl/cbuffer.shader_test b/tests/hlsl/cbuffer.shader_test index 0b12cd7d..2b7c88a7 100644 --- a/tests/hlsl/cbuffer.shader_test +++ b/tests/hlsl/cbuffer.shader_test @@ -13,7 +13,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) [pixel shader fail(sm>=6)] @@ -61,7 +61,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) [pixel shader fail(sm>=6)] @@ -83,7 +83,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) [pixel shader] @@ -97,7 +97,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) [pixel shader fail] @@ -150,7 +150,7 @@ uniform 0 float4 0.0 1.0 2.0 3.0 uniform 4 float4 4.0 5.0 6.0 7.0 uniform 8 float4 8.0 9.0 10.0 11.0 uniform 12 float4 12.0 13.0 14.0 15.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.0, 2.0, 4.0, 8.0) @@ -171,7 +171,7 @@ float4 main() : sv_target uniform 0 float4 0.0 1.0 2.0 3.0 uniform 4 float4 4.0 5.0 6.0 7.0 uniform 8 float4 8.0 9.0 10.0 11.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.0, 4.0, 8.0, 9.0) @@ -197,7 +197,7 @@ uniform 0 float4 0.0 1.0 2.0 3.0 uniform 4 float4 4.0 5.0 6.0 7.0 uniform 8 float4 8.0 9.0 10.0 11.0 uniform 12 float4 12.0 13.0 14.0 15.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.0, 4.0, 5.0, 6.0) @@ -291,7 +291,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (2.0, 3.0, 2.0, 3.0) @@ -427,7 +427,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (3.0, 4.0, 3.0, 4.0) @@ -767,7 +767,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 0.0 0.0 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) [pixel shader fail(sm<6)] diff --git a/tests/hlsl/default-values.shader_test b/tests/hlsl/default-values.shader_test index 73cd0440..31118fc4 100644 --- a/tests/hlsl/default-values.shader_test +++ b/tests/hlsl/default-values.shader_test @@ -17,7 +17,7 @@ if(sm<4) uniform 8 float4 10 20 0 0 if(sm>=4) uniform 0 float4 10 20 0 0 if(sm>=4) uniform 4 float4 10 30 50 70 if(sm>=4) uniform 8 float4 20 40 60 80 -todo(msl) draw quad +draw quad probe (0, 0) rgba (10, 20, 50, 60) @@ -57,7 +57,7 @@ float4 main() : sv_target { return b; } [test] uniform 0 float4 10.0 20.0 30.0 40.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (10, 20, 30, 40) @@ -134,7 +134,7 @@ if(sm<4) uniform 8 float4 10 20 0 0 if(sm>=4) uniform 0 float4 10 20 0 0 if(sm>=4) uniform 4 float4 10 30 50 70 if(sm>=4) uniform 8 float4 20 40 60 80 -todo(msl) draw quad +draw quad probe (0, 0) rgba (10, 20, 50, 60) @@ -170,7 +170,7 @@ float4 main() : sv_target { return b; } [test] uniform 0 float4 10 20 30 40 -todo(msl) draw quad +draw quad probe (0, 0) rgba (10, 20, 30, 40) diff --git a/tests/hlsl/determinant.shader_test b/tests/hlsl/determinant.shader_test index fbea4271..c0218519 100644 --- a/tests/hlsl/determinant.shader_test +++ b/tests/hlsl/determinant.shader_test @@ -8,7 +8,7 @@ float4 main() : sv_target [test] uniform 0 float4 9.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (9.0, 9.0, 9.0, 9.0) [pixel shader] @@ -21,7 +21,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) [pixel shader] @@ -49,7 +49,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 5.0 6.0 7.0 8.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) [pixel shader] diff --git a/tests/hlsl/expr-indexing.shader_test b/tests/hlsl/expr-indexing.shader_test index d8f59b4b..d3cd90a3 100644 --- a/tests/hlsl/expr-indexing.shader_test +++ b/tests/hlsl/expr-indexing.shader_test @@ -40,7 +40,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (3.0, 3.0, 3.0, 3.0) @@ -78,7 +78,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (4.0, 4.0, 4.0, 4.0) diff --git a/tests/hlsl/half.shader_test b/tests/hlsl/half.shader_test index 67c1a98e..a4f6f5ed 100644 --- a/tests/hlsl/half.shader_test +++ b/tests/hlsl/half.shader_test @@ -19,5 +19,5 @@ float4 main() : sv_target [test] uniform 0 float 10.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (10.0, 10.0, 10.0, 10.0) diff --git a/tests/hlsl/majority-pragma.shader_test b/tests/hlsl/majority-pragma.shader_test index 4f77679f..9b4f6608 100644 --- a/tests/hlsl/majority-pragma.shader_test +++ b/tests/hlsl/majority-pragma.shader_test @@ -40,7 +40,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) @@ -61,7 +61,7 @@ uniform 0 float4 0.0 0.0 0.0 0.0 uniform 4 float4 0.0 0.0 0.0 0.0 uniform 8 float4 0.5 0.6 0.0 0.0 uniform 12 float4 0.7 0.8 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.5, 0.6, 0.7, 0.8) @@ -112,7 +112,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) @@ -150,7 +150,7 @@ uniform 0 float4 0.3 0.4 0.0 0.0 uniform 4 float4 0.0 0.0 0.0 0.0 uniform 8 float4 0.0 0.0 0.0 0.0 uniform 12 float4 0.5 0.6 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.3, 0.4, 0.5, 0.6) @@ -174,7 +174,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) @@ -202,7 +202,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.2 0.4 0.0 0.0 uniform 4 float4 0.3 0.5 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.2, 0.3, 0.4, 0.5) @@ -222,7 +222,7 @@ uniform 0 float4 0.3 0.0 0.0 0.0 uniform 4 float4 0.4 0.0 0.0 0.0 uniform 8 float4 0.0 0.5 0.0 0.0 uniform 12 float4 0.0 0.6 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.3, 0.4, 0.5, 0.6) % Compiler options @@ -246,7 +246,7 @@ uniform 0 float4 0.1 0.5 0.9 1.3 uniform 4 float4 0.2 0.6 1.0 1.4 uniform 8 float4 0.3 0.7 1.1 1.5 uniform 12 float4 0.4 0.8 1.2 1.6 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.2, 0.3, 0.6, 0.7) 1 [require] @@ -268,7 +268,7 @@ uniform 0 float4 0.1 0.5 0.9 1.3 uniform 4 float4 0.2 0.6 1.0 1.4 uniform 8 float4 0.3 0.7 1.1 1.5 uniform 12 float4 0.4 0.8 1.2 1.6 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.2, 0.3, 0.6, 0.7) 1 [require] @@ -290,7 +290,7 @@ uniform 0 float4 0.1 0.5 0.9 1.3 uniform 4 float4 0.2 0.6 1.0 1.4 uniform 8 float4 0.3 0.7 1.1 1.5 uniform 12 float4 0.4 0.8 1.2 1.6 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.5, 0.9, 0.6, 1.0) 1 [require] @@ -318,7 +318,7 @@ uniform 16 float4 1.7 2.1 2.5 2.9 uniform 20 float4 1.8 2.2 2.6 3.0 uniform 24 float4 1.9 2.3 2.7 3.1 uniform 28 float4 2.0 2.4 2.8 3.2 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.3, 0.4, 2.5, 2.9) 1 [require] @@ -346,7 +346,7 @@ uniform 16 float4 1.7 2.1 2.5 2.9 uniform 20 float4 1.8 2.2 2.6 3.0 uniform 24 float4 1.9 2.3 2.7 3.1 uniform 28 float4 2.0 2.4 2.8 3.2 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.2, 1.6, 3.1, 3.2) 1 [require] @@ -366,5 +366,5 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.3, 0.2, 0.4) 1 diff --git a/tests/hlsl/majority-syntax.shader_test b/tests/hlsl/majority-syntax.shader_test index c7c8af4d..b79d4829 100644 --- a/tests/hlsl/majority-syntax.shader_test +++ b/tests/hlsl/majority-syntax.shader_test @@ -11,7 +11,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.3 0.0 0.0 uniform 4 float4 0.2 0.4 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.3, 0.2, 0.4) [pixel shader fail(sm<6)] diff --git a/tests/hlsl/matrix-indexing.shader_test b/tests/hlsl/matrix-indexing.shader_test index 87fe94d2..ac8240d3 100644 --- a/tests/hlsl/matrix-indexing.shader_test +++ b/tests/hlsl/matrix-indexing.shader_test @@ -11,7 +11,7 @@ uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 5.0 6.0 7.0 8.0 uniform 8 float4 9.0 10.0 11.0 12.0 uniform 12 float4 13.0 14.0 15.0 16.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 10.0, 15.0) [pixel shader] @@ -27,7 +27,7 @@ uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 5.0 6.0 7.0 8.0 uniform 8 float4 9.0 10.0 11.0 12.0 uniform 12 float4 13.0 14.0 15.0 16.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 10.0, 15.0) [pixel shader] @@ -43,7 +43,7 @@ uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 5.0 6.0 7.0 8.0 uniform 8 float4 9.0 10.0 11.0 12.0 uniform 12 float4 13.0 14.0 15.0 16.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 5.0, 7.0, 12.0) [pixel shader] @@ -58,7 +58,7 @@ float4 main() : SV_TARGET [test] uniform 0 float4 1.0 2.0 3.0 0.0 uniform 4 float4 5.0 6.0 7.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 3.0, 6.0, 7.0) [pixel shader] diff --git a/tests/hlsl/nested-arrays.shader_test b/tests/hlsl/nested-arrays.shader_test index 963c91a8..871ec4fb 100644 --- a/tests/hlsl/nested-arrays.shader_test +++ b/tests/hlsl/nested-arrays.shader_test @@ -21,5 +21,5 @@ uniform 8 float4 0.3 0.0 0.0 0.0 uniform 12 float4 0.4 0.0 0.0 0.0 uniform 16 float4 0.5 0.0 0.0 0.0 uniform 20 float4 0.6 0.0 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.4, 0.1, 0.6, 0.3) diff --git a/tests/hlsl/precise-modifier.shader_test b/tests/hlsl/precise-modifier.shader_test index ee57ea0e..0758ad0e 100644 --- a/tests/hlsl/precise-modifier.shader_test +++ b/tests/hlsl/precise-modifier.shader_test @@ -9,7 +9,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.3 0.4 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) [pixel shader fail(sm>=6)] @@ -23,7 +23,7 @@ precise main() : sv_target [test] uniform 0 float4 0.1 0.2 0.3 0.4 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) [pixel shader] @@ -37,5 +37,5 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.3 0.4 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) diff --git a/tests/hlsl/register-reservations-numeric.shader_test b/tests/hlsl/register-reservations-numeric.shader_test index a1522931..80985233 100644 --- a/tests/hlsl/register-reservations-numeric.shader_test +++ b/tests/hlsl/register-reservations-numeric.shader_test @@ -56,7 +56,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.2 0.3 0.4 uniform 4 float4 1.1 1.2 1.3 1.4 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.1, 1.4, 0.2, 0.3) @@ -75,7 +75,7 @@ uniform 4 float4 1.1 1.2 1.3 1.4 uniform 8 float4 2.1 2.2 2.3 2.4 uniform 12 float4 3.1 3.2 3.3 3.4 uniform 16 float4 4.1 4.2 4.3 4.4 -todo(msl) draw quad +draw quad probe (0, 0) rgba (4.1, 4.2, 1.3, 1.4) @@ -207,7 +207,7 @@ float4 main() : sv_target [test] uniform 0 float 100 uniform 4 float 101 -todo(msl) draw quad +draw quad probe (0, 0) rgba (100, 100, 100, 100) @@ -221,7 +221,7 @@ float4 main(uniform float a : register(c1)) : sv_target [test] uniform 0 float 100 uniform 4 float 101 -todo(msl) draw quad +draw quad probe (0, 0) rgba (100, 100, 100, 100) [pixel shader] @@ -343,7 +343,7 @@ float4 main() : sv_target [test] uniform 0 float 1.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) [pixel shader] @@ -358,7 +358,7 @@ float4 main() : sv_target [test] uniform 0 float 1.0 uniform 4 float 2.0 -todo(msl) draw quad +draw quad if(sm<6) probe (0, 0) rgba (2.0, 2.0, 2.0, 2.0) if(sm>=6) probe (0, 0) rgba(1.0, 1.0, 1.0, 1.0) @@ -374,7 +374,7 @@ float4 main() : sv_target [test] uniform 0 float 0.0 uniform 4 float 1.0 -todo(msl) draw quad +draw quad if(sm<6) probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) if(sm>=6) probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) @@ -390,7 +390,7 @@ float4 main() : sv_target [test] uniform 0 float 0.0 uniform 4 float 1.0 -todo(msl) draw quad +draw quad if(sm<6) probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) if(sm>=6) probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) @@ -406,7 +406,7 @@ float4 main() : sv_target [test] uniform 0 float 0.0 uniform 4 float 1.0 -todo(msl) draw quad +draw quad if(sm<6) probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) if(sm>=6) probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) @@ -421,7 +421,7 @@ float4 main() : sv_target [test] uniform 4 float 1.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) % Weird FXC behavior. @@ -437,7 +437,7 @@ float4 main() : sv_target [test] uniform 0 float 1.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba(1.0, 1.0, 1.0, 1.0) % Testing other reservation types. This is a parse failure, i.e "X3530: register sa not valid" @@ -477,7 +477,7 @@ float4 main() : sv_target [test] uniform 0 float 0.0 uniform 4 float 2.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0) [require] diff --git a/tests/hlsl/struct-array.shader_test b/tests/hlsl/struct-array.shader_test index 9ca4ea17..b37747ac 100644 --- a/tests/hlsl/struct-array.shader_test +++ b/tests/hlsl/struct-array.shader_test @@ -18,5 +18,5 @@ float4 main() : sv_target uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 uniform 8 float4 0.5 0.6 0.0 0.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (0.2, 0.3, 0.6, 0.5) diff --git a/tests/hlsl/swizzle-matrix.shader_test b/tests/hlsl/swizzle-matrix.shader_test index 43780b69..afdf940f 100644 --- a/tests/hlsl/swizzle-matrix.shader_test +++ b/tests/hlsl/swizzle-matrix.shader_test @@ -9,7 +9,7 @@ float4 main() : sv_target [test] uniform 0 float4 11 21 31 -1 uniform 4 float4 12 22 32 -1 -todo(msl) draw quad +draw quad probe (0, 0) rgba (21.0, 31.0, 11.0, 12.0) @@ -24,7 +24,7 @@ float4 main() : sv_target [test] uniform 0 float4 11 21 31 -1 uniform 4 float4 12 22 32 -1 -todo(msl) draw quad +draw quad probe (0, 0) rgba (11.0, 31.0, 12.0, 32.0) @@ -40,7 +40,7 @@ float4 main() : sv_target uniform 0 float4 11 12 -1 -1 uniform 4 float4 21 22 -1 -1 uniform 8 float4 31 32 -1 -1 -todo(msl) draw quad +draw quad probe (0, 0) rgba (11.0, 31.0, 12.0, 32.0) diff --git a/tests/hlsl/swizzles.shader_test b/tests/hlsl/swizzles.shader_test index f602d39d..5f0161eb 100644 --- a/tests/hlsl/swizzles.shader_test +++ b/tests/hlsl/swizzles.shader_test @@ -149,7 +149,7 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) @@ -166,5 +166,5 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 4.0, 2.0, 3.0) diff --git a/tests/hlsl/uniform-parameters.shader_test b/tests/hlsl/uniform-parameters.shader_test index 465e3c90..f3a63cdd 100644 --- a/tests/hlsl/uniform-parameters.shader_test +++ b/tests/hlsl/uniform-parameters.shader_test @@ -18,7 +18,7 @@ float4 main(uniform float f, uniform int i, uniform uint u, uniform half h) : sv [test] uniform 0 float4 123.0 -2.0 456 0.01 -todo(msl) draw quad +draw quad probe (320,240) rgba (123.0, -2.0, 456.0, 0.01) [pixel shader] diff --git a/tests/hlsl/uniform-semantics.shader_test b/tests/hlsl/uniform-semantics.shader_test index c0cac17a..901fb010 100644 --- a/tests/hlsl/uniform-semantics.shader_test +++ b/tests/hlsl/uniform-semantics.shader_test @@ -10,7 +10,7 @@ float4 main() : sv_target [test] uniform 0 float 3.5 -todo(msl) draw quad +draw quad probe (0, 0) rgba (3.5, 3.5, 3.5, 3.5) @@ -24,7 +24,7 @@ float4 main() : sv_target [test] uniform 0 float4 4.0 5.0 6.0 7.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (4.0, 5.0, 4.0, 5.0) @@ -38,5 +38,5 @@ float4 main() : sv_target [test] uniform 0 float 3.5 -todo(msl) draw quad +draw quad probe (0, 0) rgba (3.5, 3.5, 3.5, 3.5) diff --git a/tests/hlsl/vector-indexing.shader_test b/tests/hlsl/vector-indexing.shader_test index 7ba36c77..24f2217c 100644 --- a/tests/hlsl/vector-indexing.shader_test +++ b/tests/hlsl/vector-indexing.shader_test @@ -23,7 +23,7 @@ float4 main() : SV_TARGET [test] uniform 0 float4 1.0 2.0 3.0 4.0 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1.0, 2.0, 2.0, 3.0) diff --git a/tests/shader_runner_metal.m b/tests/shader_runner_metal.m index 042b4d23..946f9011 100644 --- a/tests/shader_runner_metal.m +++ b/tests/shader_runner_metal.m @@ -86,6 +86,18 @@ static MTLVertexFormat get_metal_attribute_format(DXGI_FORMAT format) } } +static MTLPrimitiveType get_metal_primitive_type(D3D_PRIMITIVE_TOPOLOGY topology) +{ + switch (topology) + { + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: + return MTLPrimitiveTypeTriangle; + + default: + fatal_error("Unhandled topology %#x.\n", topology); + } +} + static void trace_messages(const char *messages) { const char *p, *end, *line; @@ -284,7 +296,7 @@ static void metal_runner_clear(struct shader_runner *r, struct resource *res, co return; } -static bool metal_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY primitive_topology, +static bool metal_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY topology, unsigned int vertex_count, unsigned int instance_count) { MTLViewport viewport = {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}; @@ -305,6 +317,7 @@ static bool metal_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY pr id pso; id argument_buffer; id cb; + bool ret = false; NSError *err; struct @@ -444,10 +457,15 @@ static bool metal_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY pr [encoder setRenderPipelineState:pso]; [encoder setViewport:viewport]; + [encoder drawPrimitives:get_metal_primitive_type(topology) + vertexStart:0 + vertexCount:vertex_count + instanceCount:instance_count]; [encoder endEncoding]; [command_buffer commit]; [command_buffer waitUntilCompleted]; + ret = true; } done: @@ -461,7 +479,7 @@ done: runner->d3d_blobs[i] = NULL; } - return false; + return ret; } static bool metal_runner_copy(struct shader_runner *r, struct resource *src, struct resource *dst)