diff options
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 28 | ||||
-rw-r--r-- | fedora-fixes.diff | 149 |
3 files changed, 165 insertions, 20 deletions
@@ -1,20 +1,22 @@ # Generated by makepkg 5.0.0 -# Thu Feb 18 22:38:12 UTC 2016 +# Sun Feb 21 11:15:47 UTC 2016 pkgbase = vkcube-git pkgdesc = Demo cube app for Vulkan pkgver = r34.55ca5fb - pkgrel = 1 + pkgrel = 2 url = https://github.com/krh/vkcube arch = i686 arch = x86_64 license = MIT makedepends = git + makedepends = vulkan-i965-git depends = vulkan-icd-loader - depends = vulkan-i965-git depends = libpng depends = mesa source = git+https://github.com/krh/vkcube + source = fedora-fixes.diff sha1sums = SKIP + sha1sums = 759aead188d3e45c7d2284280c1b98fd108f2dc1 pkgname = vkcube-git @@ -3,14 +3,16 @@ pkgname='vkcube-git' pkgdesc='Demo cube app for Vulkan' pkgver=r34.55ca5fb -pkgrel=1 +pkgrel=2 url='https://github.com/krh/vkcube' arch=('i686' 'x86_64') license=('MIT') -depends=('vulkan-icd-loader' 'vulkan-i965-git' 'libpng' 'mesa') -source=('git+https://github.com/krh/vkcube') -sha1sums=('SKIP') -makedepends=('git') +depends=('vulkan-icd-loader' 'libpng' 'mesa') +source=('git+https://github.com/krh/vkcube' + 'fedora-fixes.diff') +sha1sums=('SKIP' + '759aead188d3e45c7d2284280c1b98fd108f2dc1') +makedepends=('git' 'vulkan-i965-git') pkgver() { cd "${srcdir}"/vkcube @@ -20,12 +22,13 @@ pkgver() { prepare() { cd "${srcdir}"/vkcube + patch -p1 < ../fedora-fixes.diff + autoreconf -f -i -v ./configure --prefix=/usr - + # Temporary fix until Intel vulkan driver moves to /usr/ sed -i.bak 's|DEFAULT_INCLUDES = -I.|DEFAULT_INCLUDES = -I. -I/opt/mesa-vulkan/include|g' Makefile - sed -i.bak 's|-lvulkan-1|-lvulkan -L/opt/mesa-vulkan/lib -lvulkan_intel|g' Makefile } build() { @@ -37,16 +40,7 @@ build() { package() { cd "${srcdir}"/vkcube - install -dm755 "${pkgdir}"/opt/vkcube/bin - install -m755 vkcube "${pkgdir}"/opt/vkcube/bin/vkcube - - # Temporary fix until Intel vulkan driver moves to /usr/ - # Since vulkan-i965-git libraries conflicts with mesa libraries we cannot add vulkan to library path system wide - # # install -dm755 "${pkgdir}"/etc/ld.so.conf.d - # # echo '/opt/mesa-vulkan/lib' > "${pkgdir}"/etc/ld.so.conf.d/vkcube.conf - install -dm755 "${pkgdir}"/usr/bin - echo 'env LD_LIBRARY_PATH=/opt/mesa-vulkan/lib:$LD_LYBRARY_PATH /opt/vkcube/bin/vkcube' > "${pkgdir}"/usr/bin/vkcube - chmod 755 "${pkgdir}"/usr/bin/vkcube + install -m755 vkcube "${pkgdir}"/usr/bin/vkcube } diff --git a/fedora-fixes.diff b/fedora-fixes.diff new file mode 100644 index 000000000000..45d829108931 --- /dev/null +++ b/fedora-fixes.diff @@ -0,0 +1,149 @@ +diff --git a/Makefile.am b/Makefile.am +index 4ec1270..1f2011a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,16 +2,7 @@ CPPFLAGS = \ + $(MESA_CPPFLAGS) \ + -D_POSIX_C_SOURCE=200809L + +-common_CFLAGS = -Wall -O0 -g3 +- +-CFLAGS = -std=c11 \ +- $(common_CFLAGS) \ +- -Werror=implicit-function-declaration \ +- -Werror=missing-prototypes +- +-CXXFLAGS = -std=c++11 $(common_CFLAGS) +- +-noinst_PROGRAMS = vkcube ++bin_PROGRAMS = vkcube + + BUILT_SOURCES = \ + vkcube.vert.spv.h \ +@@ -33,4 +24,4 @@ vkcube_SOURCES = \ + CLEANFILES = $(BUILT_SOURCES) + + vkcube_CFLAGS = $(CFLAGS) $(MINIGBM_CPPFLAGS) $(LIBDRM_CFLAGS) $(WAYLAND_CFLAGS) +-vkcube_LDADD = $(MINIGBM_LDFLAGS) $(MESA_LDFLAGS) $(LIBDRM_LIBS) $(WAYLAND_LIBS) -lgbm -lm -lvulkan-1 -lpng16 -lxcb ++vkcube_LDADD = $(MINIGBM_LDFLAGS) $(MESA_LDFLAGS) $(LIBDRM_LIBS) $(WAYLAND_LIBS) -lgbm -lm -lvulkan -lpng16 -lxcb +diff --git a/main.c b/main.c +index 3014e76..5af7929 100644 +--- a/main.c ++++ b/main.c +@@ -73,7 +73,7 @@ fail_if(int cond, const char *format, ...) + } + + static void +-init_vk(struct vkcube *vc) ++init_vk(struct vkcube *vc, const char *extension) + { + vkCreateInstance(&(VkInstanceCreateInfo) { + .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, +@@ -81,7 +81,9 @@ init_vk(struct vkcube *vc) + .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, + .pApplicationName = "vkcube", + .apiVersion = VK_MAKE_VERSION(1, 0, 2), +- } ++ }, ++ .enabledExtensionCount = (extension != NULL), ++ .ppEnabledExtensionNames = &extension, + }, + NULL, + &vc->instance); +@@ -281,7 +283,7 @@ write_buffer(struct vkcube *vc, struct vkcube_buffer *b) + static void + init_headless(struct vkcube *vc) + { +- init_vk(vc); ++ init_vk(vc, NULL); + + struct vkcube_buffer *b = &vc->buffers[0]; + +@@ -430,7 +432,10 @@ init_kms(struct vkcube *vc) + + vc->gbm_device = gbm_create_device(vc->fd); + +- init_vk(vc); ++ init_vk(vc, NULL); ++ ++ PFN_vkCreateDmaBufImageINTEL create_dma_buf_image = ++ (PFN_vkCreateDmaBufImageINTEL)vkGetDeviceProcAddr(vc->device, "vkCreateDmaBufImageINTEL"); + + for (uint32_t i = 0; i < 2; i++) { + struct vkcube_buffer *b = &vc->buffers[i]; +@@ -441,17 +446,17 @@ init_kms(struct vkcube *vc) + + fd = gbm_bo_get_fd(b->gbm_bo); + stride = gbm_bo_get_stride(b->gbm_bo); +- vkCreateDmaBufImageINTEL(vc->device, +- &(VkDmaBufImageCreateInfo) { +- .sType = VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL, +- .fd = fd, +- .format = VK_FORMAT_R8G8B8A8_SRGB, +- .extent = { vc->width, vc->height, 1 }, +- .strideInBytes = stride +- }, +- NULL, +- &b->mem, +- &b->image); ++ create_dma_buf_image(vc->device, ++ &(VkDmaBufImageCreateInfo) { ++ .sType = VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL, ++ .fd = fd, ++ .format = VK_FORMAT_R8G8B8A8_SRGB, ++ .extent = { vc->width, vc->height, 1 }, ++ .strideInBytes = stride ++ }, ++ NULL, ++ &b->mem, ++ &b->image); + close(fd); + + b->stride = gbm_bo_get_stride(b->gbm_bo); +@@ -600,7 +605,7 @@ init_xcb(struct vkcube *vc) + + xcb_flush(vc->xcb.conn); + +- init_vk(vc); ++ init_vk(vc, VK_KHR_XCB_SURFACE_EXTENSION_NAME); + + if (!vkGetPhysicalDeviceXcbPresentationSupportKHR(vc->physical_device, 0, + vc->xcb.conn, +@@ -804,9 +809,14 @@ init_wayland(struct vkcube *vc) + xdg_surface_add_listener(vc->wl.xdg_surface, &xdg_surface_listener, vc); + xdg_surface_set_title(vc->wl.xdg_surface, "vkcube"); + +- init_vk(vc); ++ init_vk(vc, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); + +- if (!vkGetPhysicalDeviceWaylandPresentationSupportKHR(vc->physical_device, 0, ++ PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR get_physical_device_wayland_presentation_support = ++ (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR) ++ vkGetDeviceProcAddr(vc->device, ++ "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); ++ ++ if (!get_physical_device_wayland_presentation_support(vc->physical_device, 0, + vc->wl.display)) { + fprintf(stderr, "Vulkan not supported on given Wayland surface"); + abort(); +@@ -814,7 +824,10 @@ init_wayland(struct vkcube *vc) + + VkSurfaceKHR wsi_surface; + +- vkCreateWaylandSurfaceKHR(vc->instance, ++ PFN_vkCreateWaylandSurfaceKHR create_wayland_surface = ++ (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(vc->instance, "vkCreateWaylandSurfaceKHR"); ++ ++ create_wayland_surface(vc->instance, + &(VkWaylandSurfaceCreateInfoKHR) { + .sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR, + .display = vc->wl.display, +@@ -915,7 +928,7 @@ extern struct model cube_model; + int main(int argc, char *argv[]) + { + struct vkcube vc; +- bool headless; ++ bool headless = false; + + vc.model = cube_model; + vc.gbm_device = NULL; |