2017-11-27 15:52:24 +01:00
|
|
|
#pragma once
|
|
|
|
|
2024-11-02 00:53:19 +01:00
|
|
|
#include "../util/util_small_vector.h"
|
|
|
|
|
2022-02-09 02:54:32 +01:00
|
|
|
#include "../dxvk/dxvk_cs.h"
|
2018-08-11 18:45:41 +02:00
|
|
|
#include "../dxvk/dxvk_device.h"
|
|
|
|
|
|
|
|
#include "../d3d10/d3d10_texture.h"
|
2017-11-27 15:52:24 +01:00
|
|
|
|
2017-11-29 15:16:07 +01:00
|
|
|
#include "d3d11_device_child.h"
|
|
|
|
#include "d3d11_interfaces.h"
|
2023-03-16 16:02:04 +01:00
|
|
|
#include "d3d11_on_12.h"
|
2019-04-27 19:33:47 +02:00
|
|
|
#include "d3d11_resource.h"
|
2017-11-27 15:52:24 +01:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
class D3D11Device;
|
2019-06-15 10:28:49 +02:00
|
|
|
class D3D11GDISurface;
|
2017-11-27 15:52:24 +01:00
|
|
|
|
2018-03-14 14:40:09 +01:00
|
|
|
/**
|
|
|
|
* \brief Image memory mapping mode
|
|
|
|
*
|
|
|
|
* Determines how exactly \c Map will
|
|
|
|
* behave when mapping an image.
|
|
|
|
*/
|
|
|
|
enum D3D11_COMMON_TEXTURE_MAP_MODE {
|
2021-06-21 22:53:13 +02:00
|
|
|
D3D11_COMMON_TEXTURE_MAP_MODE_NONE, ///< Not mapped
|
|
|
|
D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER, ///< Mapped through buffer
|
|
|
|
D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT, ///< Directly mapped to host mem
|
|
|
|
D3D11_COMMON_TEXTURE_MAP_MODE_STAGING, ///< Buffer only, no image
|
2018-03-14 14:40:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
/**
|
|
|
|
* \brief Common texture description
|
|
|
|
*
|
|
|
|
* Contains all members that can be
|
|
|
|
* defined for 1D, 2D and 3D textures.
|
|
|
|
*/
|
|
|
|
struct D3D11_COMMON_TEXTURE_DESC {
|
|
|
|
UINT Width;
|
|
|
|
UINT Height;
|
|
|
|
UINT Depth;
|
|
|
|
UINT MipLevels;
|
|
|
|
UINT ArraySize;
|
|
|
|
DXGI_FORMAT Format;
|
|
|
|
DXGI_SAMPLE_DESC SampleDesc;
|
|
|
|
D3D11_USAGE Usage;
|
|
|
|
UINT BindFlags;
|
|
|
|
UINT CPUAccessFlags;
|
|
|
|
UINT MiscFlags;
|
2019-09-16 13:50:39 +02:00
|
|
|
D3D11_TEXTURE_LAYOUT TextureLayout;
|
2018-03-13 23:51:30 +01:00
|
|
|
};
|
2021-05-19 17:01:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Packed subresource layout
|
|
|
|
*/
|
|
|
|
struct D3D11_COMMON_TEXTURE_SUBRESOURCE_LAYOUT {
|
|
|
|
UINT64 Offset;
|
|
|
|
UINT64 Size;
|
|
|
|
UINT RowPitch;
|
|
|
|
UINT DepthPitch;
|
|
|
|
};
|
2018-03-13 23:51:30 +01:00
|
|
|
|
|
|
|
|
2022-09-05 04:57:31 +02:00
|
|
|
/**
|
|
|
|
* \brief Region
|
|
|
|
*/
|
|
|
|
struct D3D11_COMMON_TEXTURE_REGION {
|
|
|
|
VkOffset3D Offset;
|
|
|
|
VkExtent3D Extent;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
/**
|
|
|
|
* \brief D3D11 common texture object
|
|
|
|
*
|
|
|
|
* This class implements common texture methods and
|
|
|
|
* aims to work around the issue that there are three
|
|
|
|
* different interfaces for basically the same thing.
|
|
|
|
*/
|
|
|
|
class D3D11CommonTexture {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11CommonTexture(
|
2022-02-09 03:45:13 +01:00
|
|
|
ID3D11Resource* pInterface,
|
2018-03-13 23:51:30 +01:00
|
|
|
D3D11Device* pDevice,
|
|
|
|
const D3D11_COMMON_TEXTURE_DESC* pDesc,
|
2023-03-16 16:02:04 +01:00
|
|
|
const D3D11_ON_12_RESOURCE_INFO* p11on12Info,
|
2020-12-29 15:39:04 -06:00
|
|
|
D3D11_RESOURCE_DIMENSION Dimension,
|
2021-02-12 01:52:20 +01:00
|
|
|
DXGI_USAGE DxgiUsage,
|
2022-02-23 16:18:07 -05:00
|
|
|
VkImage vkImage,
|
|
|
|
HANDLE hSharedHandle);
|
2018-03-13 23:51:30 +01:00
|
|
|
|
|
|
|
~D3D11CommonTexture();
|
|
|
|
|
2022-02-09 03:45:13 +01:00
|
|
|
/**
|
|
|
|
* \brief Retrieves resource interface
|
|
|
|
* \returns Resource interface
|
|
|
|
*/
|
|
|
|
ID3D11Resource* GetInterface() const {
|
|
|
|
return m_interface;
|
|
|
|
}
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
/**
|
|
|
|
* \brief Texture properties
|
|
|
|
*
|
|
|
|
* The returned data can be used to fill in
|
|
|
|
* \c D3D11_TEXTURE2D_DESC and similar structs.
|
|
|
|
* \returns Pointer to texture description
|
|
|
|
*/
|
|
|
|
const D3D11_COMMON_TEXTURE_DESC* Desc() const {
|
|
|
|
return &m_desc;
|
|
|
|
}
|
2019-05-20 19:26:15 +02:00
|
|
|
|
2022-02-09 04:35:59 +01:00
|
|
|
/**
|
|
|
|
* \brief Retrieves D3D11 texture type
|
|
|
|
* \returns D3D11 resource dimension
|
|
|
|
*/
|
|
|
|
D3D11_RESOURCE_DIMENSION GetDimension() const {
|
|
|
|
return m_dimension;
|
|
|
|
}
|
|
|
|
|
2021-06-22 08:04:21 +02:00
|
|
|
/**
|
|
|
|
* \brief Retrieves Vulkan image type
|
|
|
|
*
|
|
|
|
* Returns the image type based on the D3D11 resource
|
|
|
|
* dimension. Also works if there is no actual image.
|
|
|
|
* \returns Vulkan image type
|
|
|
|
*/
|
|
|
|
VkImageType GetVkImageType() const {
|
|
|
|
return GetImageTypeFromResourceDim(m_dimension);
|
|
|
|
}
|
|
|
|
|
2021-06-21 22:53:13 +02:00
|
|
|
/**
|
|
|
|
* \brief Computes extent of a given mip level
|
|
|
|
*
|
|
|
|
* This also works for staging resources that have no image.
|
|
|
|
* \param [in] Level Mip level to compute the size of
|
|
|
|
*/
|
|
|
|
VkExtent3D MipLevelExtent(uint32_t Level) const {
|
|
|
|
return util::computeMipLevelExtent(
|
|
|
|
VkExtent3D { m_desc.Width, m_desc.Height, m_desc.Depth }, Level);
|
|
|
|
}
|
|
|
|
|
2021-02-12 01:52:20 +01:00
|
|
|
/**
|
|
|
|
* \brief Special DXGI usage flags
|
|
|
|
*
|
|
|
|
* Flags that are set in addition to the bind
|
|
|
|
* flags. Zero for application-created textures.
|
|
|
|
* \returns DXGI usage flags
|
|
|
|
*/
|
|
|
|
DXGI_USAGE GetDxgiUsage() const {
|
|
|
|
return m_dxgiUsage;
|
|
|
|
}
|
|
|
|
|
2019-05-20 19:26:15 +02:00
|
|
|
/**
|
|
|
|
* \brief Counts number of subresources
|
|
|
|
* \returns Number of subresources
|
|
|
|
*/
|
|
|
|
UINT CountSubresources() const {
|
|
|
|
return m_desc.ArraySize * m_desc.MipLevels;
|
|
|
|
}
|
2018-03-13 23:51:30 +01:00
|
|
|
|
2018-03-14 14:40:09 +01:00
|
|
|
/**
|
|
|
|
* \brief Map mode
|
|
|
|
* \returns Map mode
|
|
|
|
*/
|
|
|
|
D3D11_COMMON_TEXTURE_MAP_MODE GetMapMode() const {
|
|
|
|
return m_mapMode;
|
|
|
|
}
|
2019-05-20 15:56:31 +02:00
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
/**
|
2019-05-20 15:56:31 +02:00
|
|
|
* \brief Map type of a given subresource
|
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \returns Current map mode of that subresource
|
2018-03-13 23:51:30 +01:00
|
|
|
*/
|
2019-05-20 15:56:31 +02:00
|
|
|
D3D11_MAP GetMapType(UINT Subresource) const {
|
2022-02-09 02:54:32 +01:00
|
|
|
return Subresource < m_mapInfo.size()
|
|
|
|
? D3D11_MAP(m_mapInfo[Subresource].mapType)
|
2019-05-20 15:56:31 +02:00
|
|
|
: D3D11_MAP(~0u);
|
2018-03-13 23:51:30 +01:00
|
|
|
}
|
2018-11-08 18:15:24 +01:00
|
|
|
|
|
|
|
/**
|
2019-05-20 15:56:31 +02:00
|
|
|
* \brief Sets map type for a given subresource
|
|
|
|
*
|
|
|
|
* \param [in] Subresource The subresource
|
|
|
|
* \param [in] MapType The map type
|
2018-11-08 18:15:24 +01:00
|
|
|
*/
|
2019-05-20 15:56:31 +02:00
|
|
|
void SetMapType(UINT Subresource, D3D11_MAP MapType) {
|
2022-02-09 02:54:32 +01:00
|
|
|
if (Subresource < m_mapInfo.size())
|
|
|
|
m_mapInfo[Subresource].mapType = MapType;
|
2018-11-08 18:15:24 +01:00
|
|
|
}
|
2018-03-13 23:51:30 +01:00
|
|
|
|
|
|
|
/**
|
2019-05-20 15:56:31 +02:00
|
|
|
* \brief The DXVK image
|
|
|
|
* \returns The DXVK image
|
2018-03-13 23:51:30 +01:00
|
|
|
*/
|
2019-05-20 15:56:31 +02:00
|
|
|
Rc<DxvkImage> GetImage() const {
|
|
|
|
return m_image;
|
2018-03-13 23:51:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-05-20 15:56:31 +02:00
|
|
|
* \brief Mapped subresource buffer
|
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \returns Mapped subresource buffer
|
2018-03-13 23:51:30 +01:00
|
|
|
*/
|
2019-05-20 15:56:31 +02:00
|
|
|
Rc<DxvkBuffer> GetMappedBuffer(UINT Subresource) const {
|
|
|
|
return Subresource < m_buffers.size()
|
2021-06-22 00:17:02 +02:00
|
|
|
? m_buffers[Subresource].buffer
|
2019-05-20 15:56:31 +02:00
|
|
|
: Rc<DxvkBuffer>();
|
2018-03-13 23:51:30 +01:00
|
|
|
}
|
2021-06-22 00:17:02 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Discards mapped buffer slice for a given subresource
|
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource to discard
|
|
|
|
* \returns Newly allocated mapped buffer slice
|
|
|
|
*/
|
2024-09-23 13:29:38 +02:00
|
|
|
Rc<DxvkResourceAllocation> DiscardSlice(UINT Subresource) {
|
2021-06-22 00:17:02 +02:00
|
|
|
if (Subresource < m_buffers.size()) {
|
2024-10-16 13:16:00 +02:00
|
|
|
Rc<DxvkResourceAllocation> slice = m_buffers[Subresource].buffer->allocateStorage();
|
2021-06-22 00:17:02 +02:00
|
|
|
m_buffers[Subresource].slice = slice;
|
|
|
|
return slice;
|
|
|
|
} else {
|
2024-09-23 13:29:38 +02:00
|
|
|
return nullptr;
|
2021-06-22 00:17:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Retrieves mapped buffer slice for a given subresource
|
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource index to query
|
|
|
|
* \returns Currently mapped buffer slice
|
|
|
|
*/
|
2024-09-23 13:29:38 +02:00
|
|
|
Rc<DxvkResourceAllocation> GetMappedSlice(UINT Subresource) const {
|
2021-06-22 00:17:02 +02:00
|
|
|
return Subresource < m_buffers.size()
|
|
|
|
? m_buffers[Subresource].slice
|
2024-09-23 13:29:38 +02:00
|
|
|
: nullptr;
|
2021-06-22 00:17:02 +02:00
|
|
|
}
|
2021-06-22 04:09:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Returns underlying packed Vulkan format
|
|
|
|
*
|
|
|
|
* This works even for staging resources that have no image.
|
|
|
|
* Note that for depth-stencil resources, the returned format
|
|
|
|
* may be different from the image format on some systems.
|
|
|
|
* \returns Packed Vulkan format
|
|
|
|
*/
|
|
|
|
VkFormat GetPackedFormat() const {
|
|
|
|
return m_packedFormat;
|
|
|
|
}
|
2019-05-20 15:56:31 +02:00
|
|
|
|
2022-02-09 02:54:32 +01:00
|
|
|
/**
|
|
|
|
* \brief Checks whether the resource is eligible for tracking
|
|
|
|
*
|
|
|
|
* Mapped resources with no bind flags can be tracked so that
|
|
|
|
* mapping them will not necessarily cause a CS thread sync.
|
|
|
|
* \returns \c true if tracking is supported for this resource
|
|
|
|
*/
|
|
|
|
bool HasSequenceNumber() const {
|
|
|
|
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_NONE)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// For buffer-mapped images we only need to track copies to
|
|
|
|
// and from that buffer, so we can safely ignore bind flags
|
|
|
|
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER)
|
2022-09-05 01:56:54 +02:00
|
|
|
return m_desc.Usage != D3D11_USAGE_DEFAULT;
|
2022-02-09 02:54:32 +01:00
|
|
|
|
|
|
|
// Otherwise we can only do accurate tracking if the
|
|
|
|
// image cannot be used in the rendering pipeline.
|
|
|
|
return m_desc.BindFlags == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Tracks sequence number for a given subresource
|
|
|
|
*
|
|
|
|
* Stores which CS chunk the resource was last used on.
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \param [in] Seq Sequence number
|
|
|
|
*/
|
|
|
|
void TrackSequenceNumber(UINT Subresource, uint64_t Seq) {
|
|
|
|
if (Subresource < m_mapInfo.size())
|
|
|
|
m_mapInfo[Subresource].seq = Seq;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Queries sequence number for a given subresource
|
|
|
|
*
|
|
|
|
* Returns which CS chunk the resource was last used on.
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \returns Sequence number for the given subresource
|
|
|
|
*/
|
|
|
|
uint64_t GetSequenceNumber(UINT Subresource) {
|
|
|
|
if (HasSequenceNumber()) {
|
|
|
|
return Subresource < m_buffers.size()
|
|
|
|
? m_mapInfo[Subresource].seq
|
|
|
|
: 0ull;
|
|
|
|
} else {
|
|
|
|
return DxvkCsThread::SynchronizeAll;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-31 21:03:07 +01:00
|
|
|
/**
|
|
|
|
* \brief Allocates new backing storage
|
|
|
|
* \returns New backing storage for the image
|
|
|
|
*/
|
|
|
|
Rc<DxvkResourceAllocation> AllocStorage() {
|
|
|
|
return m_image->allocateStorage();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Discards backing storage
|
|
|
|
*
|
|
|
|
* Also updates the mapped pointer if the image is mapped.
|
|
|
|
* \returns New backing storage for the image
|
|
|
|
*/
|
|
|
|
Rc<DxvkResourceAllocation> DiscardStorage() {
|
|
|
|
auto storage = m_image->allocateStorage();
|
|
|
|
m_mapPtr = storage->mapPtr();
|
|
|
|
return storage;
|
|
|
|
}
|
|
|
|
|
2024-10-29 22:00:20 +01:00
|
|
|
/**
|
|
|
|
* \brief Queries map pointer of the raw image
|
|
|
|
*
|
|
|
|
* If the image is mapped directly, the returned pointer will
|
|
|
|
* point directly to the image, otherwise it will point to a
|
|
|
|
* buffer that contains image data.
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \param [in] Offset Offset derived from the subresource layout
|
|
|
|
*/
|
|
|
|
void* GetMapPtr(uint32_t Subresource, size_t Offset) const {
|
|
|
|
switch (m_mapMode) {
|
|
|
|
case D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT:
|
|
|
|
return reinterpret_cast<char*>(m_mapPtr) + Offset;
|
|
|
|
|
|
|
|
case D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER:
|
|
|
|
case D3D11_COMMON_TEXTURE_MAP_MODE_STAGING:
|
|
|
|
return reinterpret_cast<char*>(m_buffers[Subresource].slice->mapPtr()) + Offset;
|
|
|
|
|
|
|
|
case D3D11_COMMON_TEXTURE_MAP_MODE_NONE:
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-09-05 04:57:31 +02:00
|
|
|
/**
|
|
|
|
* \brief Adds a dirty region
|
|
|
|
*
|
|
|
|
* This region will be updated on Unmap.
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \param [in] Offset Region offset
|
|
|
|
* \param [in] Extent Region extent
|
|
|
|
*/
|
|
|
|
void AddDirtyRegion(UINT Subresource, VkOffset3D Offset, VkExtent3D Extent) {
|
|
|
|
D3D11_COMMON_TEXTURE_REGION region;
|
|
|
|
region.Offset = Offset;
|
|
|
|
region.Extent = Extent;
|
|
|
|
|
|
|
|
if (Subresource < m_buffers.size())
|
|
|
|
m_buffers[Subresource].dirtyRegions.push_back(region);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Clears dirty regions
|
|
|
|
*
|
|
|
|
* Removes all dirty regions from the given subresource.
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
*/
|
|
|
|
void ClearDirtyRegions(UINT Subresource) {
|
|
|
|
if (Subresource < m_buffers.size())
|
|
|
|
m_buffers[Subresource].dirtyRegions.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Counts dirty regions
|
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \returns Dirty region count
|
|
|
|
*/
|
|
|
|
UINT GetDirtyRegionCount(UINT Subresource) {
|
|
|
|
return (Subresource < m_buffers.size())
|
|
|
|
? UINT(m_buffers[Subresource].dirtyRegions.size())
|
|
|
|
: UINT(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-09-05 05:35:16 +02:00
|
|
|
* \brief Queries a dirty regions
|
2022-09-05 04:57:31 +02:00
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \param [in] Region Region index
|
|
|
|
* \returns Dirty region
|
|
|
|
*/
|
2022-09-05 05:35:16 +02:00
|
|
|
D3D11_COMMON_TEXTURE_REGION GetDirtyRegion(UINT Subresource, UINT Region) {
|
2022-09-05 04:57:31 +02:00
|
|
|
return m_buffers[Subresource].dirtyRegions[Region];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Checks whether or not to track dirty regions
|
|
|
|
*
|
|
|
|
* If this returns true, then any functions that update the
|
|
|
|
* mapped staging buffer must also track dirty regions while
|
|
|
|
* the image is mapped. Otherwise, the entire image is dirty.
|
|
|
|
* \returns \c true if dirty regions must be tracked
|
|
|
|
*/
|
|
|
|
bool NeedsDirtyRegionTracking() const {
|
|
|
|
// Only set this for images where Map can't return a pointer
|
|
|
|
return m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER
|
|
|
|
&& m_desc.Usage == D3D11_USAGE_DEFAULT
|
|
|
|
&& m_desc.TextureLayout == D3D11_TEXTURE_LAYOUT_UNDEFINED;
|
|
|
|
}
|
|
|
|
|
2021-06-22 06:45:37 +02:00
|
|
|
/**
|
|
|
|
* \brief Computes pixel offset into mapped buffer
|
|
|
|
*
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \param [in] Subresource Plane index
|
|
|
|
* \param [in] Offset Pixel coordinate to compute offset for
|
|
|
|
* \returns Offset into mapped subresource buffer, in pixels
|
|
|
|
*/
|
|
|
|
VkDeviceSize ComputeMappedOffset(UINT Subresource, UINT Plane, VkOffset3D Offset) const;
|
2018-03-13 23:51:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Computes subresource from the subresource index
|
|
|
|
*
|
|
|
|
* Used by some functions that operate on only
|
|
|
|
* one subresource, such as \c UpdateSubresource.
|
|
|
|
* \param [in] Aspect The image aspect
|
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \returns The Vulkan image subresource
|
|
|
|
*/
|
|
|
|
VkImageSubresource GetSubresourceFromIndex(
|
|
|
|
VkImageAspectFlags Aspect,
|
2024-10-31 20:24:09 +01:00
|
|
|
UINT Subresource) const {
|
|
|
|
VkImageSubresource result;
|
|
|
|
result.aspectMask = Aspect;
|
|
|
|
result.mipLevel = Subresource % m_desc.MipLevels;
|
|
|
|
result.arrayLayer = Subresource / m_desc.MipLevels;
|
|
|
|
return result;
|
|
|
|
}
|
2021-05-19 17:01:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Computes subresource layout for the given subresource
|
|
|
|
*
|
2021-06-22 06:45:37 +02:00
|
|
|
* \param [in] AspectMask The image aspect
|
2021-05-19 17:01:07 +02:00
|
|
|
* \param [in] Subresource Subresource index
|
|
|
|
* \returns Memory layout of the mapped subresource
|
|
|
|
*/
|
|
|
|
D3D11_COMMON_TEXTURE_SUBRESOURCE_LAYOUT GetSubresourceLayout(
|
2021-06-22 06:45:37 +02:00
|
|
|
VkImageAspectFlags AspectMask,
|
2021-05-19 17:01:07 +02:00
|
|
|
UINT Subresource) const;
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
/**
|
|
|
|
* \brief Format mode
|
|
|
|
*
|
|
|
|
* Determines whether the image is going to
|
|
|
|
* be used as a color image or a depth image.
|
|
|
|
* \returns Format mode
|
|
|
|
*/
|
2018-04-12 17:49:14 +02:00
|
|
|
DXGI_VK_FORMAT_MODE GetFormatMode() const;
|
2021-05-20 16:50:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Computes plane count
|
|
|
|
*
|
|
|
|
* For non-planar formats, the plane count will be 1.
|
|
|
|
* \returns Image plane count
|
|
|
|
*/
|
|
|
|
uint32_t GetPlaneCount() const;
|
|
|
|
|
2018-05-05 15:13:35 +02:00
|
|
|
/**
|
2018-08-09 21:58:58 +02:00
|
|
|
* \brief Checks whether a view can be created for this textue
|
2018-05-05 15:13:35 +02:00
|
|
|
*
|
|
|
|
* View formats are only compatible if they are either identical
|
|
|
|
* or from the same family of typeless formats, where the resource
|
2018-08-09 21:58:58 +02:00
|
|
|
* format must be typeless and the view format must be typed. This
|
|
|
|
* will also check whether the required bind flags are supported.
|
|
|
|
* \param [in] BindFlags Bind flags for the view
|
2018-05-05 15:13:35 +02:00
|
|
|
* \param [in] Format The desired view format
|
2021-05-20 16:50:15 +02:00
|
|
|
* \param [in] Plane Plane slice for planar formats
|
2018-05-05 15:13:35 +02:00
|
|
|
* \returns \c true if the format is compatible
|
|
|
|
*/
|
2018-08-09 21:58:58 +02:00
|
|
|
bool CheckViewCompatibility(
|
|
|
|
UINT BindFlags,
|
2021-05-20 16:50:15 +02:00
|
|
|
DXGI_FORMAT Format,
|
|
|
|
UINT Plane) const;
|
2018-05-05 15:13:35 +02:00
|
|
|
|
2023-03-16 16:02:04 +01:00
|
|
|
/**
|
|
|
|
* \brief Retrieves D3D11on12 resource info
|
|
|
|
* \returns 11on12 resource info
|
|
|
|
*/
|
|
|
|
D3D11_ON_12_RESOURCE_INFO Get11on12Info() const {
|
|
|
|
return m_11on12;
|
|
|
|
}
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
/**
|
|
|
|
* \brief Normalizes and validates texture description
|
|
|
|
*
|
|
|
|
* Fills in undefined values and validates the texture
|
|
|
|
* parameters. Any error returned by this method should
|
|
|
|
* be forwarded to the application.
|
|
|
|
* \param [in,out] pDesc Texture description
|
|
|
|
* \returns \c S_OK if the parameters are valid
|
|
|
|
*/
|
|
|
|
static HRESULT NormalizeTextureProperties(
|
2022-09-05 07:44:17 +02:00
|
|
|
D3D11_COMMON_TEXTURE_DESC* pDesc);
|
2018-03-13 23:51:30 +01:00
|
|
|
|
2023-03-16 16:02:04 +01:00
|
|
|
/**
|
|
|
|
* \brief Initializes D3D11 texture description from D3D12
|
|
|
|
*
|
|
|
|
* \param [in] pResource D3D12 resource
|
|
|
|
* \param [in] pResourceFlags D3D11 flag overrides
|
|
|
|
* \param [out] pTextureDesc D3D11 buffer description
|
|
|
|
* \returns \c S_OK if the parameters are valid
|
|
|
|
*/
|
|
|
|
static HRESULT GetDescFromD3D12(
|
|
|
|
ID3D12Resource* pResource,
|
|
|
|
const D3D11_RESOURCE_FLAGS* pResourceFlags,
|
|
|
|
D3D11_COMMON_TEXTURE_DESC* pTextureDesc);
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
private:
|
|
|
|
|
2021-06-22 00:17:02 +02:00
|
|
|
struct MappedBuffer {
|
2024-09-23 13:29:38 +02:00
|
|
|
Rc<DxvkBuffer> buffer;
|
|
|
|
Rc<DxvkResourceAllocation> slice;
|
2022-09-05 04:57:31 +02:00
|
|
|
|
|
|
|
std::vector<D3D11_COMMON_TEXTURE_REGION> dirtyRegions;
|
2021-06-22 00:17:02 +02:00
|
|
|
};
|
|
|
|
|
2022-02-09 02:54:32 +01:00
|
|
|
struct MappedInfo {
|
2024-10-31 20:24:09 +01:00
|
|
|
D3D11_COMMON_TEXTURE_SUBRESOURCE_LAYOUT layout = { };
|
|
|
|
D3D11_MAP mapType = D3D11_MAP(~0u);
|
|
|
|
uint64_t seq = 0u;
|
2022-02-09 02:54:32 +01:00
|
|
|
};
|
|
|
|
|
2022-02-09 03:45:13 +01:00
|
|
|
ID3D11Resource* m_interface;
|
|
|
|
D3D11Device* m_device;
|
2021-06-21 22:53:13 +02:00
|
|
|
D3D11_RESOURCE_DIMENSION m_dimension;
|
2018-03-14 14:40:09 +01:00
|
|
|
D3D11_COMMON_TEXTURE_DESC m_desc;
|
2023-03-16 16:02:04 +01:00
|
|
|
D3D11_ON_12_RESOURCE_INFO m_11on12;
|
2018-03-14 14:40:09 +01:00
|
|
|
D3D11_COMMON_TEXTURE_MAP_MODE m_mapMode;
|
2021-02-12 01:52:20 +01:00
|
|
|
DXGI_USAGE m_dxgiUsage;
|
2021-06-22 04:09:07 +02:00
|
|
|
VkFormat m_packedFormat;
|
2018-03-13 23:51:30 +01:00
|
|
|
|
2019-05-20 15:56:31 +02:00
|
|
|
Rc<DxvkImage> m_image;
|
2024-11-02 00:53:19 +01:00
|
|
|
small_vector<MappedBuffer, 6> m_buffers;
|
|
|
|
small_vector<MappedInfo, 6> m_mapInfo;
|
2024-10-29 22:00:20 +01:00
|
|
|
|
|
|
|
void* m_mapPtr = nullptr;
|
|
|
|
|
2024-11-02 00:53:19 +01:00
|
|
|
void CreateMappedBuffer(
|
|
|
|
UINT Subresource);
|
2018-03-14 01:16:31 +01:00
|
|
|
|
2018-03-14 16:03:48 +01:00
|
|
|
BOOL CheckImageSupport(
|
|
|
|
const DxvkImageCreateInfo* pImageInfo,
|
|
|
|
VkImageTiling Tiling) const;
|
|
|
|
|
2018-08-09 17:13:35 +02:00
|
|
|
BOOL CheckFormatFeatureSupport(
|
|
|
|
VkFormat Format,
|
2022-08-17 14:09:50 +02:00
|
|
|
VkFormatFeatureFlags2 Features) const;
|
2018-08-09 17:13:35 +02:00
|
|
|
|
2024-10-31 22:05:12 +01:00
|
|
|
std::pair<D3D11_COMMON_TEXTURE_MAP_MODE, VkMemoryPropertyFlags> DetermineMapMode(
|
2018-03-14 16:03:48 +01:00
|
|
|
const DxvkImageCreateInfo* pImageInfo) const;
|
2022-02-23 16:18:07 -05:00
|
|
|
|
2024-10-31 20:24:09 +01:00
|
|
|
D3D11_COMMON_TEXTURE_SUBRESOURCE_LAYOUT DetermineSubresourceLayout(
|
|
|
|
const DxvkImageCreateInfo* pImageInfo,
|
|
|
|
const VkImageSubresource& subresource) const;
|
|
|
|
|
2022-02-23 16:18:07 -05:00
|
|
|
void ExportImageInfo();
|
2024-10-31 20:24:09 +01:00
|
|
|
|
2022-03-12 14:54:06 +01:00
|
|
|
static BOOL IsR32UavCompatibleFormat(
|
|
|
|
DXGI_FORMAT Format);
|
|
|
|
|
2018-03-13 23:51:30 +01:00
|
|
|
static VkImageType GetImageTypeFromResourceDim(
|
2018-03-14 01:16:31 +01:00
|
|
|
D3D11_RESOURCE_DIMENSION Dimension);
|
|
|
|
|
|
|
|
static VkImageLayout OptimizeLayout(
|
|
|
|
VkImageUsageFlags Usage);
|
2018-03-13 23:51:30 +01:00
|
|
|
};
|
2019-04-27 15:35:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief IDXGISurface implementation for D3D11 textures
|
|
|
|
*
|
|
|
|
* Provides an implementation for 2D textures that
|
|
|
|
* have only one array layer and one mip level.
|
|
|
|
*/
|
|
|
|
class D3D11DXGISurface : public IDXGISurface2 {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11DXGISurface(
|
2019-04-27 16:25:55 +02:00
|
|
|
ID3D11Resource* pResource,
|
2019-04-27 15:35:20 +02:00
|
|
|
D3D11CommonTexture* pTexture);
|
|
|
|
|
|
|
|
~D3D11DXGISurface();
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE AddRef();
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE Release();
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetPrivateData(
|
|
|
|
REFGUID Name,
|
|
|
|
UINT* pDataSize,
|
|
|
|
void* pData);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
|
|
|
REFGUID Name,
|
|
|
|
UINT DataSize,
|
|
|
|
const void* pData);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
|
|
|
|
REFGUID Name,
|
|
|
|
const IUnknown* pUnknown);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetParent(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppParent);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetDevice(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppDevice);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetDesc(
|
|
|
|
DXGI_SURFACE_DESC* pDesc);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Map(
|
|
|
|
DXGI_MAPPED_RECT* pLockedRect,
|
|
|
|
UINT MapFlags);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Unmap();
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetDC(
|
|
|
|
BOOL Discard,
|
|
|
|
HDC* phdc);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE ReleaseDC(
|
|
|
|
RECT* pDirtyRect);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetResource(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppParentResource,
|
|
|
|
UINT* pSubresourceIndex);
|
|
|
|
|
|
|
|
bool isSurfaceCompatible() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2019-04-27 16:25:55 +02:00
|
|
|
ID3D11Resource* m_resource;
|
2019-04-27 15:35:20 +02:00
|
|
|
D3D11CommonTexture* m_texture;
|
2019-06-15 10:28:49 +02:00
|
|
|
D3D11GDISurface* m_gdiSurface;
|
2019-04-27 15:35:20 +02:00
|
|
|
|
|
|
|
};
|
2018-03-13 23:51:30 +01:00
|
|
|
|
|
|
|
|
2018-04-20 10:38:39 +02:00
|
|
|
/**
|
|
|
|
* \brief Common texture interop class
|
|
|
|
*
|
|
|
|
* Provides access to the underlying Vulkan
|
|
|
|
* texture to external Vulkan libraries.
|
|
|
|
*/
|
|
|
|
class D3D11VkInteropSurface : public IDXGIVkInteropSurface {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11VkInteropSurface(
|
2019-04-27 16:25:55 +02:00
|
|
|
ID3D11Resource* pResource,
|
2018-04-20 10:38:39 +02:00
|
|
|
D3D11CommonTexture* pTexture);
|
|
|
|
|
|
|
|
~D3D11VkInteropSurface();
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE AddRef();
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE Release();
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject);
|
|
|
|
|
2018-05-01 23:30:39 +02:00
|
|
|
HRESULT STDMETHODCALLTYPE GetDevice(
|
|
|
|
IDXGIVkInteropDevice** ppDevice);
|
|
|
|
|
2018-04-20 10:38:39 +02:00
|
|
|
HRESULT STDMETHODCALLTYPE GetVulkanImageInfo(
|
|
|
|
VkImage* pHandle,
|
|
|
|
VkImageLayout* pLayout,
|
|
|
|
VkImageCreateInfo* pInfo);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2019-04-27 16:25:55 +02:00
|
|
|
ID3D11Resource* m_resource;
|
2018-04-20 10:38:39 +02:00
|
|
|
D3D11CommonTexture* m_texture;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-23 17:05:07 +01:00
|
|
|
///////////////////////////////////////////
|
|
|
|
// D 3 D 1 1 T E X T U R E 1 D
|
|
|
|
class D3D11Texture1D : public D3D11DeviceChild<ID3D11Texture1D> {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11Texture1D(
|
|
|
|
D3D11Device* pDevice,
|
2023-03-16 16:02:04 +01:00
|
|
|
const D3D11_COMMON_TEXTURE_DESC* pDesc,
|
|
|
|
const D3D11_ON_12_RESOURCE_INFO* p11on12Info);
|
2017-12-23 17:05:07 +01:00
|
|
|
|
|
|
|
~D3D11Texture1D();
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetType(
|
|
|
|
D3D11_RESOURCE_DIMENSION *pResourceDimension) final;
|
|
|
|
|
|
|
|
UINT STDMETHODCALLTYPE GetEvictionPriority() final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE SetEvictionPriority(UINT EvictionPriority) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDesc(
|
|
|
|
D3D11_TEXTURE1D_DESC *pDesc) final;
|
|
|
|
|
2018-03-14 00:45:07 +01:00
|
|
|
D3D11CommonTexture* GetCommonTexture() {
|
|
|
|
return &m_texture;
|
2017-12-23 17:05:07 +01:00
|
|
|
}
|
2018-08-11 18:45:41 +02:00
|
|
|
|
|
|
|
D3D10Texture1D* GetD3D10Iface() {
|
|
|
|
return &m_d3d10;
|
|
|
|
}
|
2017-12-23 17:05:07 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2018-04-20 11:12:54 +02:00
|
|
|
D3D11CommonTexture m_texture;
|
|
|
|
D3D11VkInteropSurface m_interop;
|
2019-06-13 04:37:35 +02:00
|
|
|
D3D11DXGISurface m_surface;
|
2019-04-27 19:33:47 +02:00
|
|
|
D3D11DXGIResource m_resource;
|
2018-08-11 18:45:41 +02:00
|
|
|
D3D10Texture1D m_d3d10;
|
2017-12-23 17:05:07 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////
|
|
|
|
// D 3 D 1 1 T E X T U R E 2 D
|
2019-09-16 13:50:39 +02:00
|
|
|
class D3D11Texture2D : public D3D11DeviceChild<ID3D11Texture2D1> {
|
2017-11-27 15:52:24 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11Texture2D(
|
2017-12-19 16:01:50 +01:00
|
|
|
D3D11Device* pDevice,
|
2022-02-23 16:18:07 -05:00
|
|
|
const D3D11_COMMON_TEXTURE_DESC* pDesc,
|
2023-03-16 16:02:04 +01:00
|
|
|
const D3D11_ON_12_RESOURCE_INFO* p11on12Info,
|
2022-02-23 16:18:07 -05:00
|
|
|
HANDLE hSharedHandle);
|
2020-12-29 15:39:04 -06:00
|
|
|
|
|
|
|
D3D11Texture2D(
|
|
|
|
D3D11Device* pDevice,
|
|
|
|
const D3D11_COMMON_TEXTURE_DESC* pDesc,
|
2021-02-12 01:52:20 +01:00
|
|
|
DXGI_USAGE DxgiUsage,
|
2020-12-29 15:39:04 -06:00
|
|
|
VkImage vkImage);
|
2017-12-19 16:01:50 +01:00
|
|
|
|
2022-03-22 19:48:13 +01:00
|
|
|
D3D11Texture2D(
|
|
|
|
D3D11Device* pDevice,
|
|
|
|
IUnknown* pSwapChain,
|
|
|
|
const D3D11_COMMON_TEXTURE_DESC* pDesc,
|
|
|
|
DXGI_USAGE DxgiUsage);
|
|
|
|
|
2017-11-27 15:52:24 +01:00
|
|
|
~D3D11Texture2D();
|
|
|
|
|
2022-03-22 19:48:13 +01:00
|
|
|
ULONG STDMETHODCALLTYPE AddRef();
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE Release();
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
2017-11-27 15:52:24 +01:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
void STDMETHODCALLTYPE GetType(
|
2017-11-27 15:52:24 +01:00
|
|
|
D3D11_RESOURCE_DIMENSION *pResourceDimension) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
UINT STDMETHODCALLTYPE GetEvictionPriority() final;
|
2017-11-29 15:16:07 +01:00
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
void STDMETHODCALLTYPE SetEvictionPriority(UINT EvictionPriority) final;
|
2017-11-29 15:16:07 +01:00
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
void STDMETHODCALLTYPE GetDesc(
|
2019-09-16 13:50:39 +02:00
|
|
|
D3D11_TEXTURE2D_DESC* pDesc) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDesc1(
|
|
|
|
D3D11_TEXTURE2D_DESC1* pDesc) final;
|
2017-11-27 15:52:24 +01:00
|
|
|
|
2018-03-14 00:45:07 +01:00
|
|
|
D3D11CommonTexture* GetCommonTexture() {
|
|
|
|
return &m_texture;
|
2017-12-19 14:47:35 +01:00
|
|
|
}
|
2017-11-29 20:19:40 +01:00
|
|
|
|
2018-08-11 18:45:41 +02:00
|
|
|
D3D10Texture2D* GetD3D10Iface() {
|
|
|
|
return &m_d3d10;
|
|
|
|
}
|
|
|
|
|
2017-11-27 15:52:24 +01:00
|
|
|
private:
|
|
|
|
|
2018-04-20 11:12:54 +02:00
|
|
|
D3D11CommonTexture m_texture;
|
|
|
|
D3D11VkInteropSurface m_interop;
|
2019-04-27 15:35:20 +02:00
|
|
|
D3D11DXGISurface m_surface;
|
2019-04-27 19:33:47 +02:00
|
|
|
D3D11DXGIResource m_resource;
|
2018-08-11 18:45:41 +02:00
|
|
|
D3D10Texture2D m_d3d10;
|
2022-03-22 19:48:13 +01:00
|
|
|
IUnknown* m_swapChain;
|
2017-11-27 15:52:24 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-12-19 16:01:50 +01:00
|
|
|
|
2017-12-23 17:05:07 +01:00
|
|
|
///////////////////////////////////////////
|
|
|
|
// D 3 D 1 1 T E X T U R E 3 D
|
2019-09-16 13:50:39 +02:00
|
|
|
class D3D11Texture3D : public D3D11DeviceChild<ID3D11Texture3D1> {
|
2017-12-23 17:05:07 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11Texture3D(
|
|
|
|
D3D11Device* pDevice,
|
2023-03-16 16:02:04 +01:00
|
|
|
const D3D11_COMMON_TEXTURE_DESC* pDesc,
|
|
|
|
const D3D11_ON_12_RESOURCE_INFO* p11on12Info);
|
2017-12-23 17:05:07 +01:00
|
|
|
|
|
|
|
~D3D11Texture3D();
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetType(
|
|
|
|
D3D11_RESOURCE_DIMENSION *pResourceDimension) final;
|
|
|
|
|
|
|
|
UINT STDMETHODCALLTYPE GetEvictionPriority() final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE SetEvictionPriority(UINT EvictionPriority) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDesc(
|
2019-09-16 13:50:39 +02:00
|
|
|
D3D11_TEXTURE3D_DESC* pDesc) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDesc1(
|
|
|
|
D3D11_TEXTURE3D_DESC1* pDesc) final;
|
2017-12-23 17:05:07 +01:00
|
|
|
|
2018-03-14 00:45:07 +01:00
|
|
|
D3D11CommonTexture* GetCommonTexture() {
|
|
|
|
return &m_texture;
|
2017-12-23 17:05:07 +01:00
|
|
|
}
|
|
|
|
|
2018-08-11 18:45:41 +02:00
|
|
|
D3D10Texture3D* GetD3D10Iface() {
|
|
|
|
return &m_d3d10;
|
|
|
|
}
|
|
|
|
|
2017-12-23 17:05:07 +01:00
|
|
|
private:
|
|
|
|
|
2018-04-20 11:12:54 +02:00
|
|
|
D3D11CommonTexture m_texture;
|
|
|
|
D3D11VkInteropSurface m_interop;
|
2019-04-27 19:33:47 +02:00
|
|
|
D3D11DXGIResource m_resource;
|
2018-08-11 18:45:41 +02:00
|
|
|
D3D10Texture3D m_d3d10;
|
2017-12-23 17:05:07 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-19 16:01:50 +01:00
|
|
|
/**
|
2018-08-05 18:29:29 +02:00
|
|
|
* \brief Retrieves texture from resource pointer
|
2017-12-19 16:01:50 +01:00
|
|
|
*
|
2018-08-05 18:29:29 +02:00
|
|
|
* \param [in] pResource The resource to query
|
|
|
|
* \returns Pointer to texture info, or \c nullptr
|
2017-12-19 16:01:50 +01:00
|
|
|
*/
|
2018-03-14 00:45:07 +01:00
|
|
|
D3D11CommonTexture* GetCommonTexture(
|
2018-01-05 01:15:56 +01:00
|
|
|
ID3D11Resource* pResource);
|
2017-12-19 16:01:50 +01:00
|
|
|
|
2017-11-27 15:52:24 +01:00
|
|
|
}
|