-
Notifications
You must be signed in to change notification settings - Fork 312
Expand file tree
/
Copy pathImageUploadHelper.java
More file actions
44 lines (32 loc) · 1.19 KB
/
ImageUploadHelper.java
File metadata and controls
44 lines (32 loc) · 1.19 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package net.vulkanmod.render.texture;
import net.vulkanmod.vulkan.Synchronization;
import net.vulkanmod.vulkan.device.DeviceManager;
import net.vulkanmod.vulkan.queue.CommandPool;
import net.vulkanmod.vulkan.queue.Queue;
public class ImageUploadHelper {
public static final ImageUploadHelper INSTANCE = new ImageUploadHelper();
final Queue queue;
private CommandPool.CommandBuffer currentCmdBuffer;
public ImageUploadHelper() {
queue = DeviceManager.getGraphicsQueue();
}
public long submitCommands() {
if (this.currentCmdBuffer == null) {
return 0L;
}
SpriteUpdateUtil.transitionLayouts();
long fence = queue.submitCommands(this.currentCmdBuffer, true);
Synchronization.INSTANCE.addCommandBuffer(this.currentCmdBuffer, true);
this.currentCmdBuffer = null;
return fence;
}
public CommandPool.CommandBuffer getOrStartCommandBuffer() {
if (this.currentCmdBuffer == null) {
this.currentCmdBuffer = this.queue.beginCommands();
}
return this.currentCmdBuffer;
}
public CommandPool.CommandBuffer getCommandBuffer() {
return this.currentCmdBuffer;
}
}