image_view: add minimal VkImageView wrapper

This commit is contained in:
Danny Robson 2017-09-09 15:46:08 +10:00
parent 7bc8870e06
commit f64990d0c2
6 changed files with 71 additions and 33 deletions

View File

@ -66,6 +66,7 @@ list (APPEND sources
instance.hpp
image.cpp
image.hpp
image_view.hpp
ostream.cpp
ostream.hpp
physical_device.cpp

36
fwd.hpp
View File

@ -28,23 +28,25 @@ namespace cruft::vk {
template <typename SelfT, typename ParentT> struct enumerated;
template <typename SelfT, typename OwnerT> 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) \

30
image_view.hpp Normal file
View File

@ -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 <danny@nerdcruft.net>
*/
#ifndef CRUFT_VK_SEMAPHORE_HPP
#define CRUFT_VK_SEMAPHORE_HPP
#include "./object.hpp"
#include "./fwd.hpp"
namespace cruft::vk {
struct image_view : public owned<image_view,device> {
using owned::owned;
};
};
#endif

View File

@ -23,8 +23,8 @@
namespace cruft::vk {
struct semaphore : public owned<semaphore,device> {
using owned::owned;
};
}
};
#endif

View File

@ -3,6 +3,8 @@
#include <cruft/vk/queue.hpp>
#include <cruft/vk/device.hpp>
#include <cruft/vk/surface.hpp>
#include <cruft/vk/semaphore.hpp>
#include <cruft/vk/image_view.hpp>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>

View File

@ -93,23 +93,24 @@ namespace cruft::vk {
//-------------------------------------------------------------------------
template <> struct native_traits<instance> { using type = VkInstance; };
template <> struct native_traits<physical_device> { using type = VkPhysicalDevice; };
template <> struct native_traits<device> { using type = VkDevice; };
template <> struct native_traits<queue> { using type = VkQueue; };
template <> struct native_traits<command_pool> { using type = VkCommandPool; };
template <> struct native_traits<command_buffer> { using type = VkCommandBuffer; };
template <> struct native_traits<fence> { using type = VkFence; };
template <> struct native_traits<semaphore> { using type = VkSemaphore; };
template <> struct native_traits<event> { using type = VkEvent; };
template <> struct native_traits<render_pass> { using type = VkRenderPass; };
template <> struct native_traits<framebuffer> { using type = VkFramebuffer; };
template <> struct native_traits<shader_module> { using type = VkShaderModule; };
template <> struct native_traits<pipeline> { using type = VkPipeline; };
template <> struct native_traits<pipeline_cache> { using type = VkPipelineCache; };
template <> struct native_traits<device_memory> { using type = VkDeviceMemory; };
template <> struct native_traits<buffer> { using type = VkBuffer; };
template <> struct native_traits<buffer_view> { using type = VkBufferView; };
template <> struct native_traits<command_buffer> { using type = VkCommandBuffer; };
template <> struct native_traits<command_pool> { using type = VkCommandPool; };
template <> struct native_traits<device_memory> { using type = VkDeviceMemory; };
template <> struct native_traits<device> { using type = VkDevice; };
template <> struct native_traits<event> { using type = VkEvent; };
template <> struct native_traits<fence> { using type = VkFence; };
template <> struct native_traits<framebuffer> { using type = VkFramebuffer; };
template <> struct native_traits<image_view> { using type = VkImageView; };
template <> struct native_traits<instance> { using type = VkInstance; };
template <> struct native_traits<physical_device> { using type = VkPhysicalDevice; };
template <> struct native_traits<pipeline_cache> { using type = VkPipelineCache; };
template <> struct native_traits<pipeline> { using type = VkPipeline; };
template <> struct native_traits<queue> { using type = VkQueue; };
template <> struct native_traits<render_pass> { using type = VkRenderPass; };
template <> struct native_traits<semaphore> { using type = VkSemaphore; };
template <> struct native_traits<shader_module> { using type = VkShaderModule; };
template <> struct native_traits<surface> { using type = VkSurfaceKHR; };