Skip to content

Instantly share code, notes, and snippets.

@jsimmons
Created August 10, 2017 17:25
Show Gist options
  • Save jsimmons/78a84fb0a3570e66afc9542e67454065 to your computer and use it in GitHub Desktop.
Save jsimmons/78a84fb0a3570e66afc9542e67454065 to your computer and use it in GitHub Desktop.
Compiling shaders to SPIR-V in a Rust macro is neato
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