Mercurial > games > semicongine
comparison tests/test_vulkan_wrapper.nim @ 131:11666d28e04d
add: recreation of swapchain (at least on linux, windows will likely fail, needs testing
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 19 Apr 2023 01:45:16 +0700 |
parents | 15d37022625c |
children | 250e1dcbfec9 |
comparison
equal
deleted
inserted
replaced
130:ff345f9e4eb7 | 131:11666d28e04d |
---|---|
133 main="color = vec4(outcolor, 1);" | 133 main="color = vec4(outcolor, 1);" |
134 ) | 134 ) |
135 var | 135 var |
136 surfaceFormat = engine.gpuDevice.physicalDevice.getSurfaceFormats().filterSurfaceFormat() | 136 surfaceFormat = engine.gpuDevice.physicalDevice.getSurfaceFormats().filterSurfaceFormat() |
137 renderPass = engine.gpuDevice.simpleForwardRenderPass(surfaceFormat.format, vertexCode, fragmentCode, 2) | 137 renderPass = engine.gpuDevice.simpleForwardRenderPass(surfaceFormat.format, vertexCode, fragmentCode, 2) |
138 engine.setRenderer([renderPass]) | 138 engine.setRenderer(renderPass) |
139 | 139 |
140 # INIT SCENES | 140 # INIT SCENES |
141 var scenes = [scene_simple(), scene_different_mesh_types(), scene_primitives()] | 141 var scenes = [scene_simple(), scene_different_mesh_types(), scene_primitives()] |
142 var time = initShaderGlobal("time", 0.0'f32) | 142 var time = initShaderGlobal("time", 0.0'f32) |
143 for scene in scenes.mitems: | 143 for scene in scenes.mitems: |
152 engine.updateInputs() | 152 engine.updateInputs() |
153 setValue[float32](time.value, get[float32](time.value) + 0.0005) | 153 setValue[float32](time.value, get[float32](time.value) + 0.0005) |
154 if not engine.running or engine.keyIsDown(Escape): | 154 if not engine.running or engine.keyIsDown(Escape): |
155 engine.destroy() | 155 engine.destroy() |
156 return | 156 return |
157 discard engine.renderScene(scene) | 157 engine.renderScene(scene) |
158 echo "Rendered ", engine.framesRendered, " frames" | 158 echo "Rendered ", engine.framesRendered, " frames" |
159 echo "Processed ", engine.eventsProcessed, " events" | 159 echo "Processed ", engine.eventsProcessed, " events" |
160 | 160 |
161 # cleanup | 161 # cleanup |
162 echo "Start cleanup" | 162 echo "Start cleanup" |