Ejemplo n.º 1
0
cl_int WINAPI wine_clGetSamplerInfo(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
                                    void * param_value, size_t * param_value_size_ret)
{
    cl_int ret;
    TRACE("\n");
    ret = clGetSamplerInfo(sampler, param_name, param_value_size, param_value, param_value_size_ret);
    return ret;
}
Ejemplo n.º 2
0
struct _cl_version clGetSamplerVersion(cl_sampler sampler)
{
    struct _cl_version version;
    version.major = 0;
    version.minor = 0;
    cl_context context = NULL;
    cl_int flag = clGetSamplerInfo(sampler, CL_SAMPLER_CONTEXT,
                                   sizeof(cl_context), &context, NULL);
    if(flag != CL_SUCCESS)
        return version;
    return clGetContextVersion(context);
}
Ejemplo n.º 3
0
/**
 * \brief Returns the filtering mode of this Sampler.
 *
 * \Return FilterMode 
 */
ocl::Sampler::FilterMode ocl::Sampler::filterMode() const
{
	if(this->_context == nullptr) throw std::runtime_error("context not valid. cannot create a sampler");
	if(this->_id == nullptr) throw std::runtime_error("id not valid. cannot create a sampler");

	cl_filter_mode mode;
	
	cl_int status = clGetSamplerInfo (this->_id, CL_SAMPLER_FILTER_MODE, sizeof(mode), &mode, NULL);
	OPENCL_SAFE_CALL(status);
	
	return FilterMode(mode);
}
Ejemplo n.º 4
0
/**
 * \brief Returns the addressing mode of this Sampler.
 *
 * \Return AdressingMode 
 */
ocl::Sampler::AdressingMode ocl::Sampler::addressingMode() const
{
	if(this->_context == nullptr) throw std::runtime_error("context not valid. cannot create a sampler");
	if(this->_id == nullptr) throw std::runtime_error("id not valid. cannot create a sampler");
	
	cl_addressing_mode mode;
	
	cl_int status = clGetSamplerInfo (this->_id, CL_SAMPLER_ADDRESSING_MODE, sizeof(mode), &mode, NULL);
	OPENCL_SAFE_CALL(status);
	
	return AdressingMode(mode);
}
Ejemplo n.º 5
0
/**
 * \brief Returns true if Sampler uses normalized coordinates.
 */
bool ocl::Sampler::isNormalized() const
{
	if(this->_context == nullptr) throw std::runtime_error("context not valid. cannot create a sampler");
	if(this->_id == nullptr) throw std::runtime_error("id not valid. cannot create a sampler");

	cl_bool normalized;
	
	cl_int status = clGetSamplerInfo (this->_id, CL_SAMPLER_NORMALIZED_COORDS, sizeof(cl_bool), &normalized, NULL);
	OPENCL_SAFE_CALL(status);
	
	return normalized == CL_TRUE ? true : false;
}
Ejemplo n.º 6
0
static void*
piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint param)
{
	cl_int errNo;
	size_t param_size;
	void* param_ptr = NULL;

	/* get param size */
	if(fn_ptr == clGetPlatformInfo) {
		errNo = clGetPlatformInfo(*(cl_platform_id*)obj, param, 0, NULL,
		                          &param_size);
	} else if(fn_ptr == clGetDeviceInfo) {
		errNo = clGetDeviceInfo(*(cl_device_id*)obj, param, 0, NULL,
		                        &param_size);
	} else if(fn_ptr == clGetContextInfo) {
		errNo = clGetContextInfo(*(cl_context*)obj, param, 0, NULL,
		                         &param_size);
	} else if(fn_ptr == clGetCommandQueueInfo) {
		errNo = clGetCommandQueueInfo(*(cl_command_queue*)obj, param, 0, NULL,
		                              &param_size);
	} else if(fn_ptr == clGetMemObjectInfo) {
		errNo = clGetMemObjectInfo(*(cl_mem*)obj, param, 0, NULL,
		                           &param_size);
	} else if(fn_ptr == clGetImageInfo) {
		errNo = clGetImageInfo(*(cl_mem*)obj, param, 0, NULL,
		                       &param_size);
	} else if(fn_ptr == clGetSamplerInfo) {
		errNo = clGetSamplerInfo(*(cl_sampler*)obj, param, 0, NULL,
		                         &param_size);
	} else if(fn_ptr == clGetProgramInfo) {
		errNo = clGetProgramInfo(*(cl_program*)obj, param, 0, NULL,
		                         &param_size);
	} else if(fn_ptr == clGetProgramBuildInfo) {
		errNo = clGetProgramBuildInfo(((struct _program_build_info_args*)obj)->program,
		                              ((struct _program_build_info_args*)obj)->device,
		                              param, 0, NULL, &param_size);
	} else if(fn_ptr == clGetKernelInfo) {
		errNo = clGetKernelInfo(*(cl_kernel*)obj, param, 0, NULL,
		                        &param_size);
	} else if(fn_ptr == clGetKernelWorkGroupInfo) {
		errNo = clGetKernelWorkGroupInfo(((struct _kernel_work_group_info_args*)obj)->kernel,
		                                 ((struct _kernel_work_group_info_args*)obj)->device,
		                                 param, 0, NULL, &param_size);
	} else if(fn_ptr == clGetEventInfo) {
		errNo = clGetEventInfo(*(cl_event*)obj, param, 0, NULL,
		                       &param_size);
	} else if(fn_ptr == clGetEventProfilingInfo) {
		errNo = clGetEventProfilingInfo(*(cl_event*)obj, param, 0, NULL,
		                                &param_size);
	} else {
		fprintf(stderr,
		        "Trying to get %s information from undefined function.\n",
		        piglit_cl_get_enum_name(param));
		piglit_report_result(PIGLIT_FAIL);
	}

	if(errNo == CL_SUCCESS) {
		param_ptr = calloc(param_size, sizeof(char));
		
		/* retrieve param */
		if(fn_ptr == clGetPlatformInfo) {
			errNo = clGetPlatformInfo(*(cl_platform_id*)obj, param,
			                          param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetDeviceInfo) {
			errNo = clGetDeviceInfo(*(cl_device_id*)obj, param,
			                        param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetContextInfo) {
			errNo = clGetContextInfo(*(cl_context*)obj, param,
			                         param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetCommandQueueInfo) {
			errNo = clGetCommandQueueInfo(*(cl_command_queue*)obj,
			                              param, param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetMemObjectInfo) {
			errNo = clGetMemObjectInfo(*(cl_mem*)obj, param,
			                           param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetImageInfo) {
			errNo = clGetImageInfo(*(cl_mem*)obj, param,
			                       param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetSamplerInfo) {
			errNo = clGetSamplerInfo(*(cl_sampler*)obj, param,
			                         param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetProgramInfo) {
			errNo = clGetProgramInfo(*(cl_program*)obj, param,
			                         param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetProgramBuildInfo) {
			errNo = clGetProgramBuildInfo(((struct _program_build_info_args*)obj)->program,
			                              ((struct _program_build_info_args*)obj)->device,
			                              param, param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetKernelInfo) {
			errNo = clGetKernelInfo(*(cl_kernel*)obj, param,
			                        param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetKernelWorkGroupInfo) {
			errNo = clGetKernelWorkGroupInfo(((struct _kernel_work_group_info_args*)obj)->kernel,
			                                 ((struct _kernel_work_group_info_args*)obj)->device,
			                                 param, param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetEventInfo) {
			errNo = clGetEventInfo(*(cl_event*)obj, param,
			                       param_size, param_ptr, NULL);
		} else if(fn_ptr == clGetEventProfilingInfo) {
			errNo = clGetEventProfilingInfo(*(cl_event*)obj, param,
			                                param_size, param_ptr, NULL);
		}

		if(errNo != CL_SUCCESS) {
			free(param_ptr);
			param_ptr = NULL;
		}
	}

	if(param_ptr == NULL) {
		fprintf(stderr,
		        "Unable to get %s information (Error: %s)\n",
		        piglit_cl_get_enum_name(param),
		        piglit_cl_get_error_name(errNo));
		piglit_report_result(PIGLIT_FAIL);
	}

	return param_ptr;
}