From 92b3afdf82b35cc0cf22653f20e247a402b0e8b9 Mon Sep 17 00:00:00 2001 From: Kaydax Date: Thu, 24 Dec 2020 10:36:32 -0500 Subject: [PATCH] Fix ImGui.NET.SampleProgram to work with Vulkan on the latest Vildrid releases --- .../ImGuiController.cs | 4 +-- .../Shaders/SPIR-V/imgui-frag.glsl | 2 +- .../Shaders/SPIR-V/imgui-frag.spv | Bin 868 -> 868 bytes .../Shaders/SPIR-V/imgui-vertex.glsl | 23 +++++++++--------- .../Shaders/SPIR-V/imgui-vertex.spv | Bin 1444 -> 1308 bytes 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/ImGui.NET.SampleProgram/ImGuiController.cs b/src/ImGui.NET.SampleProgram/ImGuiController.cs index 3c600ad..b636e28 100644 --- a/src/ImGui.NET.SampleProgram/ImGuiController.cs +++ b/src/ImGui.NET.SampleProgram/ImGuiController.cs @@ -99,8 +99,8 @@ namespace ImGuiNET byte[] vertexShaderBytes = LoadEmbeddedShaderCode(gd.ResourceFactory, "imgui-vertex", ShaderStages.Vertex); byte[] fragmentShaderBytes = LoadEmbeddedShaderCode(gd.ResourceFactory, "imgui-frag", ShaderStages.Fragment); - _vertexShader = factory.CreateShader(new ShaderDescription(ShaderStages.Vertex, vertexShaderBytes, "VS")); - _fragmentShader = factory.CreateShader(new ShaderDescription(ShaderStages.Fragment, fragmentShaderBytes, "FS")); + _vertexShader = factory.CreateShader(new ShaderDescription(ShaderStages.Vertex, vertexShaderBytes, "main")); + _fragmentShader = factory.CreateShader(new ShaderDescription(ShaderStages.Fragment, fragmentShaderBytes, "main")); VertexLayoutDescription[] vertexLayouts = new VertexLayoutDescription[] { diff --git a/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.glsl b/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.glsl index 2d1c1d7..f94fa48 100644 --- a/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.glsl +++ b/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.glsl @@ -13,4 +13,4 @@ layout (location = 0) out vec4 outputColor; void main() { outputColor = color * texture(sampler2D(FontTexture, FontSampler), texCoord); -} +} \ No newline at end of file diff --git a/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.spv b/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.spv index c8d71cc6f5d75cf680b533a3ce31c8fea24c82f6..5d3d96f32e08822f4621e0f813cf814e668b2a67 100644 GIT binary patch delta 18 ZcmaFD_Joa-nMs+Qfq{{MYa?egGXN!T126yp delta 18 ZcmaFD_Joa-nMs+Qfq{{MX(MMeGXNz=11JCh diff --git a/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.glsl b/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.glsl index 6fdab3f..6249a36 100644 --- a/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.glsl +++ b/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.glsl @@ -3,27 +3,26 @@ #extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_shading_language_420pack : enable -layout (location = 0) in vec2 vsin_position; -layout (location = 1) in vec2 vsin_texCoord; -layout (location = 2) in vec4 vsin_color; +layout (location = 0) in vec2 in_position; +layout (location = 1) in vec2 in_texCoord; +layout (location = 2) in vec4 in_color; -layout (binding = 0) uniform Projection +layout (binding = 0) uniform ProjectionMatrixBuffer { - mat4 projection; + mat4 projection_matrix; }; -layout (location = 0) out vec4 vsout_color; -layout (location = 1) out vec2 vsout_texCoord; +layout (location = 0) out vec4 color; +layout (location = 1) out vec2 texCoord; -out gl_PerVertex +out gl_PerVertex { vec4 gl_Position; }; void main() { - gl_Position = projection * vec4(vsin_position, 0, 1); - vsout_color = vsin_color; - vsout_texCoord = vsin_texCoord; - gl_Position.y = -gl_Position.y; + gl_Position = projection_matrix * vec4(in_position, 0, 1); + color = in_color; + texCoord = in_texCoord; } diff --git a/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.spv b/src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.spv index 795cd0e728725a28a1c8d616cba0cdb494434aff..b40ec8ca53630b09e586eda3ada5c2196a047e3e 100644 GIT binary patch delta 211 zcmZ3&J%@{znMs+Qfq{{Mi-ChdV=Hxy&Ezb>^7c8CXVX8z&VTdj>z137d#bSQ~I z+V@y1%3