Files
test2/source/blender/gpu/vulkan/vk_image_view.hh
Jeroen Bakker 2ee2ae93fb Vulkan: Initial Cube(Array) Support
This PR adds initial cube (array) support. Depending on how the texture
is used a different image view is created. When used as a framebuffer
attachment only a single side of the cubemap is attached. The image
view is attached as a 2d texture array. When used as a shader resource
the image view is a cubemap.

Also adds test cases to test both scenarios.

Pull Request: https://projects.blender.org/blender/blender/pulls/108794
2023-06-09 16:09:54 +02:00

48 lines
1.1 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#pragma once
#include "vk_common.hh"
#include "BLI_string_ref.hh"
#include "BLI_utility_mixins.hh"
namespace blender::gpu {
class VKTexture;
class VKImageView : NonCopyable {
VkImageView vk_image_view_ = VK_NULL_HANDLE;
public:
VKImageView(VKTexture &texture, int layer, int mip_level, StringRefNull name);
/**
* Wrap the given vk_image_view handle. Note that the vk_image_view handle ownership is
* transferred to VKImageView.
*/
VKImageView(VkImageView vk_image_view);
VKImageView(VKImageView &&other);
~VKImageView();
VkImageView vk_handle() const
{
BLI_assert(vk_image_view_ != VK_NULL_HANDLE);
return vk_image_view_;
}
private:
static VkImageView create_vk_image_view(VKTexture &texture,
int layer,
int mip_level,
StringRefNull name);
};
} // namespace blender::gpu