From f64990d0c28e95a68e7f5bf2a5ca1f374e3456bd Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 9 Sep 2017 15:46:08 +1000 Subject: [PATCH] image_view: add minimal VkImageView wrapper --- CMakeLists.txt | 1 + fwd.hpp | 36 ++++++++++++++++++++---------------- image_view.hpp | 30 ++++++++++++++++++++++++++++++ semaphore.hpp | 4 ++-- tools/hello.cpp | 2 ++ traits.hpp | 31 ++++++++++++++++--------------- 6 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 image_view.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d781674..eb9da85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ list (APPEND sources instance.hpp image.cpp image.hpp + image_view.hpp ostream.cpp ostream.hpp physical_device.cpp diff --git a/fwd.hpp b/fwd.hpp index 4f6e76c..2d6577e 100644 --- a/fwd.hpp +++ b/fwd.hpp @@ -28,23 +28,25 @@ namespace cruft::vk { template struct enumerated; template struct owned; - struct instance; - struct physical_device; - struct device; - struct queue; - struct command_pool; - struct command_buffer; - struct fence; - struct semaphore; - struct event; - struct render_pass; - struct framebuffer; - struct shader_module; - struct pipeline; - struct pipeline_cache; - struct device_memory; struct buffer; struct buffer_view; + struct command_buffer; + struct command_pool; + struct device; + struct device_memory; + struct event; + struct fence; + struct framebuffer; + struct instance; + struct image; + struct image_view; + struct physical_device; + struct pipeline; + struct pipeline_cache; + struct queue; + struct render_pass; + struct semaphore; + struct shader_module; struct surface; class error; @@ -61,7 +63,9 @@ namespace cruft::vk { #define VK_OWNED_TYPE_MAP(FUNC) \ MAP(FUNC, \ queue, \ - surface) + surface, \ + semaphore, \ + image_view) #define VK_TYPE_MAP(FUNC) \ MAP(FUNC,instance) \ diff --git a/image_view.hpp b/image_view.hpp new file mode 100644 index 0000000..085b3be --- /dev/null +++ b/image_view.hpp @@ -0,0 +1,30 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright: + * 2016, Danny Robson + */ + +#ifndef CRUFT_VK_SEMAPHORE_HPP +#define CRUFT_VK_SEMAPHORE_HPP + +#include "./object.hpp" +#include "./fwd.hpp" + +namespace cruft::vk { + struct image_view : public owned { + using owned::owned; + }; +}; + +#endif diff --git a/semaphore.hpp b/semaphore.hpp index 26e9bc0..99c7a4f 100644 --- a/semaphore.hpp +++ b/semaphore.hpp @@ -23,8 +23,8 @@ namespace cruft::vk { struct semaphore : public owned { - + using owned::owned; }; -} +}; #endif diff --git a/tools/hello.cpp b/tools/hello.cpp index a8840dd..5f15726 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include diff --git a/traits.hpp b/traits.hpp index 70600ba..5bfd844 100644 --- a/traits.hpp +++ b/traits.hpp @@ -93,23 +93,24 @@ namespace cruft::vk { //------------------------------------------------------------------------- - template <> struct native_traits { using type = VkInstance; }; - template <> struct native_traits { using type = VkPhysicalDevice; }; - template <> struct native_traits { using type = VkDevice; }; - template <> struct native_traits { using type = VkQueue; }; - template <> struct native_traits { using type = VkCommandPool; }; - template <> struct native_traits { using type = VkCommandBuffer; }; - template <> struct native_traits { using type = VkFence; }; - template <> struct native_traits { using type = VkSemaphore; }; - template <> struct native_traits { using type = VkEvent; }; - template <> struct native_traits { using type = VkRenderPass; }; - template <> struct native_traits { using type = VkFramebuffer; }; - template <> struct native_traits { using type = VkShaderModule; }; - template <> struct native_traits { using type = VkPipeline; }; - template <> struct native_traits { using type = VkPipelineCache; }; - template <> struct native_traits { using type = VkDeviceMemory; }; template <> struct native_traits { using type = VkBuffer; }; template <> struct native_traits { using type = VkBufferView; }; + template <> struct native_traits { using type = VkCommandBuffer; }; + template <> struct native_traits { using type = VkCommandPool; }; + template <> struct native_traits { using type = VkDeviceMemory; }; + template <> struct native_traits { using type = VkDevice; }; + template <> struct native_traits { using type = VkEvent; }; + template <> struct native_traits { using type = VkFence; }; + template <> struct native_traits { using type = VkFramebuffer; }; + template <> struct native_traits { using type = VkImageView; }; + template <> struct native_traits { using type = VkInstance; }; + template <> struct native_traits { using type = VkPhysicalDevice; }; + template <> struct native_traits { using type = VkPipelineCache; }; + template <> struct native_traits { using type = VkPipeline; }; + template <> struct native_traits { using type = VkQueue; }; + template <> struct native_traits { using type = VkRenderPass; }; + template <> struct native_traits { using type = VkSemaphore; }; + template <> struct native_traits { using type = VkShaderModule; }; template <> struct native_traits { using type = VkSurfaceKHR; };