Skip to content

Commit

Permalink
Merge pull request #31 from serenity4/master
Browse files Browse the repository at this point in the history
Add DirectFB extension and define more extension types
  • Loading branch information
Gnimuc authored Jan 15, 2021
2 parents 7798181 + f1502ac commit 3fc15e4
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set Environment variables
run: echo "::set-env name=VULKAN_SDK::C:\VulkanSDK\${{env.VulkanSDKVersion}}"
run: echo "VULKAN_SDK=C:\VulkanSDK\${{env.VulkanSDKVersion}}" >> $GITHUB_ENV
- name: Download & Install Vulkan SDK
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/${{env.VulkanSDKVersion}}/windows/VulkanSDK-${{env.VulkanSDKVersion}}-Installer.exe?u= -OutFile ../vulkan-sdk-${{env.VulkanSDKVersion}}.exe
Expand Down Expand Up @@ -65,10 +65,10 @@ jobs:
- name: Set Environment variables
run: |
VULKAN_SDK=$GITHUB_WORKSPACE/../vulkansdk-macos-${{env.VulkanSDKVersion}}/macOS
echo ::set-env name=VULKAN_SDK::$VULKAN_SDK
echo ::set-env name=JULIA_VULKAN_SDK_SEARCH_PATH::$VULKAN_SDK/lib
echo ::set-env name=VK_LAYER_PATH::$VULKAN_SDK/share/vulkan/explicit_layer.d
echo ::set-env name=VK_ICD_FILENAMES::$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json
echo VULKAN_SDK=$VULKAN_SDK >> $GITHUB_ENV
echo JULIA_VULKAN_SDK_SEARCH_PATH=$VULKAN_SDK/lib >> $GITHUB_ENV
echo VK_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d >> $GITHUB_ENV
echo VK_ICD_FILENAMES=$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json >> $GITHUB_ENV
- name: Download & Extract Vulkan SDK
run: |
wget --no-cookies -O ../vulkansdk-macos-${{env.VulkanSDKVersion}}.dmg https://sdk.lunarg.com/sdk/download/${{env.VulkanSDKVersion}}/mac/vulkansdk-macos-${{env.VulkanSDKVersion}}.dmg?u=
Expand All @@ -85,4 +85,4 @@ jobs:
DISPLAY: :99
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "VulkanCore"
uuid = "16167f82-ea26-5cba-b1de-ed6fd5e30a11"
version = "1.2.1"
version = "1.2.2"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
3 changes: 2 additions & 1 deletion gen/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ VK_HEADERS = [joinpath(VK_INCLUDE, "vulkan.h")]

# include all extensions
VK_EXTENSIONS = [
"VK_USE_PLATFORM_DIRECTFB_EXT",
"VK_USE_PLATFORM_ANDROID_KHR",
"VK_USE_PLATFORM_FUCHSIA",
"VK_USE_PLATFORM_IOS_MVK",
Expand Down Expand Up @@ -55,4 +56,4 @@ for func ∈ eachmatch(r"function (.*)\((.*)\)\n (ccall.*)\nend", api_str)
end
open(api_file, "a+") do io
write(io, "\n" * join(wrapped_funcs, "\n"))
end
end
16 changes: 16 additions & 0 deletions gen/vk_api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,14 @@ function vkGetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFami
ccall((:vkGetPhysicalDeviceXlibPresentationSupportKHR, libvulkan), VkBool32, (VkPhysicalDevice, UInt32, Ptr{Display}, VisualID), physicalDevice, queueFamilyIndex, dpy, visualID)
end

function vkCreateDirectFBSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface)
ccall((:vkCreateDirectFBSurfaceEXT, libvulkan), VkResult, (VkInstance, Ptr{VkDirectFBSurfaceCreateInfoEXT}, Ptr{VkAllocationCallbacks}, Ptr{VkSurfaceKHR}), instance, pCreateInfo, pAllocator, pSurface)
end

function vkGetPhysicalDeviceDirectFBPresentationSupportEXT(physicalDevice, queueFamilyIndex, dfb)
ccall((:vkGetPhysicalDeviceDirectFBPresentationSupportEXT, libvulkan), VkBool32, (VkPhysicalDevice, UInt32, Ptr{Cint}), physicalDevice, queueFamilyIndex, dfb)
end

function vkAcquireXlibDisplayEXT(physicalDevice, dpy, display)
ccall((:vkAcquireXlibDisplayEXT, libvulkan), VkResult, (VkPhysicalDevice, Ptr{Display}, VkDisplayKHR), physicalDevice, dpy, display)
end
Expand Down Expand Up @@ -3354,6 +3362,14 @@ function vkGetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFami
ccall(fun_ptr, VkBool32, (VkPhysicalDevice, UInt32, Ptr{Display}, VisualID), physicalDevice, queueFamilyIndex, dpy, visualID)
end

function vkCreateDirectFBSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface, fun_ptr)
ccall(fun_ptr, VkResult, (VkInstance, Ptr{VkDirectFBSurfaceCreateInfoEXT}, Ptr{VkAllocationCallbacks}, Ptr{VkSurfaceKHR}), instance, pCreateInfo, pAllocator, pSurface)
end

function vkGetPhysicalDeviceDirectFBPresentationSupportEXT(physicalDevice, queueFamilyIndex, dfb, fun_ptr)
ccall(fun_ptr, VkBool32, (VkPhysicalDevice, UInt32, Ptr{Cint}), physicalDevice, queueFamilyIndex, dfb)
end

function vkAcquireXlibDisplayEXT(physicalDevice, dpy, display, fun_ptr)
ccall(fun_ptr, VkResult, (VkPhysicalDevice, Ptr{Display}, VkDisplayKHR), physicalDevice, dpy, display)
end
Expand Down
16 changes: 16 additions & 0 deletions gen/vk_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ const VULKAN_XLIB_H_ = 1
const VK_KHR_xlib_surface = 1
const VK_KHR_XLIB_SURFACE_SPEC_VERSION = 6
const VK_KHR_XLIB_SURFACE_EXTENSION_NAME = "VK_KHR_xlib_surface"
const VULKAN_DIRECTFB_H_ = 1
const VK_EXT_directfb_surface = 1
const VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION = 1
const VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME = "VK_EXT_directfb_surface"
const VULKAN_XLIB_XRANDR_H_ = 1
const VK_EXT_acquire_xlib_display = 1
const VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION = 1
Expand Down Expand Up @@ -8785,6 +8789,18 @@ end

const PFN_vkCreateXlibSurfaceKHR = Ptr{Cvoid}
const PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR = Ptr{Cvoid}
const VkDirectFBSurfaceCreateFlagsEXT = VkFlags

struct VkDirectFBSurfaceCreateInfoEXT
sType::VkStructureType
pNext::Ptr{Cvoid}
flags::VkDirectFBSurfaceCreateFlagsEXT
dfb::Ptr{Cint}
surface::Ptr{Cint}
end

const PFN_vkCreateDirectFBSurfaceEXT = Ptr{Cvoid}
const PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT = Ptr{Cvoid}
const PFN_vkAcquireXlibDisplayEXT = Ptr{Cvoid}
const PFN_vkGetRandROutputDisplayEXT = Ptr{Cvoid}
const VkStreamDescriptorSurfaceCreateFlagsGGP = VkFlags
Expand Down
13 changes: 13 additions & 0 deletions src/LibVulkan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ const ANativeWindow = Cvoid # TODO: make opaque for now
# Windows
const HINSTANCE = Ptr{Cvoid}
const HWND = Ptr{Cvoid}
const HMONITOR = Ptr{Cvoid}
const HANDLE = HMONITOR
const DWORD = UInt32
const LPCWSTR = UInt16
const SECURITY_ATTRIBUTES = Cvoid # opaque struct
# DirectFB
const IDirectFB = Cvoid # opaque struct
const IDirectFBSurface = Cvoid # opaque struct
# Zircon
const zx_handle_t = UInt32
# GGP C
const GgpStreamDescriptor = UInt32
const GgpFrameToken = UInt32

# TODO: Clang.jl should support this kinda macros
VK_MAKE_VERSION(major, minor, patch) = ( Cuint(major) << 22 ) | ( Cuint(minor) << 12 ) | patch
Expand Down

2 comments on commit 3fc15e4

@Gnimuc
Copy link
Member Author

@Gnimuc Gnimuc commented on 3fc15e4 Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/27994

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.2 -m "<description of version>" 3fc15e41d91956ead5132974df86533fb2e15a1a
git push origin v1.2.2

Please sign in to comment.