mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-19 20:19:13 +12:00
Add Vulkan Host-Shader compilation
Compiles Vulkan Host shaders into spirv binary files and embeds them into the application's virtual file-system.
This commit is contained in:
parent
f62f1bf9b2
commit
97b6b7f122
3 changed files with 51 additions and 1 deletions
7
src/host_shaders/vulkan_display.frag
Normal file
7
src/host_shaders/vulkan_display.frag
Normal file
|
@ -0,0 +1,7 @@
|
|||
#version 460 core
|
||||
layout(location = 0) in vec2 UV;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
layout(binding = 0) uniform sampler2D u_texture;
|
||||
|
||||
void main() { FragColor = texture(u_texture, UV); }
|
23
src/host_shaders/vulkan_display.vert
Normal file
23
src/host_shaders/vulkan_display.vert
Normal file
|
@ -0,0 +1,23 @@
|
|||
#version 460 core
|
||||
layout(location = 0) out vec2 UV;
|
||||
|
||||
void main() {
|
||||
const vec4 positions[4] = vec4[](
|
||||
vec4(-1.0, 1.0, 1.0, 1.0), // Top-left
|
||||
vec4(1.0, 1.0, 1.0, 1.0), // Top-right
|
||||
vec4(-1.0, -1.0, 1.0, 1.0), // Bottom-left
|
||||
vec4(1.0, -1.0, 1.0, 1.0) // Bottom-right
|
||||
);
|
||||
|
||||
// The 3DS displays both screens' framebuffer rotated 90 deg counter clockwise
|
||||
// So we adjust our texcoords accordingly
|
||||
const vec2 texcoords[4] = vec2[](
|
||||
vec2(1.0, 1.0), // Top-right
|
||||
vec2(1.0, 0.0), // Bottom-right
|
||||
vec2(0.0, 1.0), // Top-left
|
||||
vec2(0.0, 0.0) // Bottom-left
|
||||
);
|
||||
|
||||
gl_Position = positions[gl_VertexIndex];
|
||||
UV = texcoords[gl_VertexIndex];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue