mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[dxvk] Register image views with the parent image
Needed for image renaming.
This commit is contained in:
parent
8770a14743
commit
2c457e496a
@ -125,11 +125,30 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxvkImage::addView(DxvkImageView* view) {
|
||||||
|
m_viewList.push_back(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxvkImage::removeView(DxvkImageView* view) {
|
||||||
|
for (size_t i = 0; i < m_viewList.size(); i++) {
|
||||||
|
if (m_viewList[i] == view) {
|
||||||
|
m_viewList[i] = m_viewList.back();
|
||||||
|
m_viewList.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkImageView::DxvkImageView(
|
DxvkImageView::DxvkImageView(
|
||||||
const Rc<vk::DeviceFn>& vkd,
|
const Rc<vk::DeviceFn>& vkd,
|
||||||
const Rc<DxvkImage>& image,
|
const Rc<DxvkImage>& image,
|
||||||
const DxvkImageViewCreateInfo& info)
|
const DxvkImageViewCreateInfo& info)
|
||||||
: m_vkd(vkd), m_image(image), m_info(info) {
|
: m_vkd(vkd), m_image(image), m_info(info) {
|
||||||
|
std::lock_guard lock(m_image->m_viewLock);
|
||||||
|
m_image->addView(this);
|
||||||
|
|
||||||
createViews();
|
createViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +156,9 @@ namespace dxvk {
|
|||||||
DxvkImageView::~DxvkImageView() {
|
DxvkImageView::~DxvkImageView() {
|
||||||
for (uint32_t i = 0; i < ViewCount; i++)
|
for (uint32_t i = 0; i < ViewCount; i++)
|
||||||
m_vkd->vkDestroyImageView(m_vkd->device(), m_views[i], nullptr);
|
m_vkd->vkDestroyImageView(m_vkd->device(), m_views[i], nullptr);
|
||||||
|
|
||||||
|
std::lock_guard lock(m_image->m_viewLock);
|
||||||
|
m_image->removeView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
class DxvkImageView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Image create info
|
* \brief Image create info
|
||||||
*
|
*
|
||||||
@ -104,7 +106,7 @@ namespace dxvk {
|
|||||||
* memory type and if created with the linear tiling option.
|
* memory type and if created with the linear tiling option.
|
||||||
*/
|
*/
|
||||||
class DxvkImage : public DxvkResource {
|
class DxvkImage : public DxvkResource {
|
||||||
|
friend class DxvkImageView;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxvkImage(
|
DxvkImage(
|
||||||
@ -283,6 +285,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
small_vector<VkFormat, 4> m_viewFormats;
|
small_vector<VkFormat, 4> m_viewFormats;
|
||||||
|
|
||||||
|
sync::Spinlock m_viewLock;
|
||||||
|
small_vector<DxvkImageView*, 4> m_viewList;
|
||||||
|
|
||||||
|
void addView(DxvkImageView* view);
|
||||||
|
void removeView(DxvkImageView* view);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -290,6 +298,7 @@ namespace dxvk {
|
|||||||
* \brief DXVK image view
|
* \brief DXVK image view
|
||||||
*/
|
*/
|
||||||
class DxvkImageView : public DxvkResource {
|
class DxvkImageView : public DxvkResource {
|
||||||
|
friend class DxvkImage;
|
||||||
constexpr static uint32_t ViewCount = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY + 1;
|
constexpr static uint32_t ViewCount = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY + 1;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user