summaryrefslogtreecommitdiff
path: root/utests
diff options
context:
space:
mode:
authorRuiling Song <ruiling.song@intel.com>2013-10-16 15:38:08 +0800
committerZhigang Gong <zhigang.gong@intel.com>2013-10-17 18:13:09 +0800
commit8e054547c78ba37a87ef0b43457a777c87879431 (patch)
treea6167d1af0f2f1101b12e937dc59b23c7938eeeb /utests
parent10d2b050a4cbac0b4e5fa660357d81464b00e744 (diff)
utests: add test cases for function call.
Signed-off-by: Ruiling Song <ruiling.song@intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'utests')
-rw-r--r--utests/compiler_shader_toy.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/utests/compiler_shader_toy.cpp b/utests/compiler_shader_toy.cpp
index ead91208..58bcc6f7 100644
--- a/utests/compiler_shader_toy.cpp
+++ b/utests/compiler_shader_toy.cpp
@@ -31,7 +31,9 @@
static const int dim = 256;
-static void run_kernel(int w, int h, const char *name)
+// tricky here 'name' stands for Kernel and Reference
+// 'file' stands for .cl file name and dst image name
+static void run_kernel(int w, int h, const char *file, const char *name)
{
const size_t global[2] = {size_t(w), size_t(h)};
const size_t local[2] = {16, 1};
@@ -42,8 +44,8 @@ static void run_kernel(int w, int h, const char *name)
char dst_img[256];
char ref_img[256];
- snprintf(kernel_file, sizeof(kernel_file), "%s.cl", name);
- snprintf(dst_img, sizeof(dst_img), "%s.bmp", name);
+ snprintf(kernel_file, sizeof(kernel_file), "%s.cl", file);
+ snprintf(dst_img, sizeof(dst_img), "%s.bmp", file);
snprintf(ref_img, sizeof(ref_img), "%s_ref.bmp", name);
OCL_CALL (cl_kernel_init, kernel_file, name, SOURCE, NULL);
@@ -63,20 +65,23 @@ static void run_kernel(int w, int h, const char *name)
OCL_CHECK_IMAGE(dst, w, h, ref_img);
}
-#define DECL_SHADER_TOY_TEST(W,H,NAME) \
- static void NAME(void) { run_kernel(W,H,#NAME); } \
- MAKE_UTEST_FROM_FUNCTION(NAME);
+#define DECL_SHADER_TOY_TEST(W,H,FILE_NAME, KERNEL_NAME) \
+ static void FILE_NAME(void) { run_kernel(W,H,#FILE_NAME, #KERNEL_NAME); } \
+ MAKE_UTEST_FROM_FUNCTION(FILE_NAME);
-DECL_SHADER_TOY_TEST(dim,dim,compiler_clod);
-DECL_SHADER_TOY_TEST(dim,dim,compiler_ribbon);
-DECL_SHADER_TOY_TEST(dim,dim,compiler_nautilus);
-DECL_SHADER_TOY_TEST(dim,dim,compiler_menger_sponge_no_shadow);
-DECL_SHADER_TOY_TEST(dim,dim,compiler_julia);
-DECL_SHADER_TOY_TEST(dim,dim,compiler_julia_no_break);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_clod,compiler_clod);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_ribbon,compiler_ribbon);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_nautilus,compiler_nautilus);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_menger_sponge_no_shadow,compiler_menger_sponge_no_shadow);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_julia,compiler_julia);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_julia_no_break,compiler_julia_no_break);
+// test for function calls
+DECL_SHADER_TOY_TEST(dim,dim,compiler_clod_function_call,compiler_clod);
+DECL_SHADER_TOY_TEST(dim,dim,compiler_julia_function_call,compiler_julia);
// Still issues here for LLVM 3.2
-// DECL_SHADER_TOY_TEST(dim,dim,compiler_chocolux);
-// DECL_SHADER_TOY_TEST(dim,dim,compiler_menger_sponge);
+// DECL_SHADER_TOY_TEST(dim,dim,compiler_chocolux,compiler_chocolux);
+// DECL_SHADER_TOY_TEST(dim,dim,compiler_menger_sponge,compiler_menger_sponge);
#undef DECL_SHADER_TOY_TEST