mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Revert the triangle example to what it was
This commit is contained in:
parent
39a97f2354
commit
61dc795e03
@ -6,7 +6,6 @@ build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
vulkano = { path = "../vulkano" }
|
||||
vulkano-shader-derive = { path = "../vulkano-shader-derive" }
|
||||
vulkano-win = { path = "../vulkano-win" }
|
||||
cgmath = "0.12.0"
|
||||
image = "0.6.1"
|
||||
|
@ -3,6 +3,8 @@ extern crate vulkano_shaders;
|
||||
fn main() {
|
||||
// building the shaders used in the examples
|
||||
vulkano_shaders::build_glsl_shaders([
|
||||
("src/bin/triangle_vs.glsl", vulkano_shaders::ShaderType::Vertex),
|
||||
("src/bin/triangle_fs.glsl", vulkano_shaders::ShaderType::Fragment),
|
||||
("src/bin/teapot_vs.glsl", vulkano_shaders::ShaderType::Vertex),
|
||||
("src/bin/teapot_fs.glsl", vulkano_shaders::ShaderType::Fragment),
|
||||
("src/bin/image_vs.glsl", vulkano_shaders::ShaderType::Vertex),
|
||||
|
@ -28,8 +28,6 @@ extern crate winit;
|
||||
// winit, and winit doesn't know about vulkano, so import a crate that will provide a link between
|
||||
// the two.
|
||||
extern crate vulkano_win;
|
||||
#[macro_use]
|
||||
extern crate vulkano_shader_derive;
|
||||
|
||||
use vulkano_win::VkSurfaceBuild;
|
||||
|
||||
@ -215,40 +213,9 @@ fn main() {
|
||||
// can now use to load the shader.
|
||||
//
|
||||
// Because of some restrictions with the `include!` macro, we need to use a module.
|
||||
mod vs {
|
||||
#[derive(VulkanoShader)]
|
||||
#[ty = "vertex"]
|
||||
#[src = "
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_450pack : enable
|
||||
|
||||
layout(location = 0) in vec2 position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(position, 0.0, 1.0);
|
||||
}"]
|
||||
struct Dummy;
|
||||
}
|
||||
mod vs { include!{concat!(env!("OUT_DIR"), "/shaders/src/bin/triangle_vs.glsl")} }
|
||||
let vs = vs::Shader::load(&device).expect("failed to create shader module");
|
||||
|
||||
mod fs {
|
||||
#[derive(VulkanoShader)]
|
||||
#[ty = "fragment"]
|
||||
#[src = "
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_450pack : enable
|
||||
|
||||
layout(location = 0) out vec4 f_color;
|
||||
|
||||
void main() {
|
||||
f_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}"]
|
||||
struct Dummy;
|
||||
}
|
||||
mod fs { include!{concat!(env!("OUT_DIR"), "/shaders/src/bin/triangle_fs.glsl")} }
|
||||
let fs = fs::Shader::load(&device).expect("failed to create shader module");
|
||||
|
||||
// At this point, OpenGL initialization would be finished. However in Vulkan it is not. OpenGL
|
||||
|
19
examples/src/bin/triangle_fs.glsl
Normal file
19
examples/src/bin/triangle_fs.glsl
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2016 The vulkano developers
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
|
||||
// at your option. All files in the project carrying such
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_450pack : enable
|
||||
|
||||
layout(location = 0) out vec4 f_color;
|
||||
|
||||
void main() {
|
||||
f_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
19
examples/src/bin/triangle_vs.glsl
Normal file
19
examples/src/bin/triangle_vs.glsl
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2016 The vulkano developers
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
|
||||
// at your option. All files in the project carrying such
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_450pack : enable
|
||||
|
||||
layout(location = 0) in vec2 position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(position, 0.0, 1.0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user