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
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.
25 * @file get-command-queue-info.c
29 * cl_int clGetCommandQueueInfo (cl_command_queue command_queue,
30 * cl_command_queue_info param_name,
31 * size_t param_value_size,
33 * size_t param_value_size_ret)
36 #include "piglit-framework-cl-api.h"
39 PIGLIT_CL_API_TEST_CONFIG_BEGIN
41 config
.name
= "clGetCommandQueueInfo";
42 config
.version_min
= 10;
44 config
.run_per_device
= true;
45 config
.create_context
= true;
47 PIGLIT_CL_API_TEST_CONFIG_END
51 piglit_cl_test(const int argc
,
53 const struct piglit_cl_api_test_config
* config
,
54 const struct piglit_cl_api_test_env
* env
)
56 enum piglit_result result
= PIGLIT_PASS
;
60 cl_command_queue command_queue
= env
->context
->command_queues
[0];
62 size_t param_value_size
;
65 int num_command_queue_infos
=
66 PIGLIT_CL_ENUM_NUM(cl_command_queue_info
, env
->version
);
67 const cl_command_queue_info
*command_queue_infos
=
68 PIGLIT_CL_ENUM_ARRAY(cl_command_queue_info
);
70 /*** Normal usage ***/
72 for(i
= 0; i
< num_command_queue_infos
; i
++) {
73 printf("%s ", piglit_cl_get_enum_name(command_queue_infos
[i
]));
75 errNo
= clGetCommandQueueInfo(command_queue
,
76 command_queue_infos
[i
],
80 if(!piglit_cl_check_error(errNo
, CL_SUCCESS
)) {
82 "Failed (error code: %s): Get size of %s.\n",
83 piglit_cl_get_error_name(errNo
),
84 piglit_cl_get_enum_name(command_queue_infos
[i
]));
85 piglit_merge_result(&result
, PIGLIT_FAIL
);
89 param_value
= malloc(param_value_size
);
90 errNo
= clGetCommandQueueInfo(command_queue
,
91 command_queue_infos
[i
],
95 if(!piglit_cl_check_error(errNo
, CL_SUCCESS
)) {
97 "Failed (error code: %s): Get value of %s.\n",
98 piglit_cl_get_error_name(errNo
),
99 piglit_cl_get_enum_name(command_queue_infos
[i
]));
100 piglit_merge_result(&result
, PIGLIT_FAIL
);
103 //TODO: output returned values
111 * CL_INVALID_VALUE if param_name is not one of the supported
112 * values or if size in bytes specified by param_value_size is
113 * less than size of return type and param_value is not a NULL
116 errNo
= clGetCommandQueueInfo(command_queue
,
121 if(!piglit_cl_check_error(errNo
, CL_INVALID_VALUE
)) {
123 "Failed (error code: %s): Trigger CL_INVALID_VALUE if param_name is not one of the supported values.\n",
124 piglit_cl_get_error_name(errNo
));
125 piglit_merge_result(&result
, PIGLIT_FAIL
);
128 errNo
= clGetCommandQueueInfo(command_queue
,
129 CL_QUEUE_REFERENCE_COUNT
,
133 if(!piglit_cl_check_error(errNo
, CL_INVALID_VALUE
)) {
135 "Failed (error code: %s): Trigger CL_INVALID_VALUE if size in bytes specified by param_value is less than size of return type and param_value is not a NULL value.\n",
136 piglit_cl_get_error_name(errNo
));
137 piglit_merge_result(&result
, PIGLIT_FAIL
);
141 * CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command queue.
143 errNo
= clGetCommandQueueInfo(NULL
,
148 if(!piglit_cl_check_error(errNo
, CL_INVALID_COMMAND_QUEUE
)) {
150 "Failed (error code: %s): Trigger CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command queue.\n",
151 piglit_cl_get_error_name(errNo
));
152 piglit_merge_result(&result
, PIGLIT_FAIL
);