glsl-1.10: test mesa bug with forward declaration
[piglit.git] / tests / util / piglit-framework-cl-program.h
blobfd06ca68faf10dd6886f070471d70b769966e64e
1 /*
2 * Copyright © 2012 Blaž Tomažič <blaz.tomazic@gmail.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #pragma once
25 #ifndef PIGLIT_FRAMEWORK_CL_PROGRAM_H
26 #define PIGLIT_FRAMEWORK_CL_PROGRAM_H
28 #include "piglit-framework-cl.h"
31 typedef const struct piglit_cl_program_test_config
32 piglit_cl_program_test_config_t;
33 typedef const struct piglit_cl_program_test_env
34 piglit_cl_program_test_env_t;
36 /**
37 * \brief Definition of PROGRAM test function.
39 * Every test must implement this function.
41 * @param argc Argument count passed to \c main().
42 * @param argv Argument vector passed to \c main().
43 * @param config Test configuration.
44 * @param env Test environment.
45 * @return Result of test.
47 typedef enum piglit_result
48 piglit_cl_program_test_t(const int argc,
49 const char** argv,
50 piglit_cl_program_test_config_t* config,
51 piglit_cl_program_test_env_t* env);
53 /**
54 * \struct piglit_cl_program_test_config
56 * \brief Test configuration for PROGRAM tests.
58 * \note One of \c run_per_platform or \c run_per_device must be \c true.
59 * \note One of \c program_* must be true.
61 PIGLIT_CL_DEFINE_TEST_CONFIG_BEGIN(struct piglit_cl_program_test_config)
63 piglit_cl_program_test_t* _program_test; /**< Program test function.
64 (internal) */
65 piglit_cl_test_init_t* _init_test; /**< Program test init function.
66 (internal) */
68 int clc_version_min; /**< Minimum OpenCL C version required. (optional) */
69 int clc_version_max; /**< Maximum OpenCL C version supported. (optional) */
70 bool need_image_support; /**< Does the test need image support. (default: false) */
72 char* program_source; /**< Source to create and build a program on each run.
73 Conflicts with other \c program_*. (optional) */
74 char* program_source_file; /**< Source file from which to read, create and
75 build a program on each run. Conflicts with
76 other \c program_*. (optional) */
77 unsigned char* program_binary; /**< Binary to create and build a program on
78 each run. Conflicts with other
79 \c program_*. (optional) */
80 char* program_binary_file; /**< Binary file from which to read, create and
81 build a program on each run. Conflicts with
82 other \c program_*. (optional) */
84 char* build_options; /**< Build options for program. (optional) */
85 bool expect_build_fail; /**< Expect building of a program to fail.
86 (optional) */
88 char* kernel_name; /**< Create kernel(s) for program.
89 Conflicts with both \c expect_build_fail==TRUE and
90 \c build_only==TRUE. (optional) */
92 PIGLIT_CL_DEFINE_TEST_CONFIG_END
94 piglit_cl_get_empty_test_config_t piglit_cl_get_empty_program_test_config;
95 piglit_cl_test_init_t piglit_cl_program_test_init;
96 piglit_cl_test_run_t piglit_cl_program_test_run;
98 /**
99 * \def PIGLIT_CL_PROGRAM_TEST_CONFIG_BEGIN
101 * Extension of \c PIGLIT_CL_TEST_CONFIG_BEGIN macro to be used by
102 * PROGRAM tests.
103 * This macro must be used to create a PROGRAM test configuration
104 * instance and must be followed by \c PIGLIT_CL_TEST_PROGRAM_CONFIG_END macro.
106 * In between \c PIGLIT_CL_PROGRAM_TEST_CONFIG_BEGIN and
107 * \c PIGLIT_CL_PROGRAM_TEST_CONFIG_END macros you can set the test
108 * configuration values.
112 * \def PIGLIT_CL_PROGRAM_TEST_CONFIG_END
114 * Extension of \c PIGLIT_CL_TEST_CONFIG_END macro to be used by
115 * PROGRAM tests. It defines function prototypes for functions used by
116 * a PROGRAM test.
117 * This macro must be used to create a test configuration instance
118 * and must follow \c PIGLIT_CL_PROGRAM_TEST_CONFIG_BEGIN macro.
121 #define PIGLIT_CL_PROGRAM_TEST_CONFIG_BEGIN \
122 piglit_cl_program_test_t piglit_cl_test; \
124 PIGLIT_CL_TEST_CONFIG_BEGIN(struct piglit_cl_program_test_config, \
125 piglit_cl_get_empty_program_test_config, \
126 piglit_cl_program_test_run)
128 #define PIGLIT_CL_PROGRAM_TEST_CONFIG_END \
129 config._program_test = piglit_cl_test; \
130 config._init_test = config.init_func; \
131 config.init_func = piglit_cl_program_test_init; \
133 PIGLIT_CL_TEST_CONFIG_END
136 * \brief Environment for PROGRAM tests.
138 * Defines environment used by PROGRAM tests.
140 struct piglit_cl_program_test_env {
141 int version; /**< Version of OpenCL to test against. */
142 int clc_version; /**< Version of OpenCL C to test against. */
144 cl_platform_id platform_id; /**< OpenCL platform id. */
145 cl_device_id device_id; /**< OpenCL device id.
146 Holds valid device id if \c run_per_device is
147 \c true. */
149 piglit_cl_context context; /**< Generated helper context. */
151 cl_program program; /**< OpenCL program. */
153 cl_kernel kernel; /**< OpenCL kernel.
154 Holds valid kernel if \c kernel_name is a
155 NULL-terminated string, \c run_per_device is \c true,
156 and \c expect_build_fail is \c false.*/
160 #endif //PIGLIT_FRAMEWORK_CL_PROGRAM_H