From 1b2f42c3aca71bbfdf2503c228f348fe2cdb01db Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sun, 12 Sep 2021 15:18:11 +0100 Subject: [PATCH] Added specconst test for int Signed-off-by: Alejandro Saucedo --- test/TestSpecializationConstant.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/TestSpecializationConstant.cpp b/test/TestSpecializationConstant.cpp index f57c221ab..a1dd5587d 100644 --- a/test/TestSpecializationConstant.cpp +++ b/test/TestSpecializationConstant.cpp @@ -59,11 +59,11 @@ TEST(TestSpecializationConstants, TestConstantsInt) { std::string shader(R"( #version 450 - layout (constant_id = 0) const float cOne = 1; - layout (constant_id = 1) const float cTwo = 1; + layout (constant_id = 0) const int cOne = 1; + layout (constant_id = 1) const int cTwo = 1; layout (local_size_x = 1) in; - layout(set = 0, binding = 0) buffer a { float pa[]; }; - layout(set = 0, binding = 1) buffer b { float pb[]; }; + layout(set = 0, binding = 0) buffer a { int pa[]; }; + layout(set = 0, binding = 1) buffer b { int pb[]; }; void main() { uint index = gl_GlobalInvocationID.x; pa[index] = cOne; @@ -77,18 +77,18 @@ TEST(TestSpecializationConstants, TestConstantsInt) { kp::Manager mgr; - std::shared_ptr> tensorA = - mgr.tensor({ 0, 0, 0 }); - std::shared_ptr> tensorB = - mgr.tensor({ 0, 0, 0 }); + std::shared_ptr> tensorA = + mgr.tensorT({ 0, 0, 0 }); + std::shared_ptr> tensorB = + mgr.tensorT({ 0, 0, 0 }); std::vector> params = { tensorA, tensorB }; - kp::Constants spec = kp::Constants({ 5.0, 0.3 }); + std::vector spec({ -1, -2 }); std::shared_ptr algo = - mgr.algorithm(params, spirv, {}, spec); + mgr.algorithm(params, spirv, {}, spec, {}); sq = mgr.sequence() ->record(params) @@ -96,8 +96,9 @@ TEST(TestSpecializationConstants, TestConstantsInt) ->record(params) ->eval(); - EXPECT_EQ(tensorA->vector(), std::vector({ 5, 5, 5 })); - EXPECT_EQ(tensorB->vector(), std::vector({ 0.3, 0.3, 0.3 })); + EXPECT_EQ(tensorA->vector(), std::vector({ -1, -1, -1 })); + EXPECT_EQ(tensorB->vector(), std::vector({ -2, -2, -2 })); } } } +