-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathImageUploadHelper.java
41 lines (30 loc) · 1.1 KB
/
ImageUploadHelper.java
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
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 void submitCommands() {
if (this.currentCmdBuffer == null) {
return;
}
queue.submitCommands(this.currentCmdBuffer);
Synchronization.INSTANCE.addCommandBuffer(this.currentCmdBuffer);
this.currentCmdBuffer = null;
}
public CommandPool.CommandBuffer getOrStartCommandBuffer() {
if (this.currentCmdBuffer == null) {
this.currentCmdBuffer = this.queue.beginCommands();
}
return this.currentCmdBuffer;
}
public CommandPool.CommandBuffer getCommandBuffer() {
return this.currentCmdBuffer;
}
}