Skip to content

Commit

Permalink
Merge pull request #8 from SKY-13th/feature/remove-redundant-library-…
Browse files Browse the repository at this point in the history
…dependency

Remove redundant library dependency
  • Loading branch information
SKY-13th authored Jul 7, 2018
2 parents 2643f9d + b72f435 commit 8597540
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.dub
dub.*
dub.selections.*
bin
docs.json
__dummy.html
4 changes: 1 addition & 3 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"targetPath": "bin",
"targetType": "library",
"dependencies": {
"derelict-util" : ">=3.0.0",
"xlib-d": { "version": "~>0.1.1", "optional": true },
"xcb-d" : { "version": "~>2.1.0+1.11.1", "optional": true }
"derelict-util" : ">=3.0.0-alpha.1"
}
}
39 changes: 14 additions & 25 deletions source/derelict/vulkan/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,30 @@ extern(System):

//#include "vk_platform.h"

auto VK_MAKE_VERSION(int major, int minor, int patch) {
return (major << 22) | (minor << 12) | patch;
}

auto VK_VERSION_MAJOR(uint ver) {
return ver >> 22;
}

auto VK_VERSION_MINOR(uint ver) {
return (ver >> 12) & 0x3ff;
}

auto VK_VERSION_PATCH(uint ver) {
return ver & 0xfff;
}
alias VK_VERSION_MAJOR = (uint ver) => ver >> 22;
alias VK_VERSION_MINOR = (uint ver) => (ver >> 12) & 0x3ff;
alias VK_VERSION_PATCH = (uint ver) => ver & 0xfff;
alias VK_MAKE_VERSION = (uint major, uint minor, uint patch) =>
(major << 22) | (minor << 12) | patch;

package auto VK_DEFINE_HANDLE(string name) {
return "struct " ~ name ~ "_T; \n alias " ~ name ~ " = " ~ name ~ "_T*;";
package mixin template VK_DEFINE_HANDLE(string name) {
mixin("struct " ~ name ~ "_T; \n alias " ~ name ~ " = " ~ name ~ "_T*;");
}

package auto VK_DEFINE_NON_DISPATCHABLE_HANDLE(string name) {
// #if defined(__LP64__) || defined(_WIN64)
// || defined(__x86_64__) || defined(_M_X64)
// || defined(__ia64) || defined (_M_IA64)
// || defined(__aarch64__) || defined(__powerpc64__)
return VK_DEFINE_HANDLE(name);
package mixin template VK_DEFINE_NON_DISPATCHABLE_HANDLE(string name) {
mixin("alias " ~ name ~ " = void*;");
}
// #if defined(__LP64__) || defined(_WIN64)
// || defined(__x86_64__) || defined(_M_X64)
// || defined(__ia64) || defined (_M_IA64)
// || defined(__aarch64__) || defined(__powerpc64__)

alias VkFlags = uint;
alias VkBool32 = uint;
alias VkDeviceSize = ulong;
alias VkSampleMask = uint;

enum VK_VERSION_1_0 = 1;
enum VK_API_VERSION = VK_MAKE_VERSION(1, 0, 3); // Vulkan API version supported by this file
enum VK_API_VERSION = VK_MAKE_VERSION(1, 0, 3); // Vulkan API version supported by this binding
enum VK_NULL_HANDLE = null;

enum VK_TRUE = 1;
Expand Down
21 changes: 11 additions & 10 deletions source/derelict/vulkan/system/posix/mir.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public {
import derelict.vulkan.types;
}

// TODO: add import of data related to Mir protocol
// #include <mir_toolkit/client_types.h>
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"MirConnectionHandle";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"MirSurfaceHandle";

enum VK_KHR_mir_surface = 1;
enum VK_KHR_MIR_SURFACE_SPEC_VERSION = 4;
enum VK_KHR_MIR_SURFACE_EXTENSION_NAME = "VK_KHR_mir_surface";
Expand All @@ -47,8 +48,8 @@ struct VkMirSurfaceCreateInfoKHR {
VkStructureType sType ;
const(void)* pNext ;
VkMirSurfaceCreateFlagsKHR flags ;
MirConnection* connection;
MirSurface* mirSurface;
MirConnectionHandle connection;
MirSurfaceHandle mirSurface;
}

alias PFN_vkCreateMirSurfaceKHR = nothrow
Expand All @@ -57,9 +58,9 @@ alias PFN_vkCreateMirSurfaceKHR = nothrow
, const(VkAllocationCallbacks)* pAllocator
, VkSurfaceKHR* pSurface );
alias PFN_vkGetPhysicalDeviceMirPresentationSupportKHR = nothrow
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, MirConnection* connection);
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, MirConnectionHandle connection);

mixin template MirFunctions() {
PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR;
Expand All @@ -77,7 +78,7 @@ version (none) {
, const(VkMirSurfaceCreateInfoKHR)* pCreateInfo
, const(VkAllocationCallbacks)* pAllocator
, VkSurfaceKHR* pSurface );
VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, MirConnection* connection );
VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, MirConnectionHandle connection );
}
2 changes: 1 addition & 1 deletion source/derelict/vulkan/system/posix/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ version (VK_USE_PLATFORM_WAYLAND_KHR)
mixin template Functions() {
version (VK_USE_PLATFORM_XCB_KHR) mixin XCBFunctions;
version (VK_USE_PLATFORM_XLIB_KHR) mixin XLibFunctions;
version (VK_USE_PLATFORM_MIR_KHR) mixin MirFuntions;
version (VK_USE_PLATFORM_MIR_KHR) mixin MirFunctions;
version (VK_USE_PLATFORM_WAYLAND_KHR) mixin WaylandFunctions;
pragma(inline, true)
void bindFunctions(alias bind)() {
Expand Down
13 changes: 7 additions & 6 deletions source/derelict/vulkan/system/posix/wayland.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public {
import derelict.vulkan.types;
}

// TODO: add import of data related to Wayland protocol
// #include <wayland-client.h>
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"WlDisplayHandle";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"WlSurfaceHandle";

enum VK_KHR_wayland_surface = 1;
enum VK_KHR_WAYLAND_SURFACE_SPEC_VERSION = 5;
enum VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME = "VK_KHR_wayland_surface";
Expand All @@ -47,8 +48,8 @@ struct VkWaylandSurfaceCreateInfoKHR {
VkStructureType sType ;
const(void)* pNext ;
VkWaylandSurfaceCreateFlagsKHR flags ;
wl_display* display;
wl_surface* surface;
WlDisplayHandle display;
WlSurfaceHandle surface;
}

alias PFN_vkCreateWaylandSurfaceKHR = nothrow
Expand All @@ -59,7 +60,7 @@ alias PFN_vkCreateWaylandSurfaceKHR = nothrow
alias PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR = nothrow
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, wl_display* display );
, WlDisplayHandle display );

mixin template WaylandFunctions() {
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR;
Expand All @@ -79,5 +80,5 @@ version (none) {
, VkSurfaceKHR* pSurface );
VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, wl_display* display );
, WlDisplayHandle display );
}
23 changes: 13 additions & 10 deletions source/derelict/vulkan/system/posix/xcb.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public {
import derelict.vulkan.types;
}

import xcb.xcb;
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"XCBConnectionHandle";
alias xcb_window_t = uint;
alias xcb_visualid_t = uint;

enum VK_KHR_xcb_surface = 1;
enum VK_KHR_XCB_SURFACE_SPEC_VERSION = 6;
enum VK_KHR_XCB_SURFACE_EXTENSION_NAME = "VK_KHR_xcb_surface";
Expand All @@ -46,7 +49,7 @@ struct VkXcbSurfaceCreateInfoKHR {
VkStructureType sType ;
const(void)* pNext ;
VkXcbSurfaceCreateFlagsKHR flags ;
xcb_connection_t* connection;
XCBConnectionHandle connection;
xcb_window_t window ;
}

Expand All @@ -56,10 +59,10 @@ alias PFN_vkCreateXcbSurfaceKHR = nothrow
, const(VkAllocationCallbacks)* pAllocator
, VkSurfaceKHR* pSurface );
alias PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR = nothrow
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, xcb_connection_t* connection
, xcb_visualid_t visual_id );
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, XCBConnectionHandle connection
, xcb_visualid_t visual_id );

mixin template XCBFunctions() {
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR;
Expand All @@ -77,8 +80,8 @@ version (none) {
, const(VkXcbSurfaceCreateInfoKHR)* pCreateInfo
, const(VkAllocationCallbacks)* pAllocator
, VkSurfaceKHR* pSurface );
VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, xcb_connection_t* connection
, xcb_visualid_t visual_id);
VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, XCBConnectionHandle connection
, xcb_visualid_t visual_id);
}
25 changes: 14 additions & 11 deletions source/derelict/vulkan/system/posix/xlib.d
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public {
import derelict.vulkan.base;
import derelict.vulkan.types;
}
import X11.Xlib;

mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"XLibDisplayHandle";
alias XLibWindow = uint;
alias XLibVisualID = uint;

enum VK_KHR_xlib_surface = 1;
enum VK_KHR_XLIB_SURFACE_SPEC_VERSION = 6;
Expand All @@ -46,8 +49,8 @@ struct VkXlibSurfaceCreateInfoKHR {
VkStructureType sType ;
const(void)* pNext ;
VkXlibSurfaceCreateFlagsKHR flags ;
Display* dpy ;
Window window;
XLibDisplayHandle dpy ;
XLibWindow window;
}

alias PFN_vkCreateXlibSurfaceKHR = nothrow
Expand All @@ -56,10 +59,10 @@ alias PFN_vkCreateXlibSurfaceKHR = nothrow
, const(VkAllocationCallbacks)* pAllocator
, VkSurfaceKHR* pSurface );
alias PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR = nothrow
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, Display* dpy
, VisualID visualID);
VkBool32 function( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, XLibDisplayHandle dpy
, XLibVisualID visualID);

mixin template XLibFunctions() {
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR;
Expand All @@ -77,8 +80,8 @@ version (none) {
, const(VkXlibSurfaceCreateInfoKHR)* pCreateInfo
, const(VkAllocationCallbacks)* pAllocator
, VkSurfaceKHR* pSurface );
VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, Display* dpy
, VisualID visualID );
VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR( VkPhysicalDevice physicalDevice
, uint queueFamilyIndex
, XLibDisplayHandle dpy
, XLibVisualID visualID );
}
60 changes: 30 additions & 30 deletions source/derelict/vulkan/types.d
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ import derelict.vulkan.system;

extern(System):

mixin(VK_DEFINE_HANDLE("VkInstance"));
mixin(VK_DEFINE_HANDLE("VkPhysicalDevice"));
mixin(VK_DEFINE_HANDLE("VkDevice"));
mixin(VK_DEFINE_HANDLE("VkQueue"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkSemaphore"));
mixin(VK_DEFINE_HANDLE("VkCommandBuffer"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkFence"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDeviceMemory"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkBuffer"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkImage"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkEvent"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkQueryPool"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkBufferView"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkImageView"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkShaderModule"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkPipelineCache"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkPipelineLayout"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkRenderPass"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkPipeline"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDescriptorSetLayout"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkSampler"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDescriptorPool"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDescriptorSet"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkFramebuffer"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkCommandPool"));
mixin VK_DEFINE_HANDLE!"VkInstance";
mixin VK_DEFINE_HANDLE!"VkPhysicalDevice";
mixin VK_DEFINE_HANDLE!"VkDevice";
mixin VK_DEFINE_HANDLE!"VkQueue";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkSemaphore";
mixin VK_DEFINE_HANDLE!"VkCommandBuffer";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkFence";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDeviceMemory";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkBuffer";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkImage";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkEvent";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkQueryPool";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkBufferView";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkImageView";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkShaderModule";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkPipelineCache";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkPipelineLayout";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkRenderPass";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkPipeline";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDescriptorSetLayout";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkSampler";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDescriptorPool";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDescriptorSet";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkFramebuffer";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkCommandPool";

enum VkPipelineCacheHeaderVersion {
VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1,
Expand Down Expand Up @@ -2588,7 +2588,7 @@ version (none) {
}

enum VK_KHR_surface = 1;
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkSurfaceKHR"));
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkSurfaceKHR";

enum VK_KHR_SURFACE_SPEC_VERSION = 25;
enum VK_KHR_SURFACE_EXTENSION_NAME = "VK_KHR_surface";
Expand Down Expand Up @@ -2672,7 +2672,7 @@ version (none) {
}

enum VK_KHR_swapchain = 1;
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkSwapchainKHR"));
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkSwapchainKHR";

enum VK_KHR_SWAPCHAIN_SPEC_VERSION = 67;
enum VK_KHR_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_swapchain";
Expand Down Expand Up @@ -2730,8 +2730,8 @@ version (none) {
}

enum VK_KHR_display = 1;
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDisplayKHR"));
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDisplayModeKHR"));
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDisplayKHR";
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDisplayModeKHR";

enum VK_KHR_DISPLAY_SPEC_VERSION = 21;
enum VK_KHR_DISPLAY_EXTENSION_NAME = "VK_KHR_display";
Expand Down Expand Up @@ -2847,7 +2847,7 @@ version (none) {
}

enum VK_EXT_debug_report = 1;
mixin(VK_DEFINE_NON_DISPATCHABLE_HANDLE("VkDebugReportCallbackEXT"));
mixin VK_DEFINE_NON_DISPATCHABLE_HANDLE!"VkDebugReportCallbackEXT";

enum VK_EXT_DEBUG_REPORT_SPEC_VERSION = 1;
enum VK_EXT_DEBUG_REPORT_EXTENSION_NAME = "VK_EXT_debug_report";
Expand Down

0 comments on commit 8597540

Please sign in to comment.