Created
August 10, 2017 17:25
-
-
Save jsimmons/78a84fb0a3570e66afc9542e67454065 to your computer and use it in GitHub Desktop.
Compiling shaders to SPIR-V in a Rust macro is neato
This file contains hidden or 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
fn main() { | |
static TEST_VS: &'static [u8] = glsl_vs!{r#" | |
#version 400 | |
#extension GL_ARB_separate_shader_objects : enable | |
#extension GL_ARB_shading_language_420pack : enable | |
layout (location = 0) in vec4 pos; | |
layout (location = 1) in vec4 color; | |
layout (location = 0) out vec4 o_color; | |
void main() { | |
o_color = color; | |
gl_Position = pos; | |
} | |
"#}; | |
static TEST_FS: &'static [u8] = glsl_fs!{r#" | |
#version 400 | |
#extension GL_ARB_separate_shader_objects : enable | |
#extension GL_ARB_shading_language_420pack : enable | |
layout (location = 0) in vec4 o_color; | |
layout (location = 0) out vec4 uFragColor; | |
void main() { | |
uFragColor = o_color; | |
} | |
"#}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment