1 /*
2 ** Copyright (c) 2015-2016 The Khronos Group Inc.
3 **
4 ** Permission is hereby granted, free of charge, to any person obtaining a
5 ** copy of this software and/or associated documentation files (the
6 ** "Materials"), to deal in the Materials without restriction, including
7 ** without limitation the rights to use, copy, modify, merge, publish,
8 ** distribute, sublicense, and/or sell copies of the Materials, and to
9 ** permit persons to whom the Materials are furnished to do so, subject to
10 ** the following conditions:
11 **
12 ** The above copyright notice and this permission notice shall be included
13 ** in all copies or substantial portions of the Materials.
14 **
15 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22 */
23 module derelict.vulkan.base;
24 extern(System):
25 
26 //#include "vk_platform.h"
27 
28 alias VK_VERSION_MAJOR = (uint ver) => ver >> 22;
29 alias VK_VERSION_MINOR = (uint ver) => (ver >> 12) & 0x3ff;
30 alias VK_VERSION_PATCH = (uint ver) => ver & 0xfff;
31 alias VK_MAKE_VERSION  = (uint major, uint minor, uint patch) =>
32   (major << 22) | (minor << 12) | patch;
33 
34 package mixin template VK_DEFINE_HANDLE(string name) {
35   mixin("struct " ~ name ~ "_T; \n alias " ~ name ~ " = " ~ name ~ "_T*;");
36 }
37 package mixin template VK_DEFINE_NON_DISPATCHABLE_HANDLE(string name) {
38   mixin("alias " ~ name ~ " = void*;");
39 }
40 // #if defined(__LP64__)    || defined(_WIN64) 
41 //  || defined(__x86_64__)  || defined(_M_X64) 
42 //  || defined(__ia64)      || defined (_M_IA64) 
43 //  || defined(__aarch64__) || defined(__powerpc64__)
44 
45 alias VkFlags      = uint;
46 alias VkBool32     = uint;
47 alias VkDeviceSize = ulong;
48 alias VkSampleMask = uint;
49 
50 enum VK_VERSION_1_0 = 1;
51 enum VK_API_VERSION = VK_MAKE_VERSION(1, 0, 3); // Vulkan API version supported by this binding
52 enum VK_NULL_HANDLE = null;
53 
54 enum VK_TRUE  = 1;
55 enum VK_FALSE = 0;
56 
57 enum VK_UUID_SIZE  = 16;
58 enum VK_WHOLE_SIZE = (~0UL);
59 
60 enum VK_LOD_CLAMP_NONE    = 1000.0f;
61 enum VK_ATTACHMENT_UNUSED = (~0U);
62 enum VK_SUBPASS_EXTERNAL  = (~0U);
63 
64 enum VK_QUEUE_FAMILY_IGNORED   = (~0U);
65 enum VK_REMAINING_MIP_LEVELS   = (~0U);
66 enum VK_REMAINING_ARRAY_LAYERS = (~0U);
67 
68 enum VK_MAX_MEMORY_TYPES        = 32;
69 enum VK_MAX_MEMORY_HEAPS        = 16;
70 enum VK_MAX_EXTENSION_NAME_SIZE = 256;
71 enum VK_MAX_DESCRIPTION_SIZE    = 256;
72 enum VK_MAX_PHYSICAL_DEVICE_NAME_SIZE = 256;