-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[imgui] use precompiled shaders for imgui
this makes le_imgui self-contained, as it embeds both its default shaders, and its default font file. [le_window] reformat [le_core] update comment
- Loading branch information
Showing
8 changed files
with
165 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# Generates .h files holding SPIR-V (encoded as uint32_t array) | ||
# from .vert/.frag/.comp glsl code. | ||
|
||
for FILE in *.{comp,vert,frag}; do | ||
|
||
# In case there is no match, $FILE may still contain something like "*.comp" | ||
# in which case we want to skip this iteration of the loop. | ||
if [ ! -e "$FILE" ]; then | ||
continue | ||
fi | ||
|
||
FILENAME="${FILE%.*}_${FILE#*.}" | ||
VARNAME=$(echo "SPIRV_SOURCE_${FILENAME}" | tr '[:lower:]' '[:upper:]') | ||
|
||
echo "$FILE → ${FILENAME}.h" | ||
glslang -o "${FILENAME}.h" -V --vn "$VARNAME" "$FILE" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#version 450 core | ||
|
||
#extension GL_ARB_separate_shader_objects : enable | ||
#extension GL_ARB_shading_language_420pack : enable | ||
|
||
layout (set = 0, binding = 1) uniform sampler2D tex_unit_0; | ||
|
||
// inputs | ||
layout (location = 0) in vec4 inColor; | ||
layout (location = 1) in vec2 inTexCoord; | ||
|
||
// outputs | ||
layout (location = 0) out vec4 outFragColor; | ||
|
||
void main() | ||
{ | ||
outFragColor = inColor * texture( tex_unit_0, inTexCoord.st); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#version 450 core | ||
|
||
#extension GL_ARB_separate_shader_objects : enable | ||
#extension GL_ARB_shading_language_420pack : enable | ||
|
||
// uniforms (resources) | ||
layout (set = 0, binding = 0) uniform Mvp | ||
{ | ||
mat4 modelViewProjectionMatrix; | ||
}; | ||
|
||
// inputs (vertex attributes) | ||
layout (location = 0) in vec2 inPos; | ||
layout (location = 1) in vec2 inTexCoord; | ||
layout (location = 2) in vec4 inColor; | ||
|
||
// outputs | ||
layout (location = 0) out vec4 outColor; | ||
layout (location = 1) out vec2 outTexCoord; | ||
|
||
// we override the built-in fixed function outputs | ||
// to have more control over the SPIR-V code created. | ||
out gl_PerVertex | ||
{ | ||
vec4 gl_Position; | ||
}; | ||
|
||
void main() | ||
{ | ||
outTexCoord = inTexCoord; | ||
outColor = inColor; | ||
gl_Position = modelViewProjectionMatrix * vec4(inPos,0,1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// 1113.1.1 | ||
#pragma once | ||
const uint32_t SPIRV_SOURCE_IMGUI_FRAG[] = { | ||
0x07230203,0x00010000,0x0008000b,0x00000018,0x00000000,0x00020011,0x00000001,0x0006000b, | ||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, | ||
0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000b,0x00000014, | ||
0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, | ||
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004, | ||
0x415f4c47,0x735f4252,0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361, | ||
0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000009,0x4674756f,0x43676172, | ||
0x726f6c6f,0x00000000,0x00040005,0x0000000b,0x6f436e69,0x00726f6c,0x00050005,0x00000010, | ||
0x5f786574,0x74696e75,0x0000305f,0x00050005,0x00000014,0x65546e69,0x6f6f4378,0x00006472, | ||
0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000, | ||
0x00040047,0x00000010,0x00000022,0x00000000,0x00040047,0x00000010,0x00000021,0x00000001, | ||
0x00040047,0x00000014,0x0000001e,0x00000001,0x00020013,0x00000002,0x00030021,0x00000003, | ||
0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004, | ||
0x00040020,0x00000008,0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003, | ||
0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001, | ||
0x00090019,0x0000000d,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001, | ||
0x00000000,0x0003001b,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000000,0x0000000e, | ||
0x0004003b,0x0000000f,0x00000010,0x00000000,0x00040017,0x00000012,0x00000006,0x00000002, | ||
0x00040020,0x00000013,0x00000001,0x00000012,0x0004003b,0x00000013,0x00000014,0x00000001, | ||
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d, | ||
0x00000007,0x0000000c,0x0000000b,0x0004003d,0x0000000e,0x00000011,0x00000010,0x0004003d, | ||
0x00000012,0x00000015,0x00000014,0x00050057,0x00000007,0x00000016,0x00000011,0x00000015, | ||
0x00050085,0x00000007,0x00000017,0x0000000c,0x00000016,0x0003003e,0x00000009,0x00000017, | ||
0x000100fd,0x00010038 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 1113.1.1 | ||
#pragma once | ||
const uint32_t SPIRV_SOURCE_IMGUI_VERT[] = { | ||
0x07230203,0x00010000,0x0008000b,0x00000028,0x00000000,0x00020011,0x00000001,0x0006000b, | ||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, | ||
0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000b,0x0000000f, | ||
0x00000011,0x00000015,0x0000001f,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, | ||
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004, | ||
0x415f4c47,0x735f4252,0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361, | ||
0x00040005,0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x5474756f,0x6f437865, | ||
0x0064726f,0x00050005,0x0000000b,0x65546e69,0x6f6f4378,0x00006472,0x00050005,0x0000000f, | ||
0x4374756f,0x726f6c6f,0x00000000,0x00040005,0x00000011,0x6f436e69,0x00726f6c,0x00060005, | ||
0x00000013,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000013,0x00000000, | ||
0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x00000015,0x00000000,0x00030005,0x00000019, | ||
0x0070764d,0x000a0006,0x00000019,0x00000000,0x65646f6d,0x6569566c,0x6f725077,0x7463656a, | ||
0x4d6e6f69,0x69727461,0x00000078,0x00030005,0x0000001b,0x00000000,0x00040005,0x0000001f, | ||
0x6f506e69,0x00000073,0x00040047,0x00000009,0x0000001e,0x00000001,0x00040047,0x0000000b, | ||
0x0000001e,0x00000001,0x00040047,0x0000000f,0x0000001e,0x00000000,0x00040047,0x00000011, | ||
0x0000001e,0x00000002,0x00050048,0x00000013,0x00000000,0x0000000b,0x00000000,0x00030047, | ||
0x00000013,0x00000002,0x00040048,0x00000019,0x00000000,0x00000005,0x00050048,0x00000019, | ||
0x00000000,0x00000023,0x00000000,0x00050048,0x00000019,0x00000000,0x00000007,0x00000010, | ||
0x00030047,0x00000019,0x00000002,0x00040047,0x0000001b,0x00000022,0x00000000,0x00040047, | ||
0x0000001b,0x00000021,0x00000000,0x00040047,0x0000001f,0x0000001e,0x00000000,0x00020013, | ||
0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017, | ||
0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000003,0x00000007,0x0004003b, | ||
0x00000008,0x00000009,0x00000003,0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b, | ||
0x0000000a,0x0000000b,0x00000001,0x00040017,0x0000000d,0x00000006,0x00000004,0x00040020, | ||
0x0000000e,0x00000003,0x0000000d,0x0004003b,0x0000000e,0x0000000f,0x00000003,0x00040020, | ||
0x00000010,0x00000001,0x0000000d,0x0004003b,0x00000010,0x00000011,0x00000001,0x0003001e, | ||
0x00000013,0x0000000d,0x00040020,0x00000014,0x00000003,0x00000013,0x0004003b,0x00000014, | ||
0x00000015,0x00000003,0x00040015,0x00000016,0x00000020,0x00000001,0x0004002b,0x00000016, | ||
0x00000017,0x00000000,0x00040018,0x00000018,0x0000000d,0x00000004,0x0003001e,0x00000019, | ||
0x00000018,0x00040020,0x0000001a,0x00000002,0x00000019,0x0004003b,0x0000001a,0x0000001b, | ||
0x00000002,0x00040020,0x0000001c,0x00000002,0x00000018,0x0004003b,0x0000000a,0x0000001f, | ||
0x00000001,0x0004002b,0x00000006,0x00000021,0x00000000,0x0004002b,0x00000006,0x00000022, | ||
0x3f800000,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005, | ||
0x0004003d,0x00000007,0x0000000c,0x0000000b,0x0003003e,0x00000009,0x0000000c,0x0004003d, | ||
0x0000000d,0x00000012,0x00000011,0x0003003e,0x0000000f,0x00000012,0x00050041,0x0000001c, | ||
0x0000001d,0x0000001b,0x00000017,0x0004003d,0x00000018,0x0000001e,0x0000001d,0x0004003d, | ||
0x00000007,0x00000020,0x0000001f,0x00050051,0x00000006,0x00000023,0x00000020,0x00000000, | ||
0x00050051,0x00000006,0x00000024,0x00000020,0x00000001,0x00070050,0x0000000d,0x00000025, | ||
0x00000023,0x00000024,0x00000021,0x00000022,0x00050091,0x0000000d,0x00000026,0x0000001e, | ||
0x00000025,0x00050041,0x0000000e,0x00000027,0x00000015,0x00000017,0x0003003e,0x00000027, | ||
0x00000026,0x000100fd,0x00010038 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters