示例#1
0
func (p *Program) release() error {
	if p.id != nil {
		if err := C.clReleaseProgram(p.id); err != C.CL_SUCCESS {
			return Cl_error(err)
		}
		p.id = nil
	}
	return nil
}
示例#2
0
func (c *Context) NewProgramFromSource(prog string) (*Program, error) {
	var c_program C.cl_program
	var err C.cl_int

	cs := C.CString(prog)
	defer C.free(unsafe.Pointer(cs))

	if c_program = C.clCreateProgramWithSource(c.id, 1, &cs, (*C.size_t)(nil), &err); err != C.CL_SUCCESS {
		return nil, Cl_error(err)
	} else if err = C.clBuildProgram(c_program, 0, nil, nil, nil, nil); err != C.CL_SUCCESS {
		C.clReleaseProgram(c_program)
		return nil, Cl_error(err)
	}

	program := &Program{id: c_program}
	runtime.SetFinalizer(program, (*Program).release)

	return program, nil
}
示例#3
0
文件: package.go 项目: mantyr/cl
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clReleaseProgram.html
func ReleaseProgram(prog Program) ErrorCode {
	return ErrorCode(C.clReleaseProgram(prog))
}
示例#4
0
func CLReleaseProgram(program CL_program) CL_int {
	return CL_int(C.clReleaseProgram(program.cl_program))
}
示例#5
0
func releaseProgram(p *Program) {
	if p.clProgram != nil {
		C.clReleaseProgram(p.clProgram)
		p.clProgram = nil
	}
}