Skip to content

Commit 88dc10c

Browse files
committed
Vulkan add pipelineshaderstagecreateinfo
1 parent a41a3d3 commit 88dc10c

File tree

4 files changed

+112
-40
lines changed

4 files changed

+112
-40
lines changed

graphics-by-opengl-j2se/src/main/java/com/nucleus/vulkan/Vulkan10.java

-37
Original file line numberDiff line numberDiff line change
@@ -118,43 +118,6 @@ public static PresentModeKHR get(int value) {
118118

119119
};
120120

121-
public enum Result {
122-
VK_SUCCESS(0),
123-
VK_NOT_READY(1),
124-
VK_TIMEOUT(2),
125-
VK_EVENT_SET(3),
126-
VK_EVENT_RESET(4),
127-
VK_INCOMPLETE(5),
128-
VK_ERROR_OUT_OF_HOST_MEMORY(-1),
129-
VK_ERROR_OUT_OF_DEVICE_MEMORY(-2),
130-
VK_ERROR_INITIALIZATION_FAILED(-3),
131-
VK_ERROR_DEVICE_LOST(-4),
132-
VK_ERROR_MEMORY_MAP_FAILED(-5),
133-
VK_ERROR_LAYER_NOT_PRESENT(-6),
134-
VK_ERROR_EXTENSION_NOT_PRESENT(-7),
135-
VK_ERROR_FEATURE_NOT_PRESENT(-8),
136-
VK_ERROR_INCOMPATIBLE_DRIVER(-9),
137-
VK_ERROR_TOO_MANY_OBJECTS(-10),
138-
VK_ERROR_FORMAT_NOT_SUPPORTED(-11),
139-
VK_ERROR_FRAGMENTED_POOL(-12);
140-
141-
public final int value;
142-
143-
private Result(int value) {
144-
this.value = value;
145-
}
146-
147-
public static Result getResult(int value) {
148-
for (Result r : values()) {
149-
if (r.value == value) {
150-
return r;
151-
}
152-
}
153-
return null;
154-
}
155-
156-
}
157-
158121
public static class SurfaceFormat {
159122
protected Format format;
160123
protected ColorSpaceKHR space;

graphics-by-opengl-j2se/src/main/java/com/nucleus/vulkan/VulkanWrapper.java

+54-3
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,69 @@
88
import com.nucleus.common.FileUtils;
99
import com.nucleus.renderer.NucleusRenderer.Renderers;
1010
import com.nucleus.shader.ShaderBinary;
11-
import com.nucleus.vulkan.Vulkan10.Result;
1211
import com.nucleus.vulkan.structs.QueueFamilyProperties;
1312

1413
/**
1514
* The Vulkan wrapper -all things related to Vulkan functionality that is shared
1615
* independently of version
17-
*
18-
* @author rsa1lud
1916
*
2017
*/
2118
public abstract class VulkanWrapper extends Backend {
2219

20+
public enum Result {
21+
VK_SUCCESS(0),
22+
VK_NOT_READY(1),
23+
VK_TIMEOUT(2),
24+
VK_EVENT_SET(3),
25+
VK_EVENT_RESET(4),
26+
VK_INCOMPLETE(5),
27+
VK_ERROR_OUT_OF_HOST_MEMORY(-1),
28+
VK_ERROR_OUT_OF_DEVICE_MEMORY(-2),
29+
VK_VK_ERROR_INITIALIZATION_FAILED(-3),
30+
VK_ERROR_DEVICE_LOST(-4),
31+
VK_ERROR_MEMORY_MAP_FAILED(-5),
32+
VK_ERROR_LAYER_NOT_PRESENT(-6),
33+
VK_ERROR_EXTENSION_NOT_PRESENT(-7),
34+
VK_ERROR_FEATURE_NOT_PRESENT(-8),
35+
VK_ERROR_INCOMPATIBLE_DRIVER(-9),
36+
VK_ERROR_TOO_MANY_OBJECTS(-10),
37+
VK_ERROR_FORMAT_NOT_SUPPORTED(-11),
38+
VK_ERROR_FRAGMENTED_POOL(-12),
39+
VK_ERROR_OUT_OF_POOL_MEMORY(-1000069000),
40+
VK_ERROR_INVALID_EXTERNAL_HANDLE(-1000072003),
41+
VK_ERROR_SURFACE_LOST_KHR(-1000000000),
42+
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR(-1000000001),
43+
VK_SUBOPTIMAL_KHR(1000001003),
44+
VK_ERROR_OUT_OF_DATE_KHR(-1000001004),
45+
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR(-1000003001),
46+
VK_ERROR_VALIDATION_FAILED_EXT(-1000011001),
47+
VK_ERROR_INVALID_SHADER_NV(-1000012000),
48+
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT(-1000158000),
49+
VK_ERROR_FRAGMENTATION_EXT(-1000161000),
50+
VK_ERROR_NOT_PERMITTED_EXT(-1000174001),
51+
VK_ERROR_INVALID_DEVICE_ADDRESS_EXT(-1000244000),
52+
VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT(-1000255000),
53+
VK_ERROR_OUT_OF_POOL_MEMORY_KHR(VK_ERROR_OUT_OF_POOL_MEMORY.value),
54+
VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR(VK_ERROR_INVALID_EXTERNAL_HANDLE.value),
55+
VK_RESULT_MAX_ENUM(0x7FFFFFFF);
56+
57+
public final int value;
58+
59+
private Result(int value) {
60+
this.value = value;
61+
}
62+
63+
public static Result getResult(int value) {
64+
for (Result r : values()) {
65+
if (r.value == value) {
66+
return r;
67+
}
68+
}
69+
return null;
70+
}
71+
72+
}
73+
2374
public interface VulkanDeviceSelector {
2475
/**
2576
* Vulkan implementation agnostic method to select the device to use
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.nucleus.vulkan.structs;
2+
3+
import java.nio.ByteBuffer;
4+
5+
/**
6+
* Wrapper for VkPipelineShaderStageCreateInfo
7+
*/
8+
public class PipelineShaderStageCreateInfo {
9+
10+
public static class SpecializationMapEntry {
11+
int constantID;
12+
int offset;
13+
int size;
14+
}
15+
16+
public static class SpecializationInfo {
17+
int mapEntryCount;
18+
SpecializationMapEntry[] mapEntries;
19+
int dataSize;
20+
ByteBuffer data;
21+
}
22+
23+
private final int flags;
24+
private final int stage;
25+
private final ShaderModule module;
26+
private final String name;
27+
private final SpecializationInfo specializationInfo;
28+
29+
public PipelineShaderStageCreateInfo(int flags, int stage, ShaderModule module, String name,
30+
SpecializationInfo specializationInfo) {
31+
this.flags = flags;
32+
this.stage = stage;
33+
this.module = module;
34+
this.name = name;
35+
this.specializationInfo = specializationInfo;
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.nucleus.vulkan.structs;
2+
3+
public class ShaderStageFlagBits {
4+
public static final int VK_SHADER_STAGE_VERTEX_BIT = 0x00000001;
5+
public static final int VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002;
6+
public static final int VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004;
7+
public static final int VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008;
8+
public static final int VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010;
9+
public static final int VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020;
10+
public static final int VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F;
11+
public static final int VK_SHADER_STAGE_ALL = 0x7FFFFFFF;
12+
public static final int VK_SHADER_STAGE_RAYGEN_BIT_NV = 0x00000100;
13+
public static final int VK_SHADER_STAGE_ANY_HIT_BIT_NV = 0x00000200;
14+
public static final int VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV = 0x00000400;
15+
public static final int VK_SHADER_STAGE_MISS_BIT_NV = 0x00000800;
16+
public static final int VK_SHADER_STAGE_INTERSECTION_BIT_NV = 0x00001000;
17+
public static final int VK_SHADER_STAGE_CALLABLE_BIT_NV = 0x00002000;
18+
public static final int VK_SHADER_STAGE_TASK_BIT_NV = 0x00000040;
19+
public static final int VK_SHADER_STAGE_MESH_BIT_NV = 0x00000080;
20+
public static final int VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF;
21+
}

0 commit comments

Comments
 (0)