├── docs └── index.html ├── lib └── vulkan-1.lib ├── README.md ├── .gitignore ├── index.js ├── vulkan ├── vulkan_level_10.h ├── vulkan_pfn.h ├── vulkan_level_20_Event.h ├── vulkan_level_20_Fence.h ├── vulkan_level_20_Image.h ├── vulkan_level_20_Buffer.h ├── vulkan_level_20_Sampler.h ├── vulkan_level_20_ImageView.h ├── vulkan_level_20_QueryPool.h ├── vulkan_level_20_Semaphore.h ├── vulkan_level_20_BufferView.h ├── vulkan_level_20_CommandPool.h ├── vulkan_level_20_RenderPass.h ├── vulkan_level_20_Framebuffer.h ├── vulkan_level_20_ShaderModule.h ├── vulkan_level_20_PipelineCache.h ├── vulkan_level_20_ComputePipeline.h ├── vulkan_level_20_DescriptorPool.h ├── vulkan_level_20_PipelineLayout.h ├── vulkan_level_20_GraphicsPipeline.h ├── vulkan_level_20_DescriptorSetLayout.h ├── VulkanDll.h ├── vulkan_level_20_DebugReportCallbackEXT.h ├── vulkan_level_20.cpp ├── dllmain.cpp ├── vulkan_level_20_Event.cpp ├── vulkan_level_20_Fence.cpp ├── vulkan_level_20_Image.cpp ├── vulkan_level_20_Buffer.cpp ├── vulkan_level_20_Sampler.cpp ├── vulkan_level_20_ImageView.cpp ├── vulkan_level_20_QueryPool.cpp ├── vulkan_level_20_Semaphore.cpp ├── vulkan_level_20_BufferView.cpp ├── vulkan_level_20_RenderPass.cpp ├── vulkan_level_20_CommandPool.cpp ├── vulkan_level_20_Framebuffer.cpp ├── vulkan_level_20_ShaderModule.cpp ├── vulkan_level_20_PipelineCache.cpp ├── vulkan_level_20_DescriptorPool.cpp ├── vulkan_level_20_PipelineLayout.cpp ├── vulkan_level_20_ComputePipeline.cpp ├── vulkan_level_20_GraphicsPipeline.cpp ├── vulkan_level_20_DescriptorSetLayout.cpp ├── VulkanDll.cpp ├── vulkan_levels.h └── vulkan_level_20_DebugReportCallbackEXT.cpp ├── package.json ├── autogen ├── Instance.h ├── Event.h ├── Fence.h ├── Image.h ├── Buffer.h ├── Sampler.h ├── ImageView.h ├── QueryPool.h ├── Semaphore.h ├── BufferView.h ├── RenderPass.h ├── CommandPool.h ├── Framebuffer.h ├── Device.h ├── ShaderModule.h ├── SwapchainKHR.h ├── ComputePipeline.h ├── PipelineCache.h ├── GraphicsPipeline.h ├── DescriptorPool.h ├── PipelineLayout.h ├── SharedSwapchainKHR.h ├── DisplayPlaneSurfaceKHR.h ├── DescriptorSetLayout.h ├── DisplayModeKHR.h ├── MirSurfaceKHR.h ├── XcbSurfaceKHR.h ├── XlibSurfaceKHR.h ├── Win32SurfaceKHR.h ├── DebugReportCallbackEXT.h ├── AndroidSurfaceKHR.h ├── WaylandSurfaceKHR.h ├── vulkan_autogen.cpp ├── Instance.cpp ├── Event.cpp ├── Fence.cpp ├── Image.cpp ├── Buffer.cpp ├── Sampler.cpp ├── Device.cpp ├── DisplayModeKHR.cpp ├── ImageView.cpp ├── QueryPool.cpp ├── Semaphore.cpp ├── BufferView.cpp ├── RenderPass.cpp ├── CommandPool.cpp ├── Framebuffer.cpp ├── ShaderModule.cpp ├── SwapchainKHR.cpp ├── PipelineCache.cpp ├── DescriptorPool.cpp ├── PipelineLayout.cpp ├── ComputePipeline.cpp ├── GraphicsPipeline.cpp ├── MirSurfaceKHR.cpp ├── XcbSurfaceKHR.cpp ├── SharedSwapchainKHR.cpp ├── XlibSurfaceKHR.cpp ├── Win32SurfaceKHR.cpp ├── DescriptorSetLayout.cpp ├── AndroidSurfaceKHR.cpp ├── WaylandSurfaceKHR.cpp ├── DisplayPlaneSurfaceKHR.cpp └── DebugReportCallbackEXT.cpp └── include └── vulkan ├── icd-spv.h ├── vk_debug_marker_layer.h ├── vk_sdk_platform.h ├── vk_icd.h ├── vk_lunarg_debug_marker.h ├── GLSL.std.450.h └── vk_platform.h /docs/index.html: -------------------------------------------------------------------------------- 1 |

Demo of how node.js would work in action using vulkan

-------------------------------------------------------------------------------- /lib/vulkan-1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepilot/vulkan/HEAD/lib/vulkan-1.lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vulkan 2 | NodeJS and C++ bindings for https://www.khronos.org/vulkan/ 3 | http://codepilot.github.io 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | *.userosscache 4 | *.sln.docstates 5 | 6 | /build 7 | 8 | /Win32 9 | /x64 10 | /vulkan/Win32 11 | /vulkan/x64 12 | /.vs 13 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | try { 4 | const vulkan = new require("./build/Debug/binding.node"); 5 | 6 | for (const k in vulkan) { 7 | exports[k] = vulkan[k]; 8 | } 9 | } catch(err) { 10 | console.log(err); 11 | 12 | const vulkan = new require("./build/Release/binding.node"); 13 | 14 | for (const k in vulkan) { 15 | exports[k] = vulkan[k]; 16 | } 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_10.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_10 { 4 | using v8::FunctionCallbackInfo; 5 | using v8::Value; 6 | using v8::Local; 7 | using v8::Object; 8 | 9 | void wrap_vkCreateInstance(const FunctionCallbackInfo& args); 10 | void wrap_vkDestroyInstance(const FunctionCallbackInfo& args); 11 | void Init(Local exports); 12 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Daniel Kluss ", 3 | "name": "vulkan", 4 | "description": "vulkan bindings for nodejs", 5 | "version": "0.0.6", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/codepilot/vulkan.git" 9 | }, 10 | "main": "index.js", 11 | "scripts": { 12 | "test": "node --expose_gc test.js" 13 | }, 14 | "engines": { 15 | "node": "~v5.7.0" 16 | } 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_pfn.h: -------------------------------------------------------------------------------- 1 | createPFN(vkCreateWin32SurfaceKHR); 2 | createPFN(vkGetPhysicalDeviceWin32PresentationSupportKHR); 3 | createPFN(vkCreateDebugReportCallbackEXT); 4 | createPFN(vkDestroyDebugReportCallbackEXT); 5 | createPFN(vkDebugReportMessageEXT); 6 | createPFN(vkDestroySurfaceKHR); 7 | createPFN(vkGetPhysicalDeviceSurfaceSupportKHR); 8 | createPFN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); 9 | createPFN(vkGetPhysicalDeviceSurfaceFormatsKHR); 10 | createPFN(vkGetPhysicalDeviceSurfacePresentModesKHR); 11 | -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Event: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkEvent event{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Event(const FunctionCallbackInfo& args); 14 | ~Event(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Fence.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Fence: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkFence fence{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Fence(const FunctionCallbackInfo& args); 14 | ~Fence(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Image: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkImage image{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Image(const FunctionCallbackInfo& args); 14 | ~Image(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Buffer : public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkBuffer buffer{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Buffer(const FunctionCallbackInfo& args); 14 | ~Buffer(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Sampler: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkSampler sampler{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Sampler(const FunctionCallbackInfo& args); 14 | ~Sampler(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /autogen/Instance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Instance : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkInstance vulkan_handle{ nullptr }; 11 | 12 | 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | 18 | 19 | Instance(const FunctionCallbackInfo& args); 20 | ~Instance(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_ImageView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class ImageView: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkImageView imageView{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | ImageView(const FunctionCallbackInfo& args); 14 | ~ImageView(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_QueryPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class QueryPool: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkQueryPool queryPool{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | QueryPool(const FunctionCallbackInfo& args); 14 | ~QueryPool(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Semaphore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Semaphore: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkSemaphore semaphore{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Semaphore(const FunctionCallbackInfo& args); 14 | ~Semaphore(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_BufferView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class BufferView : public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkBufferView bufferView{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | BufferView(const FunctionCallbackInfo& args); 14 | ~BufferView(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_CommandPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | class CommandPool : public node::ObjectWrap { 5 | public: 6 | static Persistent constructor; 7 | VkCommandPool commandPool{ nullptr }; 8 | v8::UniquePersistent device; 9 | static void Init(Isolate* isolate); 10 | static void New(const FunctionCallbackInfo& args); 11 | static void NewInstance(const FunctionCallbackInfo& args); 12 | CommandPool(const FunctionCallbackInfo& args); 13 | ~CommandPool(); 14 | }; 15 | 16 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_RenderPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class RenderPass: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkRenderPass renderPass{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | RenderPass(const FunctionCallbackInfo& args); 14 | ~RenderPass(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Framebuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class Framebuffer: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkFramebuffer framebuffer{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | Framebuffer(const FunctionCallbackInfo& args); 14 | ~Framebuffer(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_ShaderModule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class ShaderModule: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkShaderModule shaderModule{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | ShaderModule(const FunctionCallbackInfo& args); 14 | ~ShaderModule(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_PipelineCache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class PipelineCache: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkPipelineCache pipelineCache{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | PipelineCache(const FunctionCallbackInfo& args); 14 | ~PipelineCache(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_ComputePipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class ComputePipeline : public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkPipeline computePipeline{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | ComputePipeline(const FunctionCallbackInfo& args); 14 | ~ComputePipeline(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_DescriptorPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class DescriptorPool: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkDescriptorPool descriptorPool{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | DescriptorPool(const FunctionCallbackInfo& args); 14 | ~DescriptorPool(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_PipelineLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class PipelineLayout: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkPipelineLayout pipelineLayout{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | PipelineLayout(const FunctionCallbackInfo& args); 14 | ~PipelineLayout(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_GraphicsPipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class GraphicsPipeline: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkPipeline graphicsPipeline{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | GraphicsPipeline(const FunctionCallbackInfo& args); 14 | ~GraphicsPipeline(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_DescriptorSetLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class DescriptorSetLayout: public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkDescriptorSetLayout descriptorSetLayout{ nullptr }; 9 | v8::UniquePersistent device; 10 | static void Init(Isolate* isolate); 11 | static void New(const FunctionCallbackInfo& args); 12 | static void NewInstance(const FunctionCallbackInfo& args); 13 | DescriptorSetLayout(const FunctionCallbackInfo& args); 14 | ~DescriptorSetLayout(); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /autogen/Event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Event : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkEvent vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateEvent vkCreateEvent; 18 | PFN_vkDestroyEvent vkDestroyEvent; 19 | Event(const FunctionCallbackInfo& args); 20 | ~Event(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Fence.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Fence : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkFence vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateFence vkCreateFence; 18 | PFN_vkDestroyFence vkDestroyFence; 19 | Fence(const FunctionCallbackInfo& args); 20 | ~Fence(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Image : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkImage vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateImage vkCreateImage; 18 | PFN_vkDestroyImage vkDestroyImage; 19 | Image(const FunctionCallbackInfo& args); 20 | ~Image(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Buffer : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkBuffer vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateBuffer vkCreateBuffer; 18 | PFN_vkDestroyBuffer vkDestroyBuffer; 19 | Buffer(const FunctionCallbackInfo& args); 20 | ~Buffer(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Sampler : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSampler vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateSampler vkCreateSampler; 18 | PFN_vkDestroySampler vkDestroySampler; 19 | Sampler(const FunctionCallbackInfo& args); 20 | ~Sampler(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/ImageView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class ImageView : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkImageView vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateImageView vkCreateImageView; 18 | PFN_vkDestroyImageView vkDestroyImageView; 19 | ImageView(const FunctionCallbackInfo& args); 20 | ~ImageView(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/QueryPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class QueryPool : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkQueryPool vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateQueryPool vkCreateQueryPool; 18 | PFN_vkDestroyQueryPool vkDestroyQueryPool; 19 | QueryPool(const FunctionCallbackInfo& args); 20 | ~QueryPool(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Semaphore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Semaphore : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSemaphore vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateSemaphore vkCreateSemaphore; 18 | PFN_vkDestroySemaphore vkDestroySemaphore; 19 | Semaphore(const FunctionCallbackInfo& args); 20 | ~Semaphore(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/BufferView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class BufferView : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkBufferView vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateBufferView vkCreateBufferView; 18 | PFN_vkDestroyBufferView vkDestroyBufferView; 19 | BufferView(const FunctionCallbackInfo& args); 20 | ~BufferView(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/RenderPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class RenderPass : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkRenderPass vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateRenderPass vkCreateRenderPass; 18 | PFN_vkDestroyRenderPass vkDestroyRenderPass; 19 | RenderPass(const FunctionCallbackInfo& args); 20 | ~RenderPass(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/CommandPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class CommandPool : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkCommandPool vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateCommandPool vkCreateCommandPool; 18 | PFN_vkDestroyCommandPool vkDestroyCommandPool; 19 | CommandPool(const FunctionCallbackInfo& args); 20 | ~CommandPool(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Framebuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Framebuffer : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkFramebuffer vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateFramebuffer vkCreateFramebuffer; 18 | PFN_vkDestroyFramebuffer vkDestroyFramebuffer; 19 | Framebuffer(const FunctionCallbackInfo& args); 20 | ~Framebuffer(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/Device.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Device : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkDevice vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | VkPhysicalDevice parent_physicalDevice; 14 | 15 | static void Init(Isolate* isolate); 16 | static void New(const FunctionCallbackInfo& args); 17 | static void NewInstance(const FunctionCallbackInfo& args); 18 | PFN_vkCreateDevice vkCreateDevice; 19 | PFN_vkDestroyDevice vkDestroyDevice; 20 | Device(const FunctionCallbackInfo& args); 21 | ~Device(); 22 | }; 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /autogen/ShaderModule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class ShaderModule : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkShaderModule vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateShaderModule vkCreateShaderModule; 18 | PFN_vkDestroyShaderModule vkDestroyShaderModule; 19 | ShaderModule(const FunctionCallbackInfo& args); 20 | ~ShaderModule(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/SwapchainKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class SwapchainKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSwapchainKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR; 18 | PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR; 19 | SwapchainKHR(const FunctionCallbackInfo& args); 20 | ~SwapchainKHR(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/ComputePipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class ComputePipeline : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkPipeline vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateComputePipelines vkCreateComputePipelines; 18 | PFN_vkDestroyPipeline vkDestroyPipeline; 19 | ComputePipeline(const FunctionCallbackInfo& args); 20 | ~ComputePipeline(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/PipelineCache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class PipelineCache : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkPipelineCache vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreatePipelineCache vkCreatePipelineCache; 18 | PFN_vkDestroyPipelineCache vkDestroyPipelineCache; 19 | PipelineCache(const FunctionCallbackInfo& args); 20 | ~PipelineCache(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/GraphicsPipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class GraphicsPipeline : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkPipeline vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines; 18 | PFN_vkDestroyPipeline vkDestroyPipeline; 19 | GraphicsPipeline(const FunctionCallbackInfo& args); 20 | ~GraphicsPipeline(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/DescriptorPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class DescriptorPool : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkDescriptorPool vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateDescriptorPool vkCreateDescriptorPool; 18 | PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool; 19 | DescriptorPool(const FunctionCallbackInfo& args); 20 | ~DescriptorPool(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/PipelineLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class PipelineLayout : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkPipelineLayout vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreatePipelineLayout vkCreatePipelineLayout; 18 | PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout; 19 | PipelineLayout(const FunctionCallbackInfo& args); 20 | ~PipelineLayout(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /vulkan/VulkanDll.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "vulkan_levels.h" 4 | namespace VulkanDll { 5 | class VulkanDll : public node::ObjectWrap { 6 | public: 7 | static void Init(Isolate* isolate); 8 | static void NewInstance(const FunctionCallbackInfo& args); 9 | VulkanDll(); 10 | VulkanDll(const FunctionCallbackInfo& args); 11 | ~VulkanDll(); 12 | static void New(const FunctionCallbackInfo& args); 13 | 14 | template void VulkanDll::getProcAddr(T &pProc, const char* pName); 15 | 16 | static Persistent constructor; 17 | HMODULE hDll{ nullptr }; 18 | PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{ nullptr }; 19 | }; 20 | 21 | void Init(Local exports); 22 | } -------------------------------------------------------------------------------- /autogen/SharedSwapchainKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class SharedSwapchainKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSwapchainKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateSharedSwapchainsKHR vkCreateSharedSwapchainsKHR; 18 | PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR; 19 | SharedSwapchainKHR(const FunctionCallbackInfo& args); 20 | ~SharedSwapchainKHR(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/DisplayPlaneSurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class DisplayPlaneSurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | DisplayPlaneSurfaceKHR(const FunctionCallbackInfo& args); 20 | ~DisplayPlaneSurfaceKHR(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/DescriptorSetLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class DescriptorSetLayout : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkDescriptorSetLayout vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout; 18 | PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout; 19 | DescriptorSetLayout(const FunctionCallbackInfo& args); 20 | ~DescriptorSetLayout(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/DisplayModeKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #if 0 //VkDisplayModeKHR 5 | 6 | namespace vulkan_autogen { 7 | class DisplayModeKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkDisplayModeKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_device; 13 | VkPhysicalDevice parent_physicalDevice; 14 | 15 | static void Init(Isolate* isolate); 16 | static void New(const FunctionCallbackInfo& args); 17 | static void NewInstance(const FunctionCallbackInfo& args); 18 | PFN_vkCreateDisplayModeKHR vkCreateDisplayModeKHR; 19 | 20 | DisplayModeKHR(const FunctionCallbackInfo& args); 21 | ~DisplayModeKHR(); 22 | }; 23 | } 24 | 25 | 26 | #endif //VkDisplayModeKHR -------------------------------------------------------------------------------- /autogen/MirSurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef VK_USE_PLATFORM_MIR_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | class MirSurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | MirSurfaceKHR(const FunctionCallbackInfo& args); 20 | ~MirSurfaceKHR(); 21 | }; 22 | } 23 | 24 | #endif // VK_USE_PLATFORM_MIR_KHR 25 | -------------------------------------------------------------------------------- /autogen/XcbSurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef VK_USE_PLATFORM_XCB_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | class XcbSurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | XcbSurfaceKHR(const FunctionCallbackInfo& args); 20 | ~XcbSurfaceKHR(); 21 | }; 22 | } 23 | 24 | #endif // VK_USE_PLATFORM_XCB_KHR 25 | -------------------------------------------------------------------------------- /autogen/XlibSurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef VK_USE_PLATFORM_XLIB_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | class XlibSurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | XlibSurfaceKHR(const FunctionCallbackInfo& args); 20 | ~XlibSurfaceKHR(); 21 | }; 22 | } 23 | 24 | #endif // VK_USE_PLATFORM_XLIB_KHR 25 | -------------------------------------------------------------------------------- /autogen/Win32SurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef VK_USE_PLATFORM_WIN32_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | class Win32SurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | Win32SurfaceKHR(const FunctionCallbackInfo& args); 20 | ~Win32SurfaceKHR(); 21 | }; 22 | } 23 | 24 | #endif // VK_USE_PLATFORM_WIN32_KHR 25 | -------------------------------------------------------------------------------- /autogen/DebugReportCallbackEXT.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | class DebugReportCallbackEXT : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkDebugReportCallbackEXT vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT; 18 | PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT; 19 | DebugReportCallbackEXT(const FunctionCallbackInfo& args); 20 | ~DebugReportCallbackEXT(); 21 | }; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /autogen/AndroidSurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | class AndroidSurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | AndroidSurfaceKHR(const FunctionCallbackInfo& args); 20 | ~AndroidSurfaceKHR(); 21 | }; 22 | } 23 | 24 | #endif // VK_USE_PLATFORM_ANDROID_KHR 25 | -------------------------------------------------------------------------------- /autogen/WaylandSurfaceKHR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | class WaylandSurfaceKHR : public node::ObjectWrap { 8 | public: 9 | static Eternal constructor; 10 | VkSurfaceKHR vulkan_handle{ nullptr }; 11 | 12 | v8::UniquePersistent parent_instance; 13 | 14 | static void Init(Isolate* isolate); 15 | static void New(const FunctionCallbackInfo& args); 16 | static void NewInstance(const FunctionCallbackInfo& args); 17 | PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR; 18 | PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; 19 | WaylandSurfaceKHR(const FunctionCallbackInfo& args); 20 | ~WaylandSurfaceKHR(); 21 | }; 22 | } 23 | 24 | #endif // VK_USE_PLATFORM_WAYLAND_KHR 25 | -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_DebugReportCallbackEXT.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vulkan_level_20 { 4 | 5 | class DebugReportCallbackEXT : public node::ObjectWrap { 6 | public: 7 | static Persistent constructor; 8 | VkDebugReportCallbackEXT debugReportCallbackEXT{ nullptr }; 9 | v8::UniquePersistent instance; 10 | v8::UniquePersistent callback; 11 | v8::UniquePersistent userData; 12 | static void Init(Isolate* isolate); 13 | static void New(const FunctionCallbackInfo& args); 14 | static void NewInstance(const FunctionCallbackInfo& args); 15 | static VkBool32 DebugReportCallbackEXT::cb_vkDebugReportCallbackEXT(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData); 16 | DebugReportCallbackEXT(const FunctionCallbackInfo& args); 17 | ~DebugReportCallbackEXT(); 18 | }; 19 | 20 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | void Init(Local exports) { 5 | Isolate* isolate = Isolate::GetCurrent(); 6 | HandleScope handle_scope(isolate); 7 | 8 | Instance::Init(isolate); 9 | PhysicalDevice::Init(isolate); 10 | Device::Init(isolate); 11 | 12 | Buffer::Init(isolate); 13 | BufferView::Init(isolate); 14 | CommandPool::Init(isolate); 15 | ComputePipeline::Init(isolate); 16 | DescriptorPool::Init(isolate); 17 | DescriptorSetLayout::Init(isolate); 18 | Event::Init(isolate); 19 | Fence::Init(isolate); 20 | Framebuffer::Init(isolate); 21 | GraphicsPipeline::Init(isolate); 22 | Image::Init(isolate); 23 | ImageView::Init(isolate); 24 | PipelineCache::Init(isolate); 25 | PipelineLayout::Init(isolate); 26 | QueryPool::Init(isolate); 27 | RenderPass::Init(isolate); 28 | Sampler::Init(isolate); 29 | Semaphore::Init(isolate); 30 | ShaderModule::Init(isolate); 31 | 32 | DebugReportCallbackEXT::Init(isolate); 33 | exports->Set(String::NewFromUtf8(isolate, "Instance"), Local::New(isolate, Instance::constructor)); 34 | } 35 | } -------------------------------------------------------------------------------- /include/vulkan/icd-spv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015-2016 Valve Corporation 4 | * Copyright (C) 2015-2016 LunarG, Inc. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | * DEALINGS IN THE SOFTWARE. 23 | * 24 | * Author: Cody Northrop 25 | * 26 | */ 27 | 28 | #ifndef ICD_SPV_H 29 | #define ICD_SPV_H 30 | 31 | #include 32 | 33 | #define ICD_SPV_MAGIC 0x07230203 34 | #define ICD_SPV_VERSION 99 35 | 36 | struct icd_spv_header { 37 | uint32_t magic; 38 | uint32_t version; 39 | uint32_t gen_magic; // Generator's magic number 40 | }; 41 | 42 | #endif /* ICD_SPV_H */ 43 | -------------------------------------------------------------------------------- /include/vulkan/vk_debug_marker_layer.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_debug_marker_layer.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and/or associated documentation files (the "Materials"), to 11 | * deal in the Materials without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Materials, and to permit persons to whom the Materials are 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice(s) and this permission notice shall be included in 17 | * all copies or substantial portions of the Materials. 18 | * 19 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | * 23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 26 | * USE OR OTHER DEALINGS IN THE MATERIALS. 27 | * 28 | * Authors: 29 | * Jon Ashburn 30 | * Courtney Goeltzenleuchter 31 | */ 32 | 33 | #pragma once 34 | 35 | #include "vulkan.h" 36 | #include "vk_lunarg_debug_marker.h" 37 | #include "vk_layer.h" 38 | 39 | typedef struct VkLayerDebugMarkerDispatchTable_ { 40 | PFN_vkCmdDbgMarkerBegin CmdDbgMarkerBegin; 41 | PFN_vkCmdDbgMarkerEnd CmdDbgMarkerEnd; 42 | PFN_vkDbgSetObjectTag DbgSetObjectTag; 43 | PFN_vkDbgSetObjectName DbgSetObjectName; 44 | } VkLayerDebugMarkerDispatchTable; 45 | -------------------------------------------------------------------------------- /vulkan/dllmain.cpp: -------------------------------------------------------------------------------- 1 | //#include "vulkanDll.h" 2 | #include "vulkan_levels.h" 3 | 4 | namespace vulkan_autogen { 5 | void Init(Local exports); 6 | } 7 | 8 | namespace EternalStrings { 9 | #define createELit(eLit) v8::Eternal es_##eLit; 10 | #include "EternalStrings.h" 11 | #undef createELit 12 | } 13 | 14 | namespace { 15 | 16 | using v8::Object; 17 | using v8::Isolate; 18 | using v8::HandleScope; 19 | using v8::Local; 20 | using v8::String; 21 | using node::AtExit; 22 | 23 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { 24 | switch (ul_reason_for_call) { 25 | case DLL_PROCESS_ATTACH: 26 | case DLL_THREAD_ATTACH: 27 | case DLL_THREAD_DETACH: 28 | case DLL_PROCESS_DETACH: 29 | break; 30 | } 31 | 32 | return TRUE; 33 | } 34 | 35 | #ifdef _DEBUG 36 | static void AtExit_DebugCallback(void*) { 37 | puts("\n\nAtExit_DebugCallback()\nPress any key to exit..."); 38 | getchar(); 39 | } 40 | #endif 41 | 42 | void Init(Local exports) { 43 | Isolate* isolate = Isolate::GetCurrent(); 44 | HandleScope handle_scope(isolate); 45 | 46 | { 47 | #define createELit(eLit) { EternalStrings::es_##eLit.Set(isolate, String::NewFromTwoByte(isolate, ptr_to_ptr(L#eLit), v8::String::kInternalizedString)); } 48 | #include "EternalStrings.h" 49 | #undef createELit 50 | } 51 | 52 | #ifdef _DEBUG 53 | AtExit(AtExit_DebugCallback); 54 | #endif 55 | Local level_10{ Object::New(isolate) }; 56 | Local level_20{ Object::New(isolate) }; 57 | Local vulkan_autogen{ Object::New(isolate) }; 58 | 59 | setELitValue(exports, level_10, level_10); 60 | setELitValue(exports, level_20, level_20); 61 | setELitValue(exports, vulkan_autogen, vulkan_autogen); 62 | 63 | vulkan_level_10::Init(level_10); 64 | vulkan_level_20::Init(level_20); 65 | vulkan_autogen::Init(vulkan_autogen); 66 | //VulkanDll::Init(exports); 67 | } 68 | NODE_MODULE(addon, Init) 69 | } -------------------------------------------------------------------------------- /autogen/vulkan_autogen.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | namespace vulkan_autogen { 4 | void Init(Local exports) { 5 | Isolate* isolate = Isolate::GetCurrent(); 6 | HandleScope handle_scope(isolate); 7 | 8 | Instance::Init(isolate); 9 | Device::Init(isolate); 10 | Fence::Init(isolate); 11 | Semaphore::Init(isolate); 12 | Event::Init(isolate); 13 | QueryPool::Init(isolate); 14 | Buffer::Init(isolate); 15 | BufferView::Init(isolate); 16 | Image::Init(isolate); 17 | ImageView::Init(isolate); 18 | ShaderModule::Init(isolate); 19 | PipelineCache::Init(isolate); 20 | GraphicsPipeline::Init(isolate); 21 | ComputePipeline::Init(isolate); 22 | PipelineLayout::Init(isolate); 23 | Sampler::Init(isolate); 24 | DescriptorSetLayout::Init(isolate); 25 | DescriptorPool::Init(isolate); 26 | Framebuffer::Init(isolate); 27 | RenderPass::Init(isolate); 28 | CommandPool::Init(isolate); 29 | 30 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 31 | AndroidSurfaceKHR::Init(isolate); 32 | #endif // VK_USE_PLATFORM_ANDROID_KHR 33 | 34 | 35 | #if 0 // VkDisplayModeKHR 36 | DisplayModeKHR::Init(isolate); 37 | #endif // VkDisplayModeKHR 38 | 39 | DisplayPlaneSurfaceKHR::Init(isolate); 40 | SharedSwapchainKHR::Init(isolate); 41 | 42 | #ifdef VK_USE_PLATFORM_MIR_KHR 43 | MirSurfaceKHR::Init(isolate); 44 | #endif // VK_USE_PLATFORM_MIR_KHR 45 | 46 | SwapchainKHR::Init(isolate); 47 | 48 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 49 | WaylandSurfaceKHR::Init(isolate); 50 | #endif // VK_USE_PLATFORM_WAYLAND_KHR 51 | 52 | 53 | #ifdef VK_USE_PLATFORM_WIN32_KHR 54 | Win32SurfaceKHR::Init(isolate); 55 | #endif // VK_USE_PLATFORM_WIN32_KHR 56 | 57 | 58 | #ifdef VK_USE_PLATFORM_XLIB_KHR 59 | XlibSurfaceKHR::Init(isolate); 60 | #endif // VK_USE_PLATFORM_XLIB_KHR 61 | 62 | 63 | #ifdef VK_USE_PLATFORM_XCB_KHR 64 | XcbSurfaceKHR::Init(isolate); 65 | #endif // VK_USE_PLATFORM_XCB_KHR 66 | 67 | DebugReportCallbackEXT::Init(isolate); 68 | Instance::Init(isolate); 69 | exports->Set(String::NewFromUtf8(isolate, "Instance"), Local::New(isolate, Instance::constructor.Get(isolate))); 70 | } 71 | } -------------------------------------------------------------------------------- /include/vulkan/vk_sdk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_sdk_platform.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and/or associated documentation files (the "Materials"), to 11 | * deal in the Materials without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Materials, and to permit persons to whom the Materials are 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice(s) and this permission notice shall be included in 17 | * all copies or substantial portions of the Materials. 18 | * 19 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | * 23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 26 | * USE OR OTHER DEALINGS IN THE MATERIALS. 27 | */ 28 | 29 | #ifndef VK_SDK_PLATFORM_H 30 | #define VK_SDK_PLATFORM_H 31 | 32 | #if defined(_WIN32) 33 | #define NOMINMAX 34 | #ifndef __cplusplus 35 | #undef inline 36 | #define inline __inline 37 | #endif // __cplusplus 38 | 39 | #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) 40 | // C99: 41 | // Microsoft didn't implement C99 in Visual Studio; but started adding it with 42 | // VS2013. However, VS2013 still didn't have snprintf(). The following is a 43 | // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the 44 | // "CMakeLists.txt" file). 45 | // NOTE: This is fixed in Visual Studio 2015. 46 | #define snprintf _snprintf 47 | #endif 48 | 49 | #define strdup _strdup 50 | 51 | #endif // _WIN32 52 | 53 | #endif // VK_SDK_PLATFORM_H 54 | -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Event.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Event::constructor; 5 | 6 | void Event::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Event")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Event::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Event::Event(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | event = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), event, event); 36 | 37 | } 38 | 39 | Event::~Event() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Event::~Event()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyEvent(hDevice->device, event, nullptr); 46 | } 47 | 48 | void Event::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Event* obj = new Event(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Fence.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Fence::constructor; 5 | 6 | void Fence::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Fence")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Fence::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Fence::Fence(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | fence = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), fence, fence); 36 | 37 | } 38 | 39 | Fence::~Fence() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Fence::~Fence()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyFence(hDevice->device, fence, nullptr); 46 | } 47 | 48 | void Fence::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Fence* obj = new Fence(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Image.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Image::constructor; 5 | 6 | void Image::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Image")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Image::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Image::Image(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | image = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), image, image); 36 | 37 | } 38 | 39 | Image::~Image() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Image::~Image()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyImage(hDevice->device, image, nullptr); 46 | } 47 | 48 | void Image::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Image* obj = new Image(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Buffer::constructor; 5 | 6 | void Buffer::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Buffer")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Buffer::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Buffer::Buffer(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | buffer = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), buffer, buffer); 36 | 37 | } 38 | 39 | Buffer::~Buffer() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Buffer::~Buffer()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyBuffer(hDevice->device, buffer, nullptr); 46 | } 47 | 48 | void Buffer::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Buffer* obj = new Buffer(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Sampler.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Sampler::constructor; 5 | 6 | void Sampler::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Sampler")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Sampler::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Sampler::Sampler(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | sampler = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), sampler, sampler); 36 | 37 | } 38 | 39 | Sampler::~Sampler() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Sampler::~Sampler()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroySampler(hDevice->device, sampler, nullptr); 46 | } 47 | 48 | void Sampler::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Sampler* obj = new Sampler(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_ImageView.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent ImageView::constructor; 5 | 6 | void ImageView::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::ImageView")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void ImageView::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | ImageView::ImageView(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | imageView = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), imageView, imageView); 36 | 37 | } 38 | 39 | ImageView::~ImageView() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("ImageView::~ImageView()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyImageView(hDevice->device, imageView, nullptr); 46 | } 47 | 48 | void ImageView::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | ImageView* obj = new ImageView(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_QueryPool.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent QueryPool::constructor; 5 | 6 | void QueryPool::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::QueryPool")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void QueryPool::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | QueryPool::QueryPool(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | queryPool = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), queryPool, queryPool); 36 | 37 | } 38 | 39 | QueryPool::~QueryPool() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("QueryPool::~QueryPool()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyQueryPool(hDevice->device, queryPool, nullptr); 46 | } 47 | 48 | void QueryPool::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | QueryPool* obj = new QueryPool(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Semaphore.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Semaphore::constructor; 5 | 6 | void Semaphore::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Semaphore")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Semaphore::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Semaphore::Semaphore(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | semaphore = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), semaphore, semaphore); 36 | 37 | } 38 | 39 | Semaphore::~Semaphore() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Semaphore::~Semaphore()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroySemaphore(hDevice->device, semaphore, nullptr); 46 | } 47 | 48 | void Semaphore::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Semaphore* obj = new Semaphore(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_BufferView.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent BufferView::constructor; 5 | 6 | void BufferView::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::BufferView")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void BufferView::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | BufferView::BufferView(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | bufferView = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), bufferView, bufferView); 36 | 37 | } 38 | 39 | BufferView::~BufferView() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("BufferView::~BufferView()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyBufferView(hDevice->device, bufferView, nullptr); 46 | } 47 | 48 | void BufferView::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | BufferView* obj = new BufferView(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_RenderPass.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent RenderPass::constructor; 5 | 6 | void RenderPass::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::RenderPass")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void RenderPass::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | RenderPass::RenderPass(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | renderPass = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), renderPass, renderPass); 36 | 37 | } 38 | 39 | RenderPass::~RenderPass() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("RenderPass::~RenderPass()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyRenderPass(hDevice->device, renderPass, nullptr); 46 | } 47 | 48 | void RenderPass::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | RenderPass* obj = new RenderPass(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_CommandPool.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent CommandPool::constructor; 5 | 6 | void CommandPool::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::CommandPool")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void CommandPool::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | CommandPool::CommandPool(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | commandPool = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), commandPool, commandPool); 36 | 37 | } 38 | 39 | CommandPool::~CommandPool() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("CommandPool::~CommandPool()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyCommandPool(hDevice->device, commandPool, nullptr); 46 | } 47 | 48 | void CommandPool::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | CommandPool* obj = new CommandPool(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_Framebuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent Framebuffer::constructor; 5 | 6 | void Framebuffer::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Framebuffer")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void Framebuffer::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | Framebuffer::Framebuffer(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | framebuffer = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), framebuffer, framebuffer); 36 | 37 | } 38 | 39 | Framebuffer::~Framebuffer() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("Framebuffer::~Framebuffer()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyFramebuffer(hDevice->device, framebuffer, nullptr); 46 | } 47 | 48 | void Framebuffer::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | Framebuffer* obj = new Framebuffer(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_ShaderModule.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent ShaderModule::constructor; 5 | 6 | void ShaderModule::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::ShaderModule")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void ShaderModule::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | ShaderModule::ShaderModule(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | shaderModule = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), shaderModule, shaderModule); 36 | 37 | } 38 | 39 | ShaderModule::~ShaderModule() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("ShaderModule::~ShaderModule()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyShaderModule(hDevice->device, shaderModule, nullptr); 46 | } 47 | 48 | void ShaderModule::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | ShaderModule* obj = new ShaderModule(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_PipelineCache.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent PipelineCache::constructor; 5 | 6 | void PipelineCache::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::PipelineCache")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void PipelineCache::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | PipelineCache::PipelineCache(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | pipelineCache = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), pipelineCache, pipelineCache); 36 | 37 | } 38 | 39 | PipelineCache::~PipelineCache() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("PipelineCache::~PipelineCache()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyPipelineCache(hDevice->device, pipelineCache, nullptr); 46 | } 47 | 48 | void PipelineCache::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | PipelineCache* obj = new PipelineCache(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /autogen/Instance.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Instance::constructor; 8 | 9 | void Instance::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Instance")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Instance::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Instance::Instance(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | 37 | 38 | 39 | 40 | 41 | VkInstanceCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkInstanceCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateInstance(&pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Instance::~Instance() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Instance::~Instance()"); 55 | 56 | vkDestroyInstance(vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Instance::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Instance* obj = new Instance(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_DescriptorPool.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent DescriptorPool::constructor; 5 | 6 | void DescriptorPool::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DescriptorPool")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void DescriptorPool::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | DescriptorPool::DescriptorPool(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | descriptorPool = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), descriptorPool, descriptorPool); 36 | 37 | } 38 | 39 | DescriptorPool::~DescriptorPool() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("DescriptorPool::~DescriptorPool()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyDescriptorPool(hDevice->device, descriptorPool, nullptr); 46 | } 47 | 48 | void DescriptorPool::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | DescriptorPool* obj = new DescriptorPool(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_PipelineLayout.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent PipelineLayout::constructor; 5 | 6 | void PipelineLayout::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::PipelineLayout")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void PipelineLayout::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | PipelineLayout::PipelineLayout(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | pipelineLayout = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), pipelineLayout, pipelineLayout); 36 | 37 | } 38 | 39 | PipelineLayout::~PipelineLayout() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("PipelineLayout::~PipelineLayout()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyPipelineLayout(hDevice->device, pipelineLayout, nullptr); 46 | } 47 | 48 | void PipelineLayout::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | PipelineLayout* obj = new PipelineLayout(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_ComputePipeline.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent ComputePipeline::constructor; 5 | 6 | void ComputePipeline::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::ComputePipeline")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void ComputePipeline::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | ComputePipeline::ComputePipeline(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | computePipeline = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), computePipeline, computePipeline); 36 | 37 | } 38 | 39 | ComputePipeline::~ComputePipeline() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("ComputePipeline::~ComputePipeline()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyPipeline(hDevice->device, computePipeline, nullptr); 46 | } 47 | 48 | void ComputePipeline::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | ComputePipeline* obj = new ComputePipeline(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_GraphicsPipeline.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent GraphicsPipeline::constructor; 5 | 6 | void GraphicsPipeline::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::GraphicsPipeline")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void GraphicsPipeline::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | GraphicsPipeline::GraphicsPipeline(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | graphicsPipeline = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), graphicsPipeline, graphicsPipeline); 36 | 37 | } 38 | 39 | GraphicsPipeline::~GraphicsPipeline() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("GraphicsPipeline::~GraphicsPipeline()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyPipeline(hDevice->device, graphicsPipeline, nullptr); 46 | } 47 | 48 | void GraphicsPipeline::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | GraphicsPipeline* obj = new GraphicsPipeline(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_DescriptorSetLayout.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent DescriptorSetLayout::constructor; 5 | 6 | void DescriptorSetLayout::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DescriptorSetLayout")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void DescriptorSetLayout::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | DescriptorSetLayout::DescriptorSetLayout(const FunctionCallbackInfo& args) { 28 | Isolate* isolate = args.GetIsolate(); 29 | HandleScope handle_scope(isolate); 30 | 31 | Wrap(args.This()); 32 | device.Reset(isolate, args[0]->ToObject()); 33 | 34 | descriptorSetLayout = double_to_ptr(args[1]->NumberValue()); 35 | setELitPtr(args.This(), descriptorSetLayout, descriptorSetLayout); 36 | 37 | } 38 | 39 | DescriptorSetLayout::~DescriptorSetLayout() { 40 | Isolate* isolate = Isolate::GetCurrent(); 41 | HandleScope handle_scope(isolate); 42 | 43 | puts("DescriptorSetLayout::~DescriptorSetLayout()"); 44 | Device *hDevice = ObjectWrap::Unwrap(device.Get(isolate)); 45 | vkDestroyDescriptorSetLayout(hDevice->device, descriptorSetLayout, nullptr); 46 | } 47 | 48 | void DescriptorSetLayout::New(const FunctionCallbackInfo& args) { 49 | Isolate* isolate = args.GetIsolate(); 50 | HandleScope handle_scope(isolate); 51 | 52 | if (args.IsConstructCall()) { 53 | DescriptorSetLayout* obj = new DescriptorSetLayout(args); 54 | args.GetReturnValue().Set(args.This()); 55 | } 56 | else { 57 | std::array, 2> argv{ args[0], args[1] }; 58 | Local cons = Local::New(isolate, constructor); 59 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /autogen/Event.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Event::constructor; 8 | 9 | void Event::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Event")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Event::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Event::Event(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateEvent = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateEvent")); 39 | vkDestroyEvent = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyEvent")); 40 | 41 | VkEventCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkEventCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateEvent(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Event::~Event() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Event::~Event()"); 55 | 56 | vkDestroyEvent(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Event::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Event* obj = new Event(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Fence.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Fence::constructor; 8 | 9 | void Fence::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Fence")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Fence::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Fence::Fence(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateFence = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateFence")); 39 | vkDestroyFence = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyFence")); 40 | 41 | VkFenceCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkFenceCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateFence(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Fence::~Fence() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Fence::~Fence()"); 55 | 56 | vkDestroyFence(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Fence::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Fence* obj = new Fence(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Image.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Image::constructor; 8 | 9 | void Image::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Image")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Image::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Image::Image(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateImage = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateImage")); 39 | vkDestroyImage = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyImage")); 40 | 41 | VkImageCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkImageCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateImage(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Image::~Image() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Image::~Image()"); 55 | 56 | vkDestroyImage(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Image::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Image* obj = new Image(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Buffer::constructor; 8 | 9 | void Buffer::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Buffer")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Buffer::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Buffer::Buffer(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateBuffer = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateBuffer")); 39 | vkDestroyBuffer = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyBuffer")); 40 | 41 | VkBufferCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkBufferCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateBuffer(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Buffer::~Buffer() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Buffer::~Buffer()"); 55 | 56 | vkDestroyBuffer(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Buffer::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Buffer* obj = new Buffer(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Sampler.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Sampler::constructor; 8 | 9 | void Sampler::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Sampler")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Sampler::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Sampler::Sampler(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateSampler = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateSampler")); 39 | vkDestroySampler = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroySampler")); 40 | 41 | VkSamplerCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkSamplerCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateSampler(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Sampler::~Sampler() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Sampler::~Sampler()"); 55 | 56 | vkDestroySampler(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Sampler::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Sampler* obj = new Sampler(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Device.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Device::constructor; 8 | 9 | void Device::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Device")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Device::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Device::Device(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | parent_physicalDevice = double_to_ptr(getELitValueFromArgN(0, parent_device)->NumberValue()); 38 | 39 | vkCreateDevice = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateDevice")); 40 | vkDestroyDevice = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroyDevice")); 41 | 42 | VkDeviceCreateInfo pCreateInfo; 43 | memset(&pCreateInfo, 0, sizeof(VkDeviceCreateInfo)); 44 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 45 | vkCreateDevice(parent_physicalDevice, &pCreateInfo, nullptr, &vulkan_handle); 46 | 47 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 48 | 49 | } 50 | 51 | Device::~Device() { 52 | Isolate* isolate = Isolate::GetCurrent(); 53 | HandleScope handle_scope(isolate); 54 | 55 | puts("Device::~Device()"); 56 | 57 | vkDestroyDevice(vulkan_handle, nullptr); 58 | 59 | } 60 | 61 | void Device::New(const FunctionCallbackInfo& args) { 62 | Isolate* isolate = args.GetIsolate(); 63 | HandleScope handle_scope(isolate); 64 | 65 | if (args.IsConstructCall()) { 66 | Device* obj = new Device(args); 67 | args.GetReturnValue().Set(args.This()); 68 | } 69 | else { 70 | std::array, 1> argv{ args[0] }; 71 | Local cons = Local::New(isolate, constructor.Get(isolate)); 72 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 73 | } 74 | } 75 | } 76 | 77 | 78 | -------------------------------------------------------------------------------- /autogen/DisplayModeKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | #if 0 //VkDisplayModeKHR 5 | 6 | namespace vulkan_autogen { 7 | Eternal DisplayModeKHR::constructor; 8 | 9 | void DisplayModeKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DisplayModeKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void DisplayModeKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | DisplayModeKHR::DisplayModeKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | parent_physicalDevice = double_to_ptr(getELitValueFromArgN(0, parent_device)->NumberValue()); 38 | 39 | vkCreateDisplayModeKHR = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateDisplayModeKHR")); 40 | 41 | 42 | VkDisplayModeCreateInfoKHR pCreateInfo; 43 | memset(&pCreateInfo, 0, sizeof(VkDisplayModeCreateInfoKHR)); 44 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 45 | vkCreateDisplayModeKHR(parent_physicalDevice, VkDisplayKHR, &pCreateInfo, nullptr, &vulkan_handle); 46 | 47 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 48 | 49 | } 50 | 51 | DisplayModeKHR::~DisplayModeKHR() { 52 | Isolate* isolate = Isolate::GetCurrent(); 53 | HandleScope handle_scope(isolate); 54 | 55 | puts("DisplayModeKHR::~DisplayModeKHR()"); 56 | 57 | //NO_DESTROY (); 58 | 59 | } 60 | 61 | void DisplayModeKHR::New(const FunctionCallbackInfo& args) { 62 | Isolate* isolate = args.GetIsolate(); 63 | HandleScope handle_scope(isolate); 64 | 65 | if (args.IsConstructCall()) { 66 | DisplayModeKHR* obj = new DisplayModeKHR(args); 67 | args.GetReturnValue().Set(args.This()); 68 | } 69 | else { 70 | std::array, 1> argv{ args[0] }; 71 | Local cons = Local::New(isolate, constructor.Get(isolate)); 72 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 73 | } 74 | } 75 | } 76 | 77 | 78 | #endif //VkDisplayModeKHR -------------------------------------------------------------------------------- /autogen/ImageView.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal ImageView::constructor; 8 | 9 | void ImageView::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::ImageView")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void ImageView::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | ImageView::ImageView(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateImageView = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateImageView")); 39 | vkDestroyImageView = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyImageView")); 40 | 41 | VkImageViewCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkImageViewCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateImageView(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | ImageView::~ImageView() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("ImageView::~ImageView()"); 55 | 56 | vkDestroyImageView(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void ImageView::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | ImageView* obj = new ImageView(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/QueryPool.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal QueryPool::constructor; 8 | 9 | void QueryPool::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::QueryPool")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void QueryPool::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | QueryPool::QueryPool(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateQueryPool = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateQueryPool")); 39 | vkDestroyQueryPool = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyQueryPool")); 40 | 41 | VkQueryPoolCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkQueryPoolCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateQueryPool(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | QueryPool::~QueryPool() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("QueryPool::~QueryPool()"); 55 | 56 | vkDestroyQueryPool(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void QueryPool::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | QueryPool* obj = new QueryPool(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Semaphore.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Semaphore::constructor; 8 | 9 | void Semaphore::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Semaphore")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Semaphore::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Semaphore::Semaphore(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateSemaphore = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateSemaphore")); 39 | vkDestroySemaphore = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroySemaphore")); 40 | 41 | VkSemaphoreCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkSemaphoreCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateSemaphore(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Semaphore::~Semaphore() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Semaphore::~Semaphore()"); 55 | 56 | vkDestroySemaphore(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Semaphore::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Semaphore* obj = new Semaphore(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/BufferView.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal BufferView::constructor; 8 | 9 | void BufferView::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::BufferView")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void BufferView::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | BufferView::BufferView(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateBufferView = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateBufferView")); 39 | vkDestroyBufferView = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyBufferView")); 40 | 41 | VkBufferViewCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkBufferViewCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateBufferView(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | BufferView::~BufferView() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("BufferView::~BufferView()"); 55 | 56 | vkDestroyBufferView(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void BufferView::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | BufferView* obj = new BufferView(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/RenderPass.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal RenderPass::constructor; 8 | 9 | void RenderPass::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::RenderPass")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void RenderPass::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | RenderPass::RenderPass(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateRenderPass = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateRenderPass")); 39 | vkDestroyRenderPass = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyRenderPass")); 40 | 41 | VkRenderPassCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkRenderPassCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateRenderPass(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | RenderPass::~RenderPass() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("RenderPass::~RenderPass()"); 55 | 56 | vkDestroyRenderPass(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void RenderPass::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | RenderPass* obj = new RenderPass(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/CommandPool.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal CommandPool::constructor; 8 | 9 | void CommandPool::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::CommandPool")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void CommandPool::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | CommandPool::CommandPool(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateCommandPool = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateCommandPool")); 39 | vkDestroyCommandPool = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyCommandPool")); 40 | 41 | VkCommandPoolCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkCommandPoolCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateCommandPool(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | CommandPool::~CommandPool() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("CommandPool::~CommandPool()"); 55 | 56 | vkDestroyCommandPool(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void CommandPool::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | CommandPool* obj = new CommandPool(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/Framebuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Framebuffer::constructor; 8 | 9 | void Framebuffer::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Framebuffer")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Framebuffer::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Framebuffer::Framebuffer(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateFramebuffer = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateFramebuffer")); 39 | vkDestroyFramebuffer = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyFramebuffer")); 40 | 41 | VkFramebufferCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkFramebufferCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateFramebuffer(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Framebuffer::~Framebuffer() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Framebuffer::~Framebuffer()"); 55 | 56 | vkDestroyFramebuffer(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Framebuffer::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Framebuffer* obj = new Framebuffer(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/ShaderModule.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal ShaderModule::constructor; 8 | 9 | void ShaderModule::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::ShaderModule")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void ShaderModule::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | ShaderModule::ShaderModule(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateShaderModule = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateShaderModule")); 39 | vkDestroyShaderModule = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyShaderModule")); 40 | 41 | VkShaderModuleCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkShaderModuleCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateShaderModule(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | ShaderModule::~ShaderModule() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("ShaderModule::~ShaderModule()"); 55 | 56 | vkDestroyShaderModule(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void ShaderModule::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | ShaderModule* obj = new ShaderModule(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/SwapchainKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal SwapchainKHR::constructor; 8 | 9 | void SwapchainKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::SwapchainKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void SwapchainKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | SwapchainKHR::SwapchainKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateSwapchainKHR = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateSwapchainKHR")); 39 | vkDestroySwapchainKHR = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroySwapchainKHR")); 40 | 41 | VkSwapchainCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkSwapchainCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateSwapchainKHR(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | SwapchainKHR::~SwapchainKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("SwapchainKHR::~SwapchainKHR()"); 55 | 56 | vkDestroySwapchainKHR(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void SwapchainKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | SwapchainKHR* obj = new SwapchainKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/PipelineCache.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal PipelineCache::constructor; 8 | 9 | void PipelineCache::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::PipelineCache")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void PipelineCache::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | PipelineCache::PipelineCache(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreatePipelineCache = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreatePipelineCache")); 39 | vkDestroyPipelineCache = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyPipelineCache")); 40 | 41 | VkPipelineCacheCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkPipelineCacheCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreatePipelineCache(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | PipelineCache::~PipelineCache() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("PipelineCache::~PipelineCache()"); 55 | 56 | vkDestroyPipelineCache(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void PipelineCache::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | PipelineCache* obj = new PipelineCache(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/DescriptorPool.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal DescriptorPool::constructor; 8 | 9 | void DescriptorPool::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DescriptorPool")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void DescriptorPool::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | DescriptorPool::DescriptorPool(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateDescriptorPool = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateDescriptorPool")); 39 | vkDestroyDescriptorPool = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyDescriptorPool")); 40 | 41 | VkDescriptorPoolCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkDescriptorPoolCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateDescriptorPool(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | DescriptorPool::~DescriptorPool() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("DescriptorPool::~DescriptorPool()"); 55 | 56 | vkDestroyDescriptorPool(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void DescriptorPool::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | DescriptorPool* obj = new DescriptorPool(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/PipelineLayout.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal PipelineLayout::constructor; 8 | 9 | void PipelineLayout::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::PipelineLayout")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void PipelineLayout::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | PipelineLayout::PipelineLayout(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreatePipelineLayout = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreatePipelineLayout")); 39 | vkDestroyPipelineLayout = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyPipelineLayout")); 40 | 41 | VkPipelineLayoutCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkPipelineLayoutCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreatePipelineLayout(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | PipelineLayout::~PipelineLayout() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("PipelineLayout::~PipelineLayout()"); 55 | 56 | vkDestroyPipelineLayout(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void PipelineLayout::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | PipelineLayout* obj = new PipelineLayout(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/ComputePipeline.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal ComputePipeline::constructor; 8 | 9 | void ComputePipeline::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::ComputePipeline")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void ComputePipeline::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | ComputePipeline::ComputePipeline(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateComputePipelines = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateComputePipelines")); 39 | vkDestroyPipeline = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyPipeline")); 40 | 41 | VkComputePipelineCreateInfo pCreateInfos; 42 | memset(&pCreateInfos, 0, sizeof(VkComputePipelineCreateInfo)); 43 | pCreateInfos.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateComputePipelines(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, nullptr, 1, &pCreateInfos, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | ComputePipeline::~ComputePipeline() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("ComputePipeline::~ComputePipeline()"); 55 | 56 | vkDestroyPipeline(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void ComputePipeline::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | ComputePipeline* obj = new ComputePipeline(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/GraphicsPipeline.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal GraphicsPipeline::constructor; 8 | 9 | void GraphicsPipeline::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::GraphicsPipeline")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void GraphicsPipeline::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | GraphicsPipeline::GraphicsPipeline(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateGraphicsPipelines = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateGraphicsPipelines")); 39 | vkDestroyPipeline = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyPipeline")); 40 | 41 | VkGraphicsPipelineCreateInfo pCreateInfos; 42 | memset(&pCreateInfos, 0, sizeof(VkGraphicsPipelineCreateInfo)); 43 | pCreateInfos.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateGraphicsPipelines(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, nullptr, 1, &pCreateInfos, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | GraphicsPipeline::~GraphicsPipeline() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("GraphicsPipeline::~GraphicsPipeline()"); 55 | 56 | vkDestroyPipeline(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void GraphicsPipeline::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | GraphicsPipeline* obj = new GraphicsPipeline(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/MirSurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | #ifdef VK_USE_PLATFORM_MIR_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal MirSurfaceKHR::constructor; 8 | 9 | void MirSurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::MirSurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void MirSurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | MirSurfaceKHR::MirSurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateMirSurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateMirSurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkMirSurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkMirSurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateMirSurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | MirSurfaceKHR::~MirSurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("MirSurfaceKHR::~MirSurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void MirSurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | MirSurfaceKHR* obj = new MirSurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | #endif // VK_USE_PLATFORM_MIR_KHR 77 | -------------------------------------------------------------------------------- /autogen/XcbSurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | #ifdef VK_USE_PLATFORM_XCB_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal XcbSurfaceKHR::constructor; 8 | 9 | void XcbSurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::XcbSurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void XcbSurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | XcbSurfaceKHR::XcbSurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateXcbSurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateXcbSurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkXcbSurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkXcbSurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateXcbSurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | XcbSurfaceKHR::~XcbSurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("XcbSurfaceKHR::~XcbSurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void XcbSurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | XcbSurfaceKHR* obj = new XcbSurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | #endif // VK_USE_PLATFORM_XCB_KHR 77 | -------------------------------------------------------------------------------- /autogen/SharedSwapchainKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal SharedSwapchainKHR::constructor; 8 | 9 | void SharedSwapchainKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::SharedSwapchainKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void SharedSwapchainKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | SharedSwapchainKHR::SharedSwapchainKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateSharedSwapchainsKHR = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateSharedSwapchainsKHR")); 39 | vkDestroySwapchainKHR = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroySwapchainKHR")); 40 | 41 | VkSwapchainCreateInfoKHR pCreateInfos; 42 | memset(&pCreateInfos, 0, sizeof(VkSwapchainCreateInfoKHR)); 43 | pCreateInfos.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateSharedSwapchainsKHR(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, 1, &pCreateInfos, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | SharedSwapchainKHR::~SharedSwapchainKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("SharedSwapchainKHR::~SharedSwapchainKHR()"); 55 | 56 | vkDestroySwapchainKHR(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void SharedSwapchainKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | SharedSwapchainKHR* obj = new SharedSwapchainKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/XlibSurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | #ifdef VK_USE_PLATFORM_XLIB_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal XlibSurfaceKHR::constructor; 8 | 9 | void XlibSurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::XlibSurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void XlibSurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | XlibSurfaceKHR::XlibSurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateXlibSurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateXlibSurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkXlibSurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkXlibSurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateXlibSurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | XlibSurfaceKHR::~XlibSurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("XlibSurfaceKHR::~XlibSurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void XlibSurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | XlibSurfaceKHR* obj = new XlibSurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | #endif // VK_USE_PLATFORM_XLIB_KHR 77 | -------------------------------------------------------------------------------- /autogen/Win32SurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | #ifdef VK_USE_PLATFORM_WIN32_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal Win32SurfaceKHR::constructor; 8 | 9 | void Win32SurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::Win32SurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void Win32SurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | Win32SurfaceKHR::Win32SurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateWin32SurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateWin32SurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkWin32SurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateWin32SurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | Win32SurfaceKHR::~Win32SurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("Win32SurfaceKHR::~Win32SurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void Win32SurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | Win32SurfaceKHR* obj = new Win32SurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | #endif // VK_USE_PLATFORM_WIN32_KHR 77 | -------------------------------------------------------------------------------- /autogen/DescriptorSetLayout.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal DescriptorSetLayout::constructor; 8 | 9 | void DescriptorSetLayout::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DescriptorSetLayout")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void DescriptorSetLayout::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | DescriptorSetLayout::DescriptorSetLayout(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_device.Reset(isolate, getELitObjectFromArgN(0, parent_device)); 37 | 38 | vkCreateDescriptorSetLayout = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkCreateDescriptorSetLayout")); 39 | vkDestroyDescriptorSetLayout = reinterpret_cast(vkGetDeviceProcAddr(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle,"vkDestroyDescriptorSetLayout")); 40 | 41 | VkDescriptorSetLayoutCreateInfo pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkDescriptorSetLayoutCreateInfo)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateDescriptorSetLayout(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | DescriptorSetLayout::~DescriptorSetLayout() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("DescriptorSetLayout::~DescriptorSetLayout()"); 55 | 56 | vkDestroyDescriptorSetLayout(ObjectWrap::Unwrap(parent_device.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void DescriptorSetLayout::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | DescriptorSetLayout* obj = new DescriptorSetLayout(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/AndroidSurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal AndroidSurfaceKHR::constructor; 8 | 9 | void AndroidSurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::AndroidSurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void AndroidSurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | AndroidSurfaceKHR::AndroidSurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateAndroidSurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateAndroidSurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkAndroidSurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateAndroidSurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | AndroidSurfaceKHR::~AndroidSurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("AndroidSurfaceKHR::~AndroidSurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void AndroidSurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | AndroidSurfaceKHR* obj = new AndroidSurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | #endif // VK_USE_PLATFORM_ANDROID_KHR 77 | -------------------------------------------------------------------------------- /autogen/WaylandSurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal WaylandSurfaceKHR::constructor; 8 | 9 | void WaylandSurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::WaylandSurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void WaylandSurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | WaylandSurfaceKHR::WaylandSurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateWaylandSurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateWaylandSurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkWaylandSurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkWaylandSurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateWaylandSurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | WaylandSurfaceKHR::~WaylandSurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("WaylandSurfaceKHR::~WaylandSurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void WaylandSurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | WaylandSurfaceKHR* obj = new WaylandSurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | #endif // VK_USE_PLATFORM_WAYLAND_KHR 77 | -------------------------------------------------------------------------------- /autogen/DisplayPlaneSurfaceKHR.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal DisplayPlaneSurfaceKHR::constructor; 8 | 9 | void DisplayPlaneSurfaceKHR::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DisplayPlaneSurfaceKHR")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void DisplayPlaneSurfaceKHR::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | DisplayPlaneSurfaceKHR::DisplayPlaneSurfaceKHR(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateDisplayPlaneSurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateDisplayPlaneSurfaceKHR")); 39 | vkDestroySurfaceKHR = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroySurfaceKHR")); 40 | 41 | VkDisplaySurfaceCreateInfoKHR pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkDisplaySurfaceCreateInfoKHR)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateDisplayPlaneSurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | DisplayPlaneSurfaceKHR::~DisplayPlaneSurfaceKHR() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("DisplayPlaneSurfaceKHR::~DisplayPlaneSurfaceKHR()"); 55 | 56 | vkDestroySurfaceKHR(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void DisplayPlaneSurfaceKHR::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | DisplayPlaneSurfaceKHR* obj = new DisplayPlaneSurfaceKHR(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /autogen/DebugReportCallbackEXT.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_autogen.h" 2 | 3 | 4 | 5 | 6 | namespace vulkan_autogen { 7 | Eternal DebugReportCallbackEXT::constructor; 8 | 9 | void DebugReportCallbackEXT::Init(Isolate* isolate) { 10 | Local tpl = FunctionTemplate::New(isolate, New); 11 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DebugReportCallbackEXT")); 12 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 13 | 14 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 15 | 16 | constructor.Set(isolate, tpl->GetFunction()); 17 | } 18 | 19 | void DebugReportCallbackEXT::NewInstance(const FunctionCallbackInfo& args) { 20 | Isolate* isolate = args.GetIsolate(); 21 | HandleScope handle_scope(isolate); 22 | 23 | std::array, 1> argv{ args[0] }; 24 | Local cons = Local::New(isolate, constructor.Get(isolate)); 25 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 26 | 27 | args.GetReturnValue().Set(instance); 28 | } 29 | 30 | DebugReportCallbackEXT::DebugReportCallbackEXT(const FunctionCallbackInfo& args) { 31 | Isolate* isolate = args.GetIsolate(); 32 | HandleScope handle_scope(isolate); 33 | 34 | Wrap(args.This()); 35 | 36 | parent_instance.Reset(isolate, getELitObjectFromArgN(0, parent_instance)); 37 | 38 | vkCreateDebugReportCallbackEXT = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkCreateDebugReportCallbackEXT")); 39 | vkDestroyDebugReportCallbackEXT = reinterpret_cast(vkGetInstanceProcAddr(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle,"vkDestroyDebugReportCallbackEXT")); 40 | 41 | VkDebugReportCallbackCreateInfoEXT pCreateInfo; 42 | memset(&pCreateInfo, 0, sizeof(VkDebugReportCallbackCreateInfoEXT)); 43 | pCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; 44 | vkCreateDebugReportCallbackEXT(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, &pCreateInfo, nullptr, &vulkan_handle); 45 | 46 | setELitPtr(args.This(), vulkan_handle, vulkan_handle); 47 | 48 | } 49 | 50 | DebugReportCallbackEXT::~DebugReportCallbackEXT() { 51 | Isolate* isolate = Isolate::GetCurrent(); 52 | HandleScope handle_scope(isolate); 53 | 54 | puts("DebugReportCallbackEXT::~DebugReportCallbackEXT()"); 55 | 56 | vkDestroyDebugReportCallbackEXT(ObjectWrap::Unwrap(parent_instance.Get(isolate))->vulkan_handle, vulkan_handle, nullptr); 57 | 58 | } 59 | 60 | void DebugReportCallbackEXT::New(const FunctionCallbackInfo& args) { 61 | Isolate* isolate = args.GetIsolate(); 62 | HandleScope handle_scope(isolate); 63 | 64 | if (args.IsConstructCall()) { 65 | DebugReportCallbackEXT* obj = new DebugReportCallbackEXT(args); 66 | args.GetReturnValue().Set(args.This()); 67 | } 68 | else { 69 | std::array, 1> argv{ args[0] }; 70 | Local cons = Local::New(isolate, constructor.Get(isolate)); 71 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 72 | } 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /vulkan/VulkanDll.cpp: -------------------------------------------------------------------------------- 1 | #include "VulkanDll.h" 2 | 3 | namespace VulkanDll { 4 | void Init(Local exports) { 5 | Isolate* isolate = Isolate::GetCurrent(); 6 | HandleScope handle_scope(isolate); 7 | 8 | VulkanDll::Init(isolate); 9 | 10 | exports->Set(String::NewFromUtf8(isolate, "VulkanDll"), Local::New(isolate, VulkanDll::constructor)); 11 | } 12 | 13 | Persistent VulkanDll::constructor; 14 | 15 | void VulkanDll::Init(Isolate* isolate) { 16 | Local tpl = FunctionTemplate::New(isolate, New); 17 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::VulkanDll")); 18 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 19 | 20 | constructor.Reset(isolate, tpl->GetFunction()); 21 | } 22 | void VulkanDll::NewInstance(const FunctionCallbackInfo& args) { 23 | Isolate* isolate = args.GetIsolate(); 24 | HandleScope handle_scope(isolate); 25 | 26 | if (args.Length() == 1 && args[0]->IsString()) { 27 | std::array, 1> argv{ args[0] }; 28 | Local cons = Local::New(isolate, constructor); 29 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 30 | 31 | args.GetReturnValue().Set(instance); 32 | } 33 | else { 34 | std::array, 0> argv{}; 35 | Local cons = Local::New(isolate, constructor); 36 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 37 | 38 | args.GetReturnValue().Set(instance); 39 | } 40 | 41 | } 42 | 43 | VulkanDll::VulkanDll() { 44 | hDll = LoadLibraryExW(L"vulkan-1.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); 45 | } 46 | 47 | VulkanDll::VulkanDll(const FunctionCallbackInfo& args) { 48 | Isolate* isolate = args.GetIsolate(); 49 | HandleScope handle_scope(isolate); 50 | 51 | if (args.Length() == 1 && args[0]->IsString()) { 52 | String::Value svDllPath{ args[0] }; 53 | PTCHAR ptDllPath{ reinterpret_cast(*svDllPath) }; 54 | hDll = LoadLibraryExW(ptDllPath, nullptr, 0); 55 | } 56 | else { 57 | hDll = LoadLibraryExW(L"vulkan-1.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); 58 | } 59 | getProcAddr(vkGetInstanceProcAddr, "vkGetInstanceProcAddr"); 60 | setKeyPtr(args.This(), "hDll", hDll); 61 | setKeyPtr(args.This(), "vkGetInstanceProcAddr", vkGetInstanceProcAddr); 62 | Wrap(args.This()); 63 | } 64 | 65 | VulkanDll::~VulkanDll() { 66 | FreeLibrary(hDll); 67 | } 68 | 69 | void VulkanDll::New(const FunctionCallbackInfo& args) { 70 | Isolate* isolate = args.GetIsolate(); 71 | HandleScope handle_scope(isolate); 72 | 73 | if (args.IsConstructCall()) { 74 | // Invoked as constructor: `new MyObject(...)` 75 | VulkanDll* obj = new VulkanDll(args); 76 | args.GetReturnValue().Set(args.This()); 77 | } 78 | else { 79 | Local cons = Local::New(isolate, constructor); 80 | if (args.Length() == 1 && args[0]->IsString()) { 81 | std::array, 1> argv{ args[0] }; 82 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 83 | } 84 | else { 85 | std::array, 0> argv{}; 86 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 87 | } 88 | } 89 | } 90 | 91 | template void VulkanDll::getProcAddr(T &pProc, const char* pName) { 92 | pProc = reinterpret_cast(GetProcAddress(hDll, pName)); 93 | } 94 | } -------------------------------------------------------------------------------- /vulkan/vulkan_levels.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #define WIN32_LEAN_AND_MEAN 15 | //#include 16 | 17 | #define VK_USE_PLATFORM_WIN32_KHR 1 18 | #include 19 | 20 | using v8::Int32; 21 | using v8::Uint32; 22 | using v8::HandleScope; 23 | using v8::Array; 24 | using v8::Exception; 25 | using v8::FunctionCallbackInfo; 26 | using v8::Persistent; 27 | 28 | using v8::FunctionTemplate; 29 | using v8::Function; 30 | using v8::Isolate; 31 | using v8::Local; 32 | using v8::Number; 33 | using v8::Object; 34 | using v8::String; 35 | using v8::Value; 36 | 37 | using msl::utilities::SafeInt; 38 | 39 | template double ptr_to_double(T ptr) { return static_cast(reinterpret_cast(ptr)); } 40 | template T double_to_ptr(double dbl) { return reinterpret_cast(static_cast(dbl)); } 41 | template DstType ptr_to_ptr(SrcType srcPtr) { return reinterpret_cast(srcPtr); } 42 | 43 | //#define lit2b(lit) String::NewFromTwoByte(isolate, ptr_to_ptr(L#lit)) 44 | //#define str2b(str) String::NewFromTwoByte(isolate, ptr_to_ptr(L##str)) 45 | //#define setKeyValue(dst, key, val) { dst->Set(str2b(key), val); }; 46 | //#define setKeyInt32(dst, key, val) { setKeyValue(dst, key, Int32::New(isolate, val)); }; 47 | //#define setKeyUint32(dst, key, val) { setKeyValue(dst, key, Uint32::New(isolate, val)); }; 48 | //#define setKeyPtr(dst, key, val) { setKeyValue(dst, key, Number::New(isolate, ptr_to_double(val))); }; 49 | 50 | #define setIndexValue(dst, index, val) { dst->Set(index, val); }; 51 | #define setIndexInt32(dst, index, val) { setIndexValue(dst, index, Int32::New(isolate, val)); }; 52 | #define setIndexUint32(dst, index, val) { setIndexValue(dst, index, Uint32::New(isolate, val)); }; 53 | #define setIndexFloat64(dst, index, val) { setIndexValue(dst, index, Number::New(isolate, val)); }; 54 | #define setIndexPtr(dst, index, val) { setIndexValue(dst, index, Number::New(isolate, ptr_to_double(val))); }; 55 | 56 | //#define setEternalLit(lit) { EternalStrings::es_##lit.Set(isolate, String::NewFromTwoByte(isolate, ptr_to_ptr(L#lit), v8::String::kInternalizedString)); } 57 | #define getEternalLit(lit) EternalStrings::es_##lit.Get(isolate) 58 | 59 | #define getELitValue(src, eLit) src->Get(getEternalLit(eLit)) 60 | #define getELitValueFromObject(src, eLit) src->ToObject()->Get(getEternalLit(eLit)) 61 | #define getELitValueFromArgN(argN, eLit) args[argN]->ToObject()->Get(getEternalLit(eLit)) 62 | #define getELitObjectFromArgN(argN, eLit) args[argN]->ToObject()->Get(getEternalLit(eLit))->ToObject() 63 | 64 | #define get_args_n_Elit_as_Array(argN, eLit) Local::Cast(args[argN]->ToObject()->Get(getEternalLit(eLit))) 65 | #define get_args_n_Elit_as_Uint32(argN, eLit) args[argN]->ToObject()->Get(getEternalLit(eLit))->Uint32Value() 66 | 67 | #define setELitValue(dst, eLit, val) { dst->Set(getEternalLit(eLit), val); }; 68 | #define setELitInt32(dst, eLit, val) { setELitValue(dst, eLit, Int32::New(isolate, val)); }; 69 | #define setELitUint32(dst, eLit, val) { setELitValue(dst, eLit, Uint32::New(isolate, val)); }; 70 | #define setELitFloat64(dst, eLit, val) { setELitValue(dst, eLit, Number::New(isolate, val)); }; 71 | #define setELitPtr(dst, eLit, val) { setELitValue(dst, eLit, Number::New(isolate, ptr_to_double(val))); }; 72 | 73 | 74 | namespace EternalStrings { 75 | #define createELit(eLit) extern v8::Eternal es_##eLit; 76 | #include "EternalStrings.h" 77 | #undef createELit 78 | } 79 | 80 | 81 | #include "vulkan_level_10.h" 82 | #include "vulkan_level_20.h" 83 | -------------------------------------------------------------------------------- /include/vulkan/vk_icd.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_icd.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and/or associated documentation files (the "Materials"), to 11 | * deal in the Materials without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Materials, and to permit persons to whom the Materials are 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice(s) and this permission notice shall be included in 17 | * all copies or substantial portions of the Materials. 18 | * 19 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | * 23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 26 | * USE OR OTHER DEALINGS IN THE MATERIALS. 27 | * 28 | */ 29 | 30 | #ifndef VKICD_H 31 | #define VKICD_H 32 | 33 | #include "vk_platform.h" 34 | 35 | /* 36 | * The ICD must reserve space for a pointer for the loader's dispatch 37 | * table, at the start of . 38 | * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro. 39 | */ 40 | 41 | #define ICD_LOADER_MAGIC 0x01CDC0DE 42 | 43 | typedef union _VK_LOADER_DATA { 44 | uintptr_t loaderMagic; 45 | void *loaderData; 46 | } VK_LOADER_DATA; 47 | 48 | static inline void set_loader_magic_value(void *pNewObject) { 49 | VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject; 50 | loader_info->loaderMagic = ICD_LOADER_MAGIC; 51 | } 52 | 53 | static inline bool valid_loader_magic_value(void *pNewObject) { 54 | const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject; 55 | return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC; 56 | } 57 | 58 | /* 59 | * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that 60 | * contains the platform-specific connection and surface information. 61 | */ 62 | typedef enum _VkIcdWsiPlatform { 63 | VK_ICD_WSI_PLATFORM_MIR, 64 | VK_ICD_WSI_PLATFORM_WAYLAND, 65 | VK_ICD_WSI_PLATFORM_WIN32, 66 | VK_ICD_WSI_PLATFORM_XCB, 67 | VK_ICD_WSI_PLATFORM_XLIB, 68 | } VkIcdWsiPlatform; 69 | 70 | typedef struct _VkIcdSurfaceBase { 71 | VkIcdWsiPlatform platform; 72 | } VkIcdSurfaceBase; 73 | 74 | #ifdef VK_USE_PLATFORM_MIR_KHR 75 | typedef struct _VkIcdSurfaceMir { 76 | VkIcdSurfaceBase base; 77 | MirConnection *connection; 78 | MirSurface *mirSurface; 79 | } VkIcdSurfaceMir; 80 | #endif // VK_USE_PLATFORM_MIR_KHR 81 | 82 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 83 | typedef struct _VkIcdSurfaceWayland { 84 | VkIcdSurfaceBase base; 85 | struct wl_display *display; 86 | struct wl_surface *surface; 87 | } VkIcdSurfaceWayland; 88 | #endif // VK_USE_PLATFORM_WAYLAND_KHR 89 | 90 | #ifdef VK_USE_PLATFORM_WIN32_KHR 91 | typedef struct _VkIcdSurfaceWin32 { 92 | VkIcdSurfaceBase base; 93 | HINSTANCE hinstance; 94 | HWND hwnd; 95 | } VkIcdSurfaceWin32; 96 | #endif // VK_USE_PLATFORM_WIN32_KHR 97 | 98 | #ifdef VK_USE_PLATFORM_XCB_KHR 99 | typedef struct _VkIcdSurfaceXcb { 100 | VkIcdSurfaceBase base; 101 | xcb_connection_t *connection; 102 | xcb_window_t window; 103 | } VkIcdSurfaceXcb; 104 | #endif // VK_USE_PLATFORM_XCB_KHR 105 | 106 | #ifdef VK_USE_PLATFORM_XLIB_KHR 107 | typedef struct _VkIcdSurfaceXlib { 108 | VkIcdSurfaceBase base; 109 | Display *dpy; 110 | Window window; 111 | } VkIcdSurfaceXlib; 112 | #endif // VK_USE_PLATFORM_XLIB_KHR 113 | 114 | #endif // VKICD_H 115 | -------------------------------------------------------------------------------- /include/vulkan/vk_lunarg_debug_marker.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_lunarg_debug_marker.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and/or associated documentation files (the "Materials"), to 11 | * deal in the Materials without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Materials, and to permit persons to whom the Materials are 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice(s) and this permission notice shall be included in 17 | * all copies or substantial portions of the Materials. 18 | * 19 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | * 23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 26 | * USE OR OTHER DEALINGS IN THE MATERIALS. 27 | * 28 | * Authors: 29 | * Jon Ashburn 30 | * Courtney Goeltzenleuchter 31 | */ 32 | 33 | #ifndef __VK_DEBUG_MARKER_H__ 34 | #define __VK_DEBUG_MARKER_H__ 35 | 36 | #include "vulkan.h" 37 | 38 | #define VK_DEBUG_MARKER_EXTENSION_NUMBER 6 39 | #define VK_DEBUG_MARKER_EXTENSION_REVISION 1 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif // __cplusplus 43 | 44 | /* 45 | *************************************************************************************************** 46 | * DebugMarker Vulkan Extension API 47 | *************************************************************************************************** 48 | */ 49 | 50 | #define DEBUG_MARKER_EXTENSION_NAME "VK_LUNARG_DEBUG_MARKER" 51 | 52 | // ------------------------------------------------------------------------------------------------ 53 | // Enumerations 54 | 55 | #define VK_DEBUG_MARKER_ENUM_EXTEND(type, id) \ 56 | ((type)(VK_DEBUG_MARKER_EXTENSION_NUMBER * -1000 + (id))) 57 | 58 | #define VK_OBJECT_INFO_TYPE_DBG_OBJECT_TAG \ 59 | VK_DEBUG_MARKER_ENUM_EXTEND(VkDbgObjectInfoType, 0) 60 | #define VK_OBJECT_INFO_TYPE_DBG_OBJECT_NAME \ 61 | VK_DEBUG_MARKER_ENUM_EXTEND(VkDbgObjectInfoType, 1) 62 | 63 | // ------------------------------------------------------------------------------------------------ 64 | // API functions 65 | 66 | typedef void(VKAPI_PTR *PFN_vkCmdDbgMarkerBegin)(VkCommandBuffer commandBuffer, 67 | const char *pMarker); 68 | typedef void(VKAPI_PTR *PFN_vkCmdDbgMarkerEnd)(VkCommandBuffer commandBuffer); 69 | typedef VkResult(VKAPI_PTR *PFN_vkDbgSetObjectTag)( 70 | VkDevice device, VkDebugReportObjectTypeEXT objType, uint64_t object, 71 | size_t tagSize, const void *pTag); 72 | typedef VkResult(VKAPI_PTR *PFN_vkDbgSetObjectName)( 73 | VkDevice device, VkDebugReportObjectTypeEXT objType, uint64_t object, 74 | size_t nameSize, const char *pName); 75 | 76 | #ifndef VK_NO_PROTOTYPES 77 | 78 | // DebugMarker extension entrypoints 79 | VKAPI_ATTR void VKAPI_CALL 80 | vkCmdDbgMarkerBegin(VkCommandBuffer commandBuffer, const char *pMarker); 81 | 82 | VKAPI_ATTR void VKAPI_CALL vkCmdDbgMarkerEnd(VkCommandBuffer commandBuffer); 83 | 84 | VKAPI_ATTR VkResult VKAPI_CALL 85 | vkDbgSetObjectTag(VkDevice device, VkDebugReportObjectTypeEXT objType, 86 | uint64_t object, size_t tagSize, const void *pTag); 87 | 88 | VKAPI_ATTR VkResult VKAPI_CALL 89 | vkDbgSetObjectName(VkDevice device, VkDebugReportObjectTypeEXT objType, 90 | uint64_t object, size_t nameSize, const char *pName); 91 | 92 | #endif // VK_NO_PROTOTYPES 93 | 94 | #ifdef __cplusplus 95 | } // extern "C" 96 | #endif // __cplusplus 97 | 98 | #endif // __VK_DEBUG_MARKER_H__ 99 | -------------------------------------------------------------------------------- /include/vulkan/GLSL.std.450.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (c) 2014-2016 The Khronos Group Inc. 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 5 | ** of this software and/or associated documentation files (the "Materials"), 6 | ** to deal in the Materials without restriction, including without limitation 7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | ** and/or sell copies of the Materials, and to permit persons to whom the 9 | ** Materials are furnished to do so, subject to the following conditions: 10 | ** 11 | ** The above copyright notice and this permission notice shall be included in 12 | ** all copies or substantial portions of the Materials. 13 | ** 14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS 15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND 16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS 24 | ** IN THE MATERIALS. 25 | */ 26 | 27 | #ifndef GLSLstd450_H 28 | #define GLSLstd450_H 29 | 30 | static const int GLSLstd450Version = 100; 31 | static const int GLSLstd450Revision = 1; 32 | 33 | enum GLSLstd450 { 34 | GLSLstd450Bad = 0, // Don't use 35 | 36 | GLSLstd450Round = 1, 37 | GLSLstd450RoundEven = 2, 38 | GLSLstd450Trunc = 3, 39 | GLSLstd450FAbs = 4, 40 | GLSLstd450SAbs = 5, 41 | GLSLstd450FSign = 6, 42 | GLSLstd450SSign = 7, 43 | GLSLstd450Floor = 8, 44 | GLSLstd450Ceil = 9, 45 | GLSLstd450Fract = 10, 46 | 47 | GLSLstd450Radians = 11, 48 | GLSLstd450Degrees = 12, 49 | GLSLstd450Sin = 13, 50 | GLSLstd450Cos = 14, 51 | GLSLstd450Tan = 15, 52 | GLSLstd450Asin = 16, 53 | GLSLstd450Acos = 17, 54 | GLSLstd450Atan = 18, 55 | GLSLstd450Sinh = 19, 56 | GLSLstd450Cosh = 20, 57 | GLSLstd450Tanh = 21, 58 | GLSLstd450Asinh = 22, 59 | GLSLstd450Acosh = 23, 60 | GLSLstd450Atanh = 24, 61 | GLSLstd450Atan2 = 25, 62 | 63 | GLSLstd450Pow = 26, 64 | GLSLstd450Exp = 27, 65 | GLSLstd450Log = 28, 66 | GLSLstd450Exp2 = 29, 67 | GLSLstd450Log2 = 30, 68 | GLSLstd450Sqrt = 31, 69 | GLSLstd450InverseSqrt = 32, 70 | 71 | GLSLstd450Determinant = 33, 72 | GLSLstd450MatrixInverse = 34, 73 | 74 | GLSLstd450Modf = 35, // second operand needs an OpVariable to write to 75 | GLSLstd450ModfStruct = 36, // no OpVariable operand 76 | GLSLstd450FMin = 37, 77 | GLSLstd450UMin = 38, 78 | GLSLstd450SMin = 39, 79 | GLSLstd450FMax = 40, 80 | GLSLstd450UMax = 41, 81 | GLSLstd450SMax = 42, 82 | GLSLstd450FClamp = 43, 83 | GLSLstd450UClamp = 44, 84 | GLSLstd450SClamp = 45, 85 | GLSLstd450FMix = 46, 86 | GLSLstd450IMix = 47, // Reserved 87 | GLSLstd450Step = 48, 88 | GLSLstd450SmoothStep = 49, 89 | 90 | GLSLstd450Fma = 50, 91 | GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to 92 | GLSLstd450FrexpStruct = 52, // no OpVariable operand 93 | GLSLstd450Ldexp = 53, 94 | 95 | GLSLstd450PackSnorm4x8 = 54, 96 | GLSLstd450PackUnorm4x8 = 55, 97 | GLSLstd450PackSnorm2x16 = 56, 98 | GLSLstd450PackUnorm2x16 = 57, 99 | GLSLstd450PackHalf2x16 = 58, 100 | GLSLstd450PackDouble2x32 = 59, 101 | GLSLstd450UnpackSnorm2x16 = 60, 102 | GLSLstd450UnpackUnorm2x16 = 61, 103 | GLSLstd450UnpackHalf2x16 = 62, 104 | GLSLstd450UnpackSnorm4x8 = 63, 105 | GLSLstd450UnpackUnorm4x8 = 64, 106 | GLSLstd450UnpackDouble2x32 = 65, 107 | 108 | GLSLstd450Length = 66, 109 | GLSLstd450Distance = 67, 110 | GLSLstd450Cross = 68, 111 | GLSLstd450Normalize = 69, 112 | GLSLstd450FaceForward = 70, 113 | GLSLstd450Reflect = 71, 114 | GLSLstd450Refract = 72, 115 | 116 | GLSLstd450FindILsb = 73, 117 | GLSLstd450FindSMsb = 74, 118 | GLSLstd450FindUMsb = 75, 119 | 120 | GLSLstd450InterpolateAtCentroid = 76, 121 | GLSLstd450InterpolateAtSample = 77, 122 | GLSLstd450InterpolateAtOffset = 78, 123 | 124 | GLSLstd450NMin = 79, 125 | GLSLstd450NMax = 80, 126 | GLSLstd450NClamp = 81, 127 | 128 | GLSLstd450Count 129 | }; 130 | 131 | #endif // #ifndef GLSLstd450_H 132 | -------------------------------------------------------------------------------- /include/vulkan/vk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_platform.h 3 | // 4 | /* 5 | ** Copyright (c) 2014-2015 The Khronos Group Inc. 6 | ** 7 | ** Permission is hereby granted, free of charge, to any person obtaining a 8 | ** copy of this software and/or associated documentation files (the 9 | ** "Materials"), to deal in the Materials without restriction, including 10 | ** without limitation the rights to use, copy, modify, merge, publish, 11 | ** distribute, sublicense, and/or sell copies of the Materials, and to 12 | ** permit persons to whom the Materials are furnished to do so, subject to 13 | ** the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included 16 | ** in all copies or substantial portions of the Materials. 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 25 | */ 26 | 27 | 28 | #ifndef __VK_PLATFORM_H__ 29 | #define __VK_PLATFORM_H__ 30 | 31 | #ifdef __cplusplus 32 | extern "C" 33 | { 34 | #endif // __cplusplus 35 | 36 | /* 37 | *************************************************************************************************** 38 | * Platform-specific directives and type declarations 39 | *************************************************************************************************** 40 | */ 41 | 42 | /* Platform-specific calling convention macros. 43 | * 44 | * Platforms should define these so that Vulkan clients call Vulkan commands 45 | * with the same calling conventions that the Vulkan implementation expects. 46 | * 47 | * VKAPI_ATTR - Placed before the return type in function declarations. 48 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 49 | * VKAPI_CALL - Placed after the return type in function declarations. 50 | * Useful for MSVC-style calling convention syntax. 51 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 52 | * 53 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 54 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 55 | */ 56 | #if defined(_WIN32) 57 | // On Windows, Vulkan commands use the stdcall convention 58 | #define VKAPI_ATTR 59 | #define VKAPI_CALL __stdcall 60 | #define VKAPI_PTR VKAPI_CALL 61 | #elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) 62 | // Android does not support Vulkan in native code using the "armeabi" ABI. 63 | #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs" 64 | #elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__) 65 | // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling 66 | // convention, even if the application's native code is compiled with the 67 | // armeabi-v7a calling convention. 68 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 69 | #define VKAPI_CALL 70 | #define VKAPI_PTR VKAPI_ATTR 71 | #else 72 | // On other platforms, use the default calling convention 73 | #define VKAPI_ATTR 74 | #define VKAPI_CALL 75 | #define VKAPI_PTR 76 | #endif 77 | 78 | #include 79 | 80 | #if !defined(VK_NO_STDINT_H) 81 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 82 | typedef signed __int8 int8_t; 83 | typedef unsigned __int8 uint8_t; 84 | typedef signed __int16 int16_t; 85 | typedef unsigned __int16 uint16_t; 86 | typedef signed __int32 int32_t; 87 | typedef unsigned __int32 uint32_t; 88 | typedef signed __int64 int64_t; 89 | typedef unsigned __int64 uint64_t; 90 | #else 91 | #include 92 | #endif 93 | #endif // !defined(VK_NO_STDINT_H) 94 | 95 | #ifdef __cplusplus 96 | } // extern "C" 97 | #endif // __cplusplus 98 | 99 | // Platform-specific headers required by platform window system extensions. 100 | // These are enabled prior to #including "vulkan.h". The same enable then 101 | // controls inclusion of the extension interfaces in vulkan.h. 102 | 103 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 104 | #include 105 | #endif 106 | 107 | #ifdef VK_USE_PLATFORM_MIR_KHR 108 | #include 109 | #endif 110 | 111 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 112 | #include 113 | #endif 114 | 115 | #ifdef VK_USE_PLATFORM_WIN32_KHR 116 | #include 117 | #endif 118 | 119 | #ifdef VK_USE_PLATFORM_XLIB_KHR 120 | #include 121 | #endif 122 | 123 | #ifdef VK_USE_PLATFORM_XCB_KHR 124 | #include 125 | #endif 126 | 127 | #endif // __VK_PLATFORM_H__ 128 | -------------------------------------------------------------------------------- /vulkan/vulkan_level_20_DebugReportCallbackEXT.cpp: -------------------------------------------------------------------------------- 1 | #include "vulkan_levels.h" 2 | 3 | namespace vulkan_level_20 { 4 | Persistent DebugReportCallbackEXT::constructor; 5 | 6 | void DebugReportCallbackEXT::Init(Isolate* isolate) { 7 | Local tpl = FunctionTemplate::New(isolate, New); 8 | tpl->SetClassName(String::NewFromUtf8(isolate, "Vulkan::DebugReportCallbackEXT")); 9 | tpl->InstanceTemplate()->SetInternalFieldCount(1); 10 | 11 | //NODE_SET_PROTOTYPE_METHOD(tpl, "getMemoryProperties", getMemoryProperties); 12 | 13 | constructor.Reset(isolate, tpl->GetFunction()); 14 | } 15 | 16 | void DebugReportCallbackEXT::NewInstance(const FunctionCallbackInfo& args) { 17 | Isolate* isolate = args.GetIsolate(); 18 | HandleScope handle_scope(isolate); 19 | 20 | std::array, 2> argv{ args[0], args[1] }; 21 | Local cons = Local::New(isolate, constructor); 22 | Local instance = cons->NewInstance(SafeInt(argv.size()), argv.data()); 23 | 24 | args.GetReturnValue().Set(instance); 25 | } 26 | 27 | VkBool32 DebugReportCallbackEXT::cb_vkDebugReportCallbackEXT(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData) { 28 | Isolate* isolate = Isolate::GetCurrent(); 29 | HandleScope handle_scope(isolate); 30 | 31 | printf("vkDebugReportCallbackEXT(%u, %u, %I64u, %I64u, %d, %s, %s, %p)\n", flags, objectType, object, location, messageCode, pLayerPrefix, pMessage, pUserData); 32 | auto thisPtr = reinterpret_cast(pUserData); 33 | if (!thisPtr->callback.IsEmpty()) { 34 | std::array, 8> argv{ 35 | Uint32::NewFromUnsigned(isolate, flags), 36 | Uint32::NewFromUnsigned(isolate, objectType), 37 | Number::New(isolate, static_cast(object)), 38 | Number::New(isolate, static_cast(location)), 39 | Int32::New(isolate, messageCode), 40 | String::NewFromUtf8(isolate, pLayerPrefix), 41 | String::NewFromUtf8(isolate, pMessage), 42 | thisPtr->userData.Get(isolate) 43 | }; 44 | thisPtr->callback.Get(isolate)->Call(v8::Null(isolate), SafeInt(argv.size()), argv.data()); 45 | } 46 | return 1; 47 | } 48 | 49 | 50 | DebugReportCallbackEXT::DebugReportCallbackEXT(const FunctionCallbackInfo& args) { 51 | Isolate* isolate = args.GetIsolate(); 52 | HandleScope handle_scope(isolate); 53 | 54 | Wrap(args.This()); 55 | instance.Reset(isolate, args[0]->ToObject()); 56 | 57 | 58 | 59 | VkDebugReportCallbackCreateInfoEXT createInfo{ 60 | VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT, 61 | nullptr, 62 | VK_DEBUG_REPORT_INFORMATION_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT | VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT, 63 | DebugReportCallbackEXT::cb_vkDebugReportCallbackEXT, 64 | this 65 | }; 66 | 67 | if (args.Length() >= 1 && args[1]->IsObject()) { 68 | if (args[1]->ToObject()->HasOwnProperty(getEternalLit(flags))) { 69 | createInfo.flags = get_args_n_Elit_as_Uint32(1, flags); 70 | } 71 | } 72 | 73 | if (args.Length() >= 1 && args[1]->IsObject()) { 74 | if (args[1]->ToObject()->HasOwnProperty(getEternalLit(pfnCallback)) && getELitValueFromArgN(1, pfnCallback)->IsFunction()) { 75 | callback.Reset(isolate, Local::Cast(getELitValueFromArgN(1, pfnCallback))); 76 | } 77 | 78 | if (args[1]->ToObject()->HasOwnProperty(getEternalLit(pUserData))) { 79 | userData.Reset(isolate, getELitValueFromArgN(1, pUserData)); 80 | } 81 | } 82 | 83 | Instance* pInstance = ObjectWrap::Unwrap(args[0]->ToObject()); 84 | const auto status = pInstance->vkCreateDebugReportCallbackEXT(pInstance->instance, &createInfo, nullptr, &debugReportCallbackEXT); 85 | 86 | setELitPtr(args.This(), debugReportCallbackEXT, debugReportCallbackEXT); 87 | 88 | } 89 | 90 | DebugReportCallbackEXT::~DebugReportCallbackEXT() { 91 | Isolate* isolate = Isolate::GetCurrent(); 92 | HandleScope handle_scope(isolate); 93 | 94 | puts("DebugReportCallbackEXT::~DebugReportCallbackEXT()"); 95 | Instance *hInstance = ObjectWrap::Unwrap(instance.Get(isolate)); 96 | hInstance->vkDestroyDebugReportCallbackEXT(hInstance->instance, debugReportCallbackEXT, nullptr); 97 | } 98 | 99 | void DebugReportCallbackEXT::New(const FunctionCallbackInfo& args) { 100 | Isolate* isolate = args.GetIsolate(); 101 | HandleScope handle_scope(isolate); 102 | 103 | if (args.IsConstructCall()) { 104 | DebugReportCallbackEXT* obj = new DebugReportCallbackEXT(args); 105 | args.GetReturnValue().Set(args.This()); 106 | } 107 | else { 108 | std::array, 2> argv{ args[0], args[1] }; 109 | Local cons = Local::New(isolate, constructor); 110 | args.GetReturnValue().Set(cons->NewInstance(SafeInt(argv.size()), argv.data())); 111 | } 112 | } 113 | 114 | } --------------------------------------------------------------------------------