# HG changeset patch # User Sam # Date 1682009136 -25200 # Node ID 7f7e797335edfec6549c9728e806dde7f6f806e7 # Parent 512d33d314c4aae988c6fb88437e8601eb20d097 add: remove a few warning, improve a few things diff -r 512d33d314c4 -r 7f7e797335ed src/semicongine/config.nim --- a/src/semicongine/config.nim Thu Apr 20 21:59:52 2023 +0700 +++ b/src/semicongine/config.nim Thu Apr 20 23:45:36 2023 +0700 @@ -1,3 +1,4 @@ +import std/logging import std/parsecfg import std/strutils import std/sequtils @@ -112,3 +113,7 @@ var thethread: Thread[void] createThread(thethread, configFileWatchdog) +if DEBUG: + setLogFilter(lvlAll) +else: + setLogFilter(lvlWarn) diff -r 512d33d314c4 -r 7f7e797335ed src/semicongine/engine.nim --- a/src/semicongine/engine.nim Thu Apr 20 21:59:52 2023 +0700 +++ b/src/semicongine/engine.nim Thu Apr 20 23:45:36 2023 +0700 @@ -40,9 +40,10 @@ checkVkResult engine.device.vk.vkDeviceWaitIdle() engine.renderer.destroy() engine.device.destroy() - engine.debugger.destroy() + if engine.debugger.messenger.valid: + engine.debugger.destroy() + engine.window.destroy() engine.instance.destroy() - engine.window.destroy() engine.running = false diff -r 512d33d314c4 -r 7f7e797335ed src/semicongine/mesh.nim --- a/src/semicongine/mesh.nim Thu Apr 20 21:59:52 2023 +0700 +++ b/src/semicongine/mesh.nim Thu Apr 20 23:45:36 2023 +0700 @@ -112,6 +112,11 @@ func getRawData*(mesh: Mesh, attribute: string): (pointer, uint32) = mesh.data[attribute].getRawData() +proc setMeshData*[T: GPUType|int|uint|float](mesh: var Mesh, attribute: string, data: seq[T]) = + assert not (attribute in mesh.data) + mesh.data[attribute] = DataList(thetype: getDataType[T]()) + setValues(mesh.data[attribute], data) + proc setInstanceData*[T: GPUType|int|uint|float](mesh: var Mesh, attribute: string, data: seq[T]) = assert uint32(data.len) == mesh.instanceCount assert not (attribute in mesh.data) diff -r 512d33d314c4 -r 7f7e797335ed src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Thu Apr 20 21:59:52 2023 +0700 +++ b/src/semicongine/renderer.nim Thu Apr 20 23:45:36 2023 +0700 @@ -1,5 +1,4 @@ import std/options -import std/sequtils import std/tables import std/strformat import std/logging @@ -12,7 +11,6 @@ import ./vulkan/physicaldevice import ./vulkan/renderpass import ./vulkan/swapchain -import ./vulkan/syncing import ./entity import ./mesh diff -r 512d33d314c4 -r 7f7e797335ed src/semicongine/vulkan/renderpass.nim --- a/src/semicongine/vulkan/renderpass.nim Thu Apr 20 21:59:52 2023 +0700 +++ b/src/semicongine/vulkan/renderpass.nim Thu Apr 20 23:45:36 2023 +0700 @@ -71,12 +71,12 @@ vertexCode: ShaderCode, fragmentCode: ShaderCode, inFlightFrames: int = 2, - format = VkFormat(0), + format = VK_FORMAT_UNDEFINED , clearColor=Vec4f([0.8'f32, 0.8'f32, 0.8'f32, 1'f32]) ): RenderPass = assert device.vk.valid var theformat = format - if theformat == VkFormat(0): + if theformat == VK_FORMAT_UNDEFINED: theformat = device.physicalDevice.getSurfaceFormats().filterSurfaceFormat().format var attachments = @[VkAttachmentDescription( diff -r 512d33d314c4 -r 7f7e797335ed src/semicongine/vulkan/swapchain.nim --- a/src/semicongine/vulkan/swapchain.nim Thu Apr 20 21:59:52 2023 +0700 +++ b/src/semicongine/vulkan/swapchain.nim Thu Apr 20 23:45:36 2023 +0700 @@ -7,7 +7,6 @@ import ./device import ./physicaldevice import ./image -import ./renderpass import ./framebuffer import ./commandbuffer import ./syncing