mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-12 12:30:33 +08:00
feat(example): impl. vadd
This commit is contained in:
21
ze/context.go
Normal file
21
ze/context.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package ze
|
||||
|
||||
import "github.com/fumiama/gozel"
|
||||
|
||||
// ContextHandle is a handle to a Level Zero context.
|
||||
type ContextHandle gozel.ZeContextHandle
|
||||
|
||||
// ContextCreate creates a new context for the driver.
|
||||
func (h DriverHandle) ContextCreate() (ContextHandle, error) {
|
||||
var ctx gozel.ZeContextHandle
|
||||
_, err := gozel.ZeContextCreate(gozel.ZeDriverHandle(h), &gozel.ZeContextDesc{
|
||||
Stype: gozel.ZE_STRUCTURE_TYPE_CONTEXT_DESC,
|
||||
}, &ctx)
|
||||
return ContextHandle(ctx), err
|
||||
}
|
||||
|
||||
// Destroy destroys the context and releases its resources.
|
||||
func (h ContextHandle) Destroy() error {
|
||||
_, err := gozel.ZeContextDestroy(gozel.ZeContextHandle(h))
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user