Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test IMAGE1D_BUFFER in more scenario #1806

Merged
merged 21 commits into from
Apr 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions test_conformance/images/clFillImage/test_fill_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr
if (gDebugTrace)
log_info(" - Creating 1D buffer image %d ...\n",
(int)imageInfo->width);
if (gEnablePitch) host_ptr = malloc(imageInfo->rowPitch);
{
cl_int err;
cl_mem buffer =
clCreateBuffer(context, CL_MEM_READ_WRITE,
imageInfo->rowPitch, host_ptr, &err);
cl_mem_flags buffer_flags = CL_MEM_READ_WRITE;
if (gEnablePitch)
{
host_ptr = malloc(imageInfo->rowPitch);
rjodinchr marked this conversation as resolved.
Show resolved Hide resolved
buffer_flags |= CL_MEM_USE_HOST_PTR;
}
cl_mem buffer = clCreateBuffer(
context, buffer_flags, imageInfo->rowPitch, host_ptr, &err);
if (err != CL_SUCCESS)
{
log_error("ERROR: Could not create buffer for 1D buffer "
Expand All @@ -103,10 +107,22 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr
log_error( "ERROR: Unable to create backing store for pitched 3D image. %ld bytes\n", imageInfo->depth * imageInfo->slicePitch );
return NULL;
}
mem_flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR;
if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)
{
mem_flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR;
}
}

img = clCreateImage(context, mem_flags, imageInfo->format, &imageDesc, host_ptr, error);
if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)
{
img = clCreateImage(context, mem_flags, imageInfo->format, &imageDesc,
host_ptr, error);
}
else
{
img = clCreateImage(context, mem_flags, imageInfo->format, &imageDesc,
nullptr, error);
}

if (gEnablePitch)
{
Expand Down
Loading