mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-22 11:30:29 +08:00
feat(gen&zecall): add function support
This commit is contained in:
222
core/fence.go
Normal file
222
core/fence.go
Normal file
@@ -0,0 +1,222 @@
|
||||
// Code generated by cmd/gen. DO NOT EDIT.
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* @file ze_api.h
|
||||
* @version v1.15-r1.15.31
|
||||
*
|
||||
*/
|
||||
|
||||
package core
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/fumiama/gozel/internal/zecall"
|
||||
)
|
||||
|
||||
// ZeFenceFlags (ze_fence_flags_t) Supported fence creation flags
|
||||
type ZeFenceFlags uint32
|
||||
const (
|
||||
ZE_FENCE_FLAG_SIGNALED ZeFenceFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZE_FENCE_FLAG_SIGNALED fence is created in the signaled state, otherwise not signaled.
|
||||
ZE_FENCE_FLAG_FORCE_UINT32 ZeFenceFlags = 0x7fffffff // ZE_FENCE_FLAG_FORCE_UINT32 Value marking end of ZE_FENCE_FLAG_* ENUMs
|
||||
|
||||
)
|
||||
|
||||
// ZeFenceDesc (ze_fence_desc_t) Fence descriptor
|
||||
type ZeFenceDesc struct {
|
||||
Stype ZeStructureType // Stype [in] type of this structure
|
||||
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
|
||||
Flags ZeFenceFlags // Flags [in] creation flags. must be 0 (default) or a valid combination of ::ze_fence_flag_t.
|
||||
|
||||
}
|
||||
|
||||
// ZeFenceCreate Creates a fence for the command queue.
|
||||
///
|
||||
/// @details
|
||||
/// - A fence is a heavyweight synchronization primitive used to communicate
|
||||
/// to the host that command list execution has completed.
|
||||
/// - The application must only use the fence for the command queue which
|
||||
/// was provided during creation.
|
||||
/// - The application may call this function from simultaneous threads.
|
||||
/// - The implementation of this function must be thread-safe.
|
||||
///
|
||||
/// @remarks
|
||||
/// _Analogues_
|
||||
/// - **vkCreateFence**
|
||||
///
|
||||
/// @returns
|
||||
/// - ::ZE_RESULT_SUCCESS
|
||||
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
||||
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
||||
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
||||
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
||||
/// - ::ZE_RESULT_ERROR_UNKNOWN
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hCommandQueue`
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
||||
/// + `nullptr == desc`
|
||||
/// + `nullptr == phFence`
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
|
||||
/// + `0x1 < desc->flags`
|
||||
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
|
||||
func ZeFenceCreate(
|
||||
hCommandQueue ZeCommandQueueHandle, // hCommandQueue [in] handle of command queue
|
||||
desc *ZeFenceDesc, // desc [in] pointer to fence descriptor
|
||||
phFence *ZeFenceHandle, // phFence [out] pointer to handle of fence object created
|
||||
) (ZeResult, error) {
|
||||
return zecall.Call[ZeResult]("zeFenceCreate", uintptr(hCommandQueue), uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(phFence)))
|
||||
}
|
||||
|
||||
// ZeFenceDestroy Deletes a fence object.
|
||||
///
|
||||
/// @details
|
||||
/// - The application must ensure the device is not currently referencing
|
||||
/// the fence before it is deleted.
|
||||
/// - The implementation of this function may immediately free all Host and
|
||||
/// Device allocations associated with this fence.
|
||||
/// - The application must **not** call this function from simultaneous
|
||||
/// threads with the same fence handle.
|
||||
/// - The implementation of this function must be thread-safe.
|
||||
///
|
||||
/// @remarks
|
||||
/// _Analogues_
|
||||
/// - **vkDestroyFence**
|
||||
///
|
||||
/// @returns
|
||||
/// - ::ZE_RESULT_SUCCESS
|
||||
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
||||
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
||||
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
||||
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
||||
/// - ::ZE_RESULT_ERROR_UNKNOWN
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hFence`
|
||||
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
|
||||
func ZeFenceDestroy(
|
||||
hFence ZeFenceHandle, // hFence [in][release] handle of fence object to destroy
|
||||
) (ZeResult, error) {
|
||||
return zecall.Call[ZeResult]("zeFenceDestroy", uintptr(hFence))
|
||||
}
|
||||
|
||||
// ZeFenceHostSynchronize The current host thread waits on a fence to be signaled.
|
||||
///
|
||||
/// @details
|
||||
/// - The application may call this function from simultaneous threads.
|
||||
/// - The implementation of this function should be lock-free.
|
||||
///
|
||||
/// @remarks
|
||||
/// _Analogues_
|
||||
/// - **vkWaitForFences**
|
||||
///
|
||||
/// @returns
|
||||
/// - ::ZE_RESULT_SUCCESS
|
||||
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
||||
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
||||
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
||||
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
||||
/// - ::ZE_RESULT_ERROR_UNKNOWN
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hFence`
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT
|
||||
/// - ::ZE_RESULT_NOT_READY
|
||||
/// + timeout expired
|
||||
func ZeFenceHostSynchronize(
|
||||
hFence ZeFenceHandle, // hFence [in] handle of the fence
|
||||
timeout uint64, // timeout [in] if non-zero, then indicates the maximum time (in nanoseconds) to yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; if zero, then operates exactly like ::zeFenceQueryStatus; if `UINT64_MAX`, then function will not return until complete or device is lost. Due to external dependencies, timeout may be rounded to the closest value allowed by the accuracy of those dependencies.
|
||||
) (ZeResult, error) {
|
||||
return zecall.Call[ZeResult]("zeFenceHostSynchronize", uintptr(hFence), uintptr(timeout))
|
||||
}
|
||||
|
||||
// ZeFenceQueryStatus Queries a fence object's status.
|
||||
///
|
||||
/// @details
|
||||
/// - The application may call this function from simultaneous threads.
|
||||
/// - The implementation of this function should be lock-free.
|
||||
///
|
||||
/// @remarks
|
||||
/// _Analogues_
|
||||
/// - **vkGetFenceStatus**
|
||||
///
|
||||
/// @returns
|
||||
/// - ::ZE_RESULT_SUCCESS
|
||||
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
||||
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
||||
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
||||
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
||||
/// - ::ZE_RESULT_ERROR_UNKNOWN
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hFence`
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT
|
||||
/// - ::ZE_RESULT_NOT_READY
|
||||
/// + not signaled
|
||||
func ZeFenceQueryStatus(
|
||||
hFence ZeFenceHandle, // hFence [in] handle of the fence
|
||||
) (ZeResult, error) {
|
||||
return zecall.Call[ZeResult]("zeFenceQueryStatus", uintptr(hFence))
|
||||
}
|
||||
|
||||
// ZeFenceReset Reset a fence back to the not signaled state.
|
||||
///
|
||||
/// @details
|
||||
/// - The application may call this function from simultaneous threads.
|
||||
/// - The implementation of this function should be lock-free.
|
||||
///
|
||||
/// @remarks
|
||||
/// _Analogues_
|
||||
/// - **vkResetFences**
|
||||
///
|
||||
/// @returns
|
||||
/// - ::ZE_RESULT_SUCCESS
|
||||
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
||||
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
||||
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
||||
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
||||
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
||||
/// - ::ZE_RESULT_ERROR_UNKNOWN
|
||||
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hFence`
|
||||
func ZeFenceReset(
|
||||
hFence ZeFenceHandle, // hFence [in] handle of the fence
|
||||
) (ZeResult, error) {
|
||||
return zecall.Call[ZeResult]("zeFenceReset", uintptr(hFence))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user