当前位置: 首页>>代码示例>>C++>>正文


C++ Image2D::height方法代码示例

本文整理汇总了C++中Image2D::height方法的典型用法代码示例。如果您正苦于以下问题:C++ Image2D::height方法的具体用法?C++ Image2D::height怎么用?C++ Image2D::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image2D的用法示例。


在下文中一共展示了Image2D::height方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if


//.........这里部分代码省略.........
            }

            p_local_work_size[i] = local_work_size[i];
            work_group_size *= local_work_size[i];
        }
    }
    // initialize missing dimensions
    for (; i < max_dims; i++)
    {
        p_global_work_offset[i]  = 0;
        p_global_work_size[i]    = 1;
        p_local_work_size[i]     = 1;
    }

    // Check we don't ask too much to the device
    if (work_group_size > max_work_group_size)
    {
        *errcode_ret = CL_INVALID_WORK_GROUP_SIZE;
        return;
    }

    // Check arguments (buffer alignment, image size, ...)
    for (unsigned int i=0; i<kernel->numArgs(); ++i)
    {
        const Kernel::Arg &a = kernel->arg(i);

        if (a.kind() == Kernel::Arg::Buffer && a.file() != Kernel::Arg::Local)
        {
            MemObject *buffer = *(MemObject **)(a.value(0));

            if (!BufferEvent::isSubBufferAligned(buffer, device))
            {
                *errcode_ret = CL_MISALIGNED_SUB_BUFFER_OFFSET;
                return;
            }

            clRetainMemObject(desc(buffer));
            p_mem_objects.push_back((MemObject *) buffer);
        }
        else if (a.kind() == Kernel::Arg::Image2D)
        {
            Image2D *image = *(Image2D **)(a.value(0));
            size_t maxWidth, maxHeight;

            *errcode_ret = device->info(CL_DEVICE_IMAGE2D_MAX_WIDTH,
                                        sizeof(size_t), &maxWidth, 0);
            *errcode_ret |= device->info(CL_DEVICE_IMAGE2D_MAX_HEIGHT,
                                         sizeof(size_t), &maxHeight, 0);

            if (*errcode_ret != CL_SUCCESS)
                return;

            if (image->width() > maxWidth || image->height() > maxHeight)
            {
                *errcode_ret = CL_INVALID_IMAGE_SIZE;
                return;
            }

            clRetainMemObject(desc(image));
            p_mem_objects.push_back((MemObject *) image);
        }
        else if (a.kind() == Kernel::Arg::Image3D)
        {
            Image3D *image = *(Image3D **)a.value(0);
            size_t maxWidth, maxHeight, maxDepth;

            *errcode_ret = device->info(CL_DEVICE_IMAGE3D_MAX_WIDTH,
                                        sizeof(size_t), &maxWidth, 0);
            *errcode_ret |= device->info(CL_DEVICE_IMAGE3D_MAX_HEIGHT,
                                         sizeof(size_t), &maxHeight, 0);
            *errcode_ret |= device->info(CL_DEVICE_IMAGE3D_MAX_DEPTH,
                                         sizeof(size_t), &maxDepth, 0);

            if (*errcode_ret != CL_SUCCESS)
                return;

            if (image->width() > maxWidth || image->height() > maxHeight ||
                image->depth() > maxDepth)
            {
                *errcode_ret = CL_INVALID_IMAGE_SIZE;
                return;
            }

            clRetainMemObject(desc(image));
            p_mem_objects.push_back((MemObject *) image);
        }
    }

    // Check if kernel has timeout specified and CommandQueue allows it
    if (kernel->getTimeout() > 0)
    {
        cl_command_queue_properties queue_props;
        *errcode_ret = parent->info(CL_QUEUE_PROPERTIES,
                                    sizeof(cl_command_queue_properties),
                                    &queue_props, 0);
        if (*errcode_ret != CL_SUCCESS)  return;
        if ((queue_props & CL_QUEUE_KERNEL_TIMEOUT_COMPUTE_UNIT_TI) != 0)
            p_timeout_ms = kernel->getTimeout();
    }
}
开发者ID:rcn-ee,项目名称:ti-opencl,代码行数:101,代码来源:events.cpp


注:本文中的Image2D::height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。