comparison src/vulkan_api/vulkan_api_generator.nim @ 222:ddfc54036e00

add: basic loading of glTF files (*.glb), no materials yet
author Sam <sam@basx.dev>
date Mon, 15 May 2023 00:34:00 +0700
parents 7f921d7d0a2b
children
comparison
equal deleted inserted replaced
221:2a2367d289dd 222:ddfc54036e00
420 "import std/tables", 420 "import std/tables",
421 "import std/strutils", 421 "import std/strutils",
422 "import std/logging", 422 "import std/logging",
423 "import std/typetraits", 423 "import std/typetraits",
424 "import std/macros", 424 "import std/macros",
425 "import std/private/digitsutils",
426 "type", 425 "type",
427 " VkHandle* = distinct uint", 426 " VkHandle* = distinct uint",
428 " VkNonDispatchableHandle* = distinct uint", 427 " VkNonDispatchableHandle* = distinct uint",
429 "when defined(linux):", 428 "when defined(linux):",
430 " let vulkanLib* = loadLib(\"libvulkan.so.1\")", 429 " let vulkanLib* = loadLib(\"libvulkan.so.1\")",
659 mainout.add "block globalFunctions:" 658 mainout.add "block globalFunctions:"
660 mainout.add " let instance = VkInstance(0)" 659 mainout.add " let instance = VkInstance(0)"
661 for l in GLOBAL_COMMANDS: 660 for l in GLOBAL_COMMANDS:
662 mainout.add procLoads[l] 661 mainout.add procLoads[l]
663 mainout.add "" 662 mainout.add ""
664 mainout.add "converter VkBool2NimBool*(a: VkBool32): bool = a > 0" 663 # produces error if enable both implicit converters
664 # mainout.add "converter VkBool2NimBool*(a: VkBool32): bool = a > 0"
665 mainout.add "converter NimBool2VkBool*(a: bool): VkBool32 = VkBool32(a)" 665 mainout.add "converter NimBool2VkBool*(a: bool): VkBool32 = VkBool32(a)"
666 mainout.add "proc `$`*(x: uint32): string {.raises: [].} = addInt(result, x)"
667 666
668 writeFile outdir / &"api.nim", mainout.join("\n") 667 writeFile outdir / &"api.nim", mainout.join("\n")
669 668
670 669
671 for filename, filecontent in outputFiles.pairs: 670 for filename, filecontent in outputFiles.pairs: