Mercurial > games > semicongine
diff tests/test_vulkan_wrapper.nim @ 113:7b695fb335ed
did: first final implementation of scene-graph <-> pipeline connection, not working yet
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 02 Apr 2023 01:22:09 +0700 |
parents | 0c5a74885796 |
children | 056e08dfad10 |
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim Sat Apr 01 00:40:02 2023 +0700 +++ b/tests/test_vulkan_wrapper.nim Sun Apr 02 01:22:09 2023 +0700 @@ -58,12 +58,12 @@ selectedPhysicalDevice.filterForGraphicsPresentationQueues() ) - const inputs = AttributeGroup(attributes: @[attr(name="pos", thetype=Float32, components=3)]) + const inputs = AttributeGroup(attributes: @[attr(name="position", thetype=Float32, components=3)]) const uniforms = AttributeGroup() const outputs = AttributeGroup(attributes: @[attr(name="fragpos", thetype=Float32, components=3)]) const fragOutput = AttributeGroup(attributes: @[attr(name="color", thetype=Float32, components=4)]) - const vertexBinary = shaderCode(inputs=inputs, uniforms=uniforms, outputs=outputs, stage=VK_SHADER_STAGE_VERTEX_BIT, version=450, entrypoint="main", "fragpos = pos;") - const fragmentBinary = shaderCode(inputs=outputs, uniforms=uniforms, outputs=fragOutput, stage=VK_SHADER_STAGE_FRAGMENT_BIT, version=450, entrypoint="main", "color = vec4(1, 1, 1, 0);") + const vertexBinary = shaderCode(inputs=inputs, uniforms=uniforms, outputs=outputs, stage=VK_SHADER_STAGE_VERTEX_BIT, version=450, entrypoint="main", "fragpos = position;") + const fragmentBinary = shaderCode(inputs=outputs, uniforms=uniforms, outputs=fragOutput, stage=VK_SHADER_STAGE_FRAGMENT_BIT, version=450, entrypoint="main", "color = vec4(1, 1, 1, 1);") var vertexshader = device.createShader(inputs, uniforms, outputs, VK_SHADER_STAGE_VERTEX_BIT, "main", vertexBinary) fragmentshader = device.createShader(inputs, uniforms, outputs, VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragmentBinary) @@ -73,7 +73,13 @@ if res != VK_SUCCESS: raise newException(Exception, "Unable to create swapchain") - var thescene = Scene(name: "main", root: newEntity("triangle", newMesh([newVec3(-1, -1), newVec3(0, 1), newVec3(1, -1)]))) + var thescene = Scene( + name: "main", + root: newEntity("root", + newEntity("triangle1", newMesh([newVec3f(-0.5, -0.5), newVec3f(0.5, 0.5), newVec3f(0.5, -0.5)])), + newEntity("triangle2", newMesh([newVec3f(-0.5, -0.5), newVec3f(0.5, -0.5), newVec3f(0.5, 0.5)])), + ) + ) thescene.setupDrawables(renderPass) echo "Setup successfull, start rendering" @@ -85,6 +91,7 @@ # cleanup checkVkResult device.vk.vkDeviceWaitIdle() + thescene.destroy() vertexshader.destroy() fragmentshader.destroy() renderPass.destroy()