1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d9] Return const refs for image/buffers + format mapping in CommonTexture

Avoids needless Rc ref counts and copies of that fairly large structure.
This commit is contained in:
Joshua Ashton 2021-07-24 20:09:58 +01:00 committed by Joshie
parent 23873cbb57
commit 3cbac8923f

View File

@ -98,7 +98,7 @@ namespace dxvk {
* \brief Vulkan Format * \brief Vulkan Format
* \returns The Vulkan format of the resource * \returns The Vulkan format of the resource
*/ */
const D3D9_VK_FORMAT_MAPPING GetFormatMapping() const { const D3D9_VK_FORMAT_MAPPING& GetFormatMapping() const {
return m_mapping; return m_mapping;
} }
@ -123,7 +123,7 @@ namespace dxvk {
* Note, this will be nullptr if the map mode is D3D9_COMMON_TEXTURE_MAP_MODE_SYSTEMMEM * Note, this will be nullptr if the map mode is D3D9_COMMON_TEXTURE_MAP_MODE_SYSTEMMEM
* \returns The DXVK image * \returns The DXVK image
*/ */
Rc<DxvkImage> GetImage() const { const Rc<DxvkImage>& GetImage() const {
return m_image; return m_image;
} }
@ -133,14 +133,14 @@ namespace dxvk {
* as the main image * as the main image
* \returns An image with identical info, but 1 sample * \returns An image with identical info, but 1 sample
*/ */
Rc<DxvkImage> GetResolveImage() { const Rc<DxvkImage>& GetResolveImage() {
if (unlikely(m_resolveImage == nullptr)) if (unlikely(m_resolveImage == nullptr))
m_resolveImage = CreateResolveImage(); m_resolveImage = CreateResolveImage();
return m_resolveImage; return m_resolveImage;
} }
Rc<DxvkBuffer> GetBuffer(UINT Subresource) { const Rc<DxvkBuffer>& GetBuffer(UINT Subresource) {
return m_buffers[Subresource]; return m_buffers[Subresource];
} }