diff src/vulkan_api/vulkan_api_generator.nim @ 94:f036546f5ea2

add: device, surface and refactoring
author Sam <sam@basx.dev>
date Tue, 28 Feb 2023 23:51:07 +0700
parents e872cf354110
children 110ed3ee5df8
line wrap: on
line diff
--- a/src/vulkan_api/vulkan_api_generator.nim	Tue Feb 28 00:08:52 2023 +0700
+++ b/src/vulkan_api/vulkan_api_generator.nim	Tue Feb 28 23:51:07 2023 +0700
@@ -250,6 +250,7 @@
     for value in {name}.items:
       if (cast[uint64](value) and uint64(number)) > 0:
         result.add value"""
+          result[0].add &"proc `==`*(a, b: {cApiName}): bool = uint64(a) == uint64(b)"
       else:
         if values.len > 0:
           result[0].add &"""func toBits*(flags: openArray[{name}]): {cApiName} =
@@ -259,6 +260,7 @@
     for value in {name}.items:
       if (value.ord and cint(number)) > 0:
         result.add value"""
+          result[0].add &"proc `==`*(a, b: {cApiName}): bool = cint(a) == cint(b)"
       if predefined_enum_sets.len > 0:
         result[0].add "const"
         result[0].add predefined_enum_sets
@@ -421,7 +423,6 @@
       "import std/typetraits",
       "import std/macros",
       "import std/private/digitsutils",
-      "from typetraits import HoleyEnum",
       "type",
       "  VkHandle* = distinct uint",
       "  VkNonDispatchableHandle* = distinct uint",
@@ -519,6 +520,8 @@
           outputFiles["basetypes"].add &"proc `$`*(handle: {name}): string = \"{name}(\" & $(uint(handle)) & \")\""
           outputFiles["basetypes"].add &"proc valid*(handle: {name}): bool = uint(handle) != 0"
           outputFiles["basetypes"].add &"proc reset*(handle: var {name}) = handle = {name}(0)"
+          outputFiles["basetypes"].add &"proc `==`*(a, b: {name}): bool = uint(a) == uint(b)"
+          
 
   # commands aka functions
   var varDecls: Table[string, string]