-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathfence.go
More file actions
29 lines (25 loc) · 651 Bytes
/
Copy pathfence.go
File metadata and controls
29 lines (25 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//go:build !rust && !(js && wasm)
package wgpu
import "github.com/gogpu/wgpu/hal"
// Fence is a GPU synchronization primitive.
// Fences allow CPU-GPU synchronization by signaling when submitted work completes.
//
// Fences are created via Device.CreateFence and should be released via Release()
// when no longer needed.
type Fence struct {
hal hal.Fence
device *Device
released bool
}
// Release destroys the fence.
// After this call, the fence must not be used.
func (f *Fence) Release() {
if f.released {
return
}
f.released = true
halDevice := f.device.halDevice()
if halDevice != nil {
halDevice.DestroyFence(f.hal)
}
}