Skip to content

Commit ad2ffaa

Browse files
EnaiumDeepSeek
andcommitted
feat(lwjgl3): add Vulkan renderer backend
Port of the Dear ImGui Vulkan renderer (imgui_impl_vulkan) into the imgui-lwjgl3 module: - ImGuiImplVulkan renderer with descriptor sets, pipeline creation and font atlas upload; shader SPIR-V shipped as classpath resources - ImGuiImplVulkanH helper structures - createVulkanSurface() helpers for the GLFW and SDL3 backends - imgui-app: VULKAN backend with WindowVulkan (swapchain, render pass, per-frame sync objects and resize handling) - example: ExampleVulkan smoke test Co-authored-by: DeepSeek <noreply@deepseek.com>
1 parent d95baae commit ad2ffaa

12 files changed

Lines changed: 2664 additions & 2 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import imgui.ImGui;
2+
import imgui.app.Application;
3+
import imgui.app.Backend;
4+
import imgui.app.Configuration;
5+
6+
/**
7+
* Smoke-test entry point for the Vulkan backend. Run with:
8+
* <pre>
9+
* ./gradlew :example:run -PmainClass=ExampleVulkan
10+
* </pre>
11+
*/
12+
public class ExampleVulkan extends Application {
13+
@Override
14+
protected void configure(final Configuration config) {
15+
config.setTitle("Example Application — Vulkan");
16+
config.setBackend(Backend.VULKAN);
17+
}
18+
19+
@Override
20+
public void process() {
21+
ImGui.begin("Vulkan");
22+
ImGui.text("Hello from the Vulkan backend!");
23+
ImGui.end();
24+
}
25+
26+
public static void main(final String[] args) {
27+
launch(new ExampleVulkan());
28+
}
29+
}

‎imgui-app/build.gradle‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies {
2323
api 'org.lwjgl:lwjgl-glfw'
2424
api 'org.lwjgl:lwjgl-opengl'
2525
api 'org.lwjgl:lwjgl-sdl'
26+
api 'org.lwjgl:lwjgl-vulkan'
2627

2728
['natives-linux', 'natives-windows', 'natives-macos', 'natives-macos-arm64'].each {
2829
api "org.lwjgl:lwjgl::$it"

‎imgui-app/src/main/java/imgui/app/Application.java‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,18 @@ public final Color getColorBg() {
134134
public static void launch(final Application app) {
135135
final Configuration config = new Configuration();
136136
app.configure(config);
137-
app.window = (config.getBackend() == Backend.SDL) ? new WindowSdl() : new WindowGlfw();
137+
switch (config.getBackend()) {
138+
case SDL:
139+
app.window = new WindowSdl();
140+
break;
141+
case VULKAN:
142+
app.window = new WindowVulkan();
143+
break;
144+
case GLFW:
145+
default:
146+
app.window = new WindowGlfw();
147+
break;
148+
}
138149
app.window.setOwner(app);
139150
app.window.init(config);
140151
app.preRun();

‎imgui-app/src/main/java/imgui/app/Backend.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ public enum Backend {
1111
/**
1212
* SDL3 platform + SDL_GPU renderer.
1313
*/
14-
SDL
14+
SDL,
15+
/**
16+
* GLFW platform + Vulkan renderer.
17+
*/
18+
VULKAN
1519
}

0 commit comments

Comments
 (0)