Skip to content

Commit 92b3afd

Browse files
committed
Fix ImGui.NET.SampleProgram to work with
Vulkan on the latest Vildrid releases
1 parent 66f1afa commit 92b3afd

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

src/ImGui.NET.SampleProgram/ImGuiController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDes
9999

100100
byte[] vertexShaderBytes = LoadEmbeddedShaderCode(gd.ResourceFactory, "imgui-vertex", ShaderStages.Vertex);
101101
byte[] fragmentShaderBytes = LoadEmbeddedShaderCode(gd.ResourceFactory, "imgui-frag", ShaderStages.Fragment);
102-
_vertexShader = factory.CreateShader(new ShaderDescription(ShaderStages.Vertex, vertexShaderBytes, "VS"));
103-
_fragmentShader = factory.CreateShader(new ShaderDescription(ShaderStages.Fragment, fragmentShaderBytes, "FS"));
102+
_vertexShader = factory.CreateShader(new ShaderDescription(ShaderStages.Vertex, vertexShaderBytes, "main"));
103+
_fragmentShader = factory.CreateShader(new ShaderDescription(ShaderStages.Fragment, fragmentShaderBytes, "main"));
104104

105105
VertexLayoutDescription[] vertexLayouts = new VertexLayoutDescription[]
106106
{

src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-frag.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ layout (location = 0) out vec4 outputColor;
1313
void main()
1414
{
1515
outputColor = color * texture(sampler2D(FontTexture, FontSampler), texCoord);
16-
}
16+
}
0 Bytes
Binary file not shown.

src/ImGui.NET.SampleProgram/Shaders/SPIR-V/imgui-vertex.glsl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@
33
#extension GL_ARB_separate_shader_objects : enable
44
#extension GL_ARB_shading_language_420pack : enable
55

6-
layout (location = 0) in vec2 vsin_position;
7-
layout (location = 1) in vec2 vsin_texCoord;
8-
layout (location = 2) in vec4 vsin_color;
6+
layout (location = 0) in vec2 in_position;
7+
layout (location = 1) in vec2 in_texCoord;
8+
layout (location = 2) in vec4 in_color;
99

10-
layout (binding = 0) uniform Projection
10+
layout (binding = 0) uniform ProjectionMatrixBuffer
1111
{
12-
mat4 projection;
12+
mat4 projection_matrix;
1313
};
1414

15-
layout (location = 0) out vec4 vsout_color;
16-
layout (location = 1) out vec2 vsout_texCoord;
15+
layout (location = 0) out vec4 color;
16+
layout (location = 1) out vec2 texCoord;
1717

18-
out gl_PerVertex
18+
out gl_PerVertex
1919
{
2020
vec4 gl_Position;
2121
};
2222

2323
void main()
2424
{
25-
gl_Position = projection * vec4(vsin_position, 0, 1);
26-
vsout_color = vsin_color;
27-
vsout_texCoord = vsin_texCoord;
28-
gl_Position.y = -gl_Position.y;
25+
gl_Position = projection_matrix * vec4(in_position, 0, 1);
26+
color = in_color;
27+
texCoord = in_texCoord;
2928
}
-136 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)