summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Martin <edb@sigluy.net>2020-04-28 23:25:13 +0200
committerMarge Bot <eric+marge@anholt.net>2020-05-29 11:31:40 +0000
commit1a68b5b680fb3890ac695cee7f7f1515ec4102a9 (patch)
tree4f13633acbd0f4fb1ebb50dcca961fb04fb2bdf1
parenta24c07efb3745cc8c33bd28e10fb1586f98983f7 (diff)
cl: add program need_image_support option
When need_image_support is true and the context or the device have no image support the test is skipped Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/271>
-rw-r--r--tests/cl/program/execute/image-attributes.cl2
-rw-r--r--tests/cl/program/execute/image-read-2d.cl2
-rw-r--r--tests/cl/program/execute/image-write-2d.cl2
-rw-r--r--tests/cl/program/execute/sampler.cl2
-rw-r--r--tests/cl/program/program-tester.c2
-rw-r--r--tests/util/piglit-framework-cl-program.c15
-rw-r--r--tests/util/piglit-framework-cl-program.h1
7 files changed, 26 insertions, 0 deletions
diff --git a/tests/cl/program/execute/image-attributes.cl b/tests/cl/program/execute/image-attributes.cl
index a629b95a0..1482ab553 100644
--- a/tests/cl/program/execute/image-attributes.cl
+++ b/tests/cl/program/execute/image-attributes.cl
@@ -2,6 +2,8 @@
[config]
name: 2D image attributes
+need_image_support: true
+
dimensions: 1
global_size: 1 0 0
local_size: 1 0 0
diff --git a/tests/cl/program/execute/image-read-2d.cl b/tests/cl/program/execute/image-read-2d.cl
index 3d8128854..bb1010064 100644
--- a/tests/cl/program/execute/image-read-2d.cl
+++ b/tests/cl/program/execute/image-read-2d.cl
@@ -2,6 +2,8 @@
[config]
name: 2D image reading
+need_image_support: true
+
dimensions: 1
global_size: 1 0 0
local_size: 1 0 0
diff --git a/tests/cl/program/execute/image-write-2d.cl b/tests/cl/program/execute/image-write-2d.cl
index 25429df07..9b3a3b668 100644
--- a/tests/cl/program/execute/image-write-2d.cl
+++ b/tests/cl/program/execute/image-write-2d.cl
@@ -2,6 +2,8 @@
[config]
name: 2D image writing
+need_image_support: true
+
dimensions: 2
global_size: 2 3 0
local_size: 1 1 0
diff --git a/tests/cl/program/execute/sampler.cl b/tests/cl/program/execute/sampler.cl
index 6de1d4462..2ad5f61be 100644
--- a/tests/cl/program/execute/sampler.cl
+++ b/tests/cl/program/execute/sampler.cl
@@ -2,6 +2,8 @@
[config]
name: Sampler tests
+need_image_support: true
+
dimensions: 1
global_size: 4 0 0
local_size: 1 0 0
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index a4abed9ee..f70497b08 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -1726,6 +1726,8 @@ parse_config(const char* config_str,
config->expect_build_fail = get_bool(value);
} else if(regex_match(key, "^expect_test_fail$")) {
expect_test_fail = get_bool(value);
+ } else if(regex_match(key, "^need_image_support$")) {
+ config->need_image_support = get_bool(value);
} else if(regex_match(key, "^dimensions$")) {
work_dimensions = get_uint(value);
} else if(regex_match(key, "^global_size$")) {
diff --git a/tests/util/piglit-framework-cl-program.c b/tests/util/piglit-framework-cl-program.c
index f94525b98..b47425cd2 100644
--- a/tests/util/piglit-framework-cl-program.c
+++ b/tests/util/piglit-framework-cl-program.c
@@ -29,6 +29,7 @@ const struct piglit_cl_program_test_config
PIGLIT_CL_DEFAULT_PROGRAM_TEST_CONFIG = {
.clc_version_min = 0,
.clc_version_max = 0,
+ .need_image_support = false,
.program_source = NULL,
.program_source_file = NULL,
@@ -206,6 +207,20 @@ piglit_cl_program_test_run(const int argc,
env.context = piglit_cl_create_context(platform_id, &device_id, 1);
}
+ if(config->need_image_support) {
+ bool image_support = false;
+ if(config->run_per_platform) {
+ image_support = piglit_cl_get_context_image_support(env.context);
+ } else { // config->run_per_device
+ image_support = piglit_cl_get_device_image_support(env.device_id);
+ }
+
+ if(!image_support) {
+ printf("Test need image support and none was found\n");
+ return PIGLIT_SKIP;
+ }
+ }
+
if(env.context == NULL) {
return PIGLIT_FAIL;
}
diff --git a/tests/util/piglit-framework-cl-program.h b/tests/util/piglit-framework-cl-program.h
index bf15d3db5..98d321acc 100644
--- a/tests/util/piglit-framework-cl-program.h
+++ b/tests/util/piglit-framework-cl-program.h
@@ -67,6 +67,7 @@ PIGLIT_CL_DEFINE_TEST_CONFIG_BEGIN(struct piglit_cl_program_test_config)
int clc_version_min; /**< Minimum OpenCL C version required. (optional) */
int clc_version_max; /**< Maximum OpenCL C version supported. (optional) */
+ bool need_image_support; /**< Does the test need image support. (default: false) */
char* program_source; /**< Source to create and build a program on each run.
Conflicts with other \c program_*. (optional) */