mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
cl_fill_image: Use CL_DEVICE_VERSION instead of CL_DEVICE_NUMERIC_VER… (#2043)
…SION CL_DEVICE_NUMERIC_VERSION is only available from OpenCL 3.0 Use CL_DEVICE_VERSION instead.
This commit is contained in:
committed by
GitHub
parent
0a1456d8f9
commit
3bdd2f99b5
@@ -26,7 +26,10 @@
|
|||||||
class Version {
|
class Version {
|
||||||
public:
|
public:
|
||||||
Version(): m_major(0), m_minor(0) {}
|
Version(): m_major(0), m_minor(0) {}
|
||||||
|
|
||||||
Version(cl_uint major, cl_uint minor): m_major(major), m_minor(minor) {}
|
Version(cl_uint major, cl_uint minor): m_major(major), m_minor(minor) {}
|
||||||
|
int major() const { return m_major; }
|
||||||
|
int minor() const { return m_minor; }
|
||||||
bool operator>(const Version &rhs) const
|
bool operator>(const Version &rhs) const
|
||||||
{
|
{
|
||||||
return to_uint() > rhs.to_uint();
|
return to_uint() > rhs.to_uint();
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
#include "../testBase.h"
|
#include "../testBase.h"
|
||||||
|
|
||||||
extern void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, int x, int y, int z, float *outData );
|
extern void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, int x, int y, int z, float *outData );
|
||||||
|
|
||||||
struct pitch_buffer_data
|
struct pitch_buffer_data
|
||||||
@@ -55,9 +54,8 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr
|
|||||||
imageDesc.image_array_size = imageInfo->arraySize;
|
imageDesc.image_array_size = imageInfo->arraySize;
|
||||||
imageDesc.image_row_pitch = gEnablePitch ? imageInfo->rowPitch : 0;
|
imageDesc.image_row_pitch = gEnablePitch ? imageInfo->rowPitch : 0;
|
||||||
imageDesc.image_slice_pitch = gEnablePitch ? imageInfo->slicePitch : 0;
|
imageDesc.image_slice_pitch = gEnablePitch ? imageInfo->slicePitch : 0;
|
||||||
|
|
||||||
cl_version version;
|
|
||||||
cl_device_id device;
|
cl_device_id device;
|
||||||
|
Version version;
|
||||||
{
|
{
|
||||||
cl_int err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE,
|
cl_int err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE,
|
||||||
sizeof(device), &device, nullptr);
|
sizeof(device), &device, nullptr);
|
||||||
@@ -66,14 +64,7 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr
|
|||||||
log_error("Error: Could not get CL_QUEUE_DEVICE from queue");
|
log_error("Error: Could not get CL_QUEUE_DEVICE from queue");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
err = clGetDeviceInfo(device, CL_DEVICE_NUMERIC_VERSION,
|
version = get_device_cl_version(device);
|
||||||
sizeof(version), &version, nullptr);
|
|
||||||
if (err != CL_SUCCESS)
|
|
||||||
{
|
|
||||||
log_error("Error: Could not get CL_DEVICE_NUMERIC_VERSION from "
|
|
||||||
"device");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (imageInfo->type)
|
switch (imageInfo->type)
|
||||||
@@ -117,7 +108,7 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr
|
|||||||
cl_mem_flags buffer_flags = CL_MEM_READ_WRITE;
|
cl_mem_flags buffer_flags = CL_MEM_READ_WRITE;
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
if (CL_VERSION_MAJOR(version) == 1)
|
if (version.major() == 1)
|
||||||
{
|
{
|
||||||
host_ptr = malloc(imageInfo->rowPitch);
|
host_ptr = malloc(imageInfo->rowPitch);
|
||||||
}
|
}
|
||||||
@@ -183,7 +174,7 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr
|
|||||||
struct pitch_buffer_data *data = (struct pitch_buffer_data *)malloc(
|
struct pitch_buffer_data *data = (struct pitch_buffer_data *)malloc(
|
||||||
sizeof(struct pitch_buffer_data));
|
sizeof(struct pitch_buffer_data));
|
||||||
data->buf = host_ptr;
|
data->buf = host_ptr;
|
||||||
data->is_aligned = (CL_VERSION_MAJOR(version) != 1)
|
data->is_aligned = (version.major() != 1)
|
||||||
&& (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_BUFFER);
|
&& (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_BUFFER);
|
||||||
if (*error == CL_SUCCESS)
|
if (*error == CL_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user