From 46f93779a09d390c2a73b99d1500c2b90f297ed0 Mon Sep 17 00:00:00 2001 From: maik klein Date: Fri, 9 Dec 2016 01:11:26 +0100 Subject: [PATCH] Multi color triangle --- examples/frag.spv | Bin 440 -> 448 bytes examples/src/main.rs | 45 +++++++++++++++++------------------------ examples/triangle.frag | 10 +++++++++ examples/triangle.vert | 13 ++++++++++++ examples/vert.spv | Bin 728 -> 852 bytes 5 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 examples/triangle.frag create mode 100644 examples/triangle.vert diff --git a/examples/frag.spv b/examples/frag.spv index 7daf2ceea01b903cc940f484338fa3ca64f343fe..e1a850d82440c1021c6ff732fae6dd6eea16e628 100644 GIT binary patch delta 160 zcmdnNe1MsknMs+Qfq@YSIT&~+@|udXGq5l)fN^eOW*(5qzzM|M6GPioS%JdbKu&&q za(+&J5raFB50aDvVh{lFxhFo1mQ?^UxPStTKnygU!5Yd3X=a?<$|$d53lss#@BlGL R)Q*7}Y!rz97pTtyhykHn51ar1 delta 153 zcmX@Wyn~sSnMs+Qfq@YSIT-jR@|p^>F|aT&fN^eOW*(5qz&SCpoz)#E#5tLjG1^lb z$YKKubAjZ50LJHraP47y9x%VbUWb7l2pJf7ff%F*qz)v() as u32, }]; let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo { s_type: vk::StructureType::PipelineVertexInputStateCreateInfo, @@ -765,7 +762,6 @@ fn main() { let present_complete_semaphore = device.create_semaphore(&semaphore_create_info).unwrap(); let rendering_complete_semaphore = device.create_semaphore(&semaphore_create_info).unwrap(); - /// / println!("{:?}", present_image_views.len()); let mut current = time::precise_time_ns(); let mut last = current; device.reset_fences(&[submit_fence]).unwrap(); @@ -779,7 +775,6 @@ fn main() { current = time::precise_time_ns(); let dt = current - last; last = current; - println!("dt: {}ms", dt/1000000); let present_index = device.acquire_next_image_khr(swapchain, std::u64::MAX, present_complete_semaphore, @@ -833,7 +828,6 @@ fn main() { }; device.queue_submit(present_queue, &[submit_info], draw_fence) .unwrap(); - let mut present_info_err = unsafe { mem::uninitialized() }; let present_info = vk::PresentInfoKHR { s_type: vk::StructureType::PresentInfoKhr, @@ -849,7 +843,6 @@ fn main() { device.wait_for_fences(&[draw_fence], true, std::u64::MAX) .unwrap(); device.reset_fences(&[draw_fence]).unwrap(); - // device.queue_wait_idle(present_queue).unwrap(); } device.device_wait_idle().unwrap(); diff --git a/examples/triangle.frag b/examples/triangle.frag new file mode 100644 index 0000000..299ad8f --- /dev/null +++ b/examples/triangle.frag @@ -0,0 +1,10 @@ +#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; +} diff --git a/examples/triangle.vert b/examples/triangle.vert new file mode 100644 index 0000000..836fc7a --- /dev/null +++ b/examples/triangle.vert @@ -0,0 +1,13 @@ +#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; +} diff --git a/examples/vert.spv b/examples/vert.spv index 0e386015c72ae0828b8b59631cdde7f107b7a5f0..8d8a6f1d53465143793f9490531950e43059cbf1 100644 GIT binary patch literal 852 zcmY+COH0E*6otp858v;$E~Hdk3L;WP5CtC)7hQ;g+YsvzqcsUh1o2n+bKMA@Z`y!P zxw&)BJ(+XwG+u4DWz39zvu4Xo)|#ma8?#`VF8jm#;eJs*?GKI)P%InI3DK;WIk&It z`4+|r0A@k4u4pSf{c6fzdZDhWKMXGJE`!2mVIGz?D4xS7n+NIRiyf84e~n6U5(VQh ziQdD=27|+cEF8U>hEDqH3C1@KM(H@sU7a2#$Ot#hs&F(8Zf*Wx^U{6@ikhsFrLmbdZ32KnlgUOMGs)UCpbJd zl=}+K!~?vkV4i5QVS(uT^WU)s2*hOQ960B8Wm&sEaPdg4+<=ON`buBoV}?@NwM;o-b`c zCrr-FnR936CdI;0)tEIsHPbOmYng&_V?amPFqJGHjVI$?lFoXA(>}^AQv|YF)2NNC zB!BaQka$zxk{9(9gkNe}GIcW=yTgZTH?ffyd#QDkXK!X>ck%RMr)lzEqf!w1?%WIg zch9%(;G`dU(^pegr@ynx+OeS-{@lH{@uQ7X`=M0qk|(CNNP;w2gkr0io_l6|5T=vh z)1u33?5x_&Jcw?CB=y3n)!brsFLcD*FIpt#P8svD9CMBtaA3~S8;&nH(wi7=q+8Lm zE63Vm;SZ%jOT4G3B6Q^Y((~oX`5qm;YeGkk9k24bV&)$xUl*c>>#p|Bdr)(v*$^_1 zy)ITc{}YZGTS7-pPiBxesp@?Q)cKFI(8