mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Implement experimental Vulkan backend
This commit is contained in:
67
Source/Core/VideoBackends/Vulkan/Texture2D.h
Normal file
67
Source/Core/VideoBackends/Vulkan/Texture2D.h
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright 2016 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "VideoBackends/Vulkan/Constants.h"
|
||||
|
||||
namespace Vulkan
|
||||
{
|
||||
class CommandBufferManager;
|
||||
class ObjectCache;
|
||||
|
||||
class Texture2D
|
||||
{
|
||||
public:
|
||||
Texture2D(u32 width, u32 height, u32 levels, u32 layers, VkFormat format,
|
||||
VkSampleCountFlagBits samples, VkImageViewType view_type, VkImage image,
|
||||
VkDeviceMemory device_memory, VkImageView view);
|
||||
~Texture2D();
|
||||
|
||||
static std::unique_ptr<Texture2D> Create(u32 width, u32 height, u32 levels, u32 layers,
|
||||
VkFormat format, VkSampleCountFlagBits samples,
|
||||
VkImageViewType view_type, VkImageTiling tiling,
|
||||
VkImageUsageFlags usage);
|
||||
|
||||
static std::unique_ptr<Texture2D> CreateFromExistingImage(u32 width, u32 height, u32 levels,
|
||||
u32 layers, VkFormat format,
|
||||
VkSampleCountFlagBits samples,
|
||||
VkImageViewType view_type,
|
||||
VkImage existing_image);
|
||||
|
||||
u32 GetWidth() const { return m_width; }
|
||||
u32 GetHeight() const { return m_height; }
|
||||
u32 GetLevels() const { return m_levels; }
|
||||
u32 GetLayers() const { return m_layers; }
|
||||
VkFormat GetFormat() const { return m_format; }
|
||||
VkSampleCountFlagBits GetSamples() const { return m_samples; }
|
||||
VkImageLayout GetLayout() const { return m_layout; }
|
||||
VkImageViewType GetViewType() const { return m_view_type; }
|
||||
VkImage GetImage() const { return m_image; }
|
||||
VkDeviceMemory GetDeviceMemory() const { return m_device_memory; }
|
||||
VkImageView GetView() const { return m_view; }
|
||||
// Used when the render pass is changing the image layout, or to force it to
|
||||
// VK_IMAGE_LAYOUT_UNDEFINED, if the existing contents of the image is
|
||||
// irrelevant and will not be loaded.
|
||||
void OverrideImageLayout(VkImageLayout new_layout);
|
||||
|
||||
void TransitionToLayout(VkCommandBuffer command_buffer, VkImageLayout new_layout);
|
||||
|
||||
private:
|
||||
u32 m_width;
|
||||
u32 m_height;
|
||||
u32 m_levels;
|
||||
u32 m_layers;
|
||||
VkFormat m_format;
|
||||
VkSampleCountFlagBits m_samples;
|
||||
VkImageViewType m_view_type;
|
||||
VkImageLayout m_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
VkImage m_image;
|
||||
VkDeviceMemory m_device_memory;
|
||||
VkImageView m_view;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user