From d72346f2cbff20c8908e832be6be85a4436236e6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 16 Oct 2024 13:16:00 +0200 Subject: [PATCH] [dxvk] Rename various storage-related functions --- src/d3d11/d3d11_buffer.h | 4 ++-- src/d3d11/d3d11_swapchain.cpp | 4 ++-- src/d3d11/d3d11_texture.cpp | 2 +- src/d3d11/d3d11_texture.h | 2 +- src/d3d11/d3d11_video.cpp | 2 +- src/d3d9/d3d9_common_buffer.cpp | 2 +- src/d3d9/d3d9_common_buffer.h | 2 +- src/d3d9/d3d9_constant_buffer.cpp | 6 +++--- src/d3d9/d3d9_device.cpp | 2 +- src/dxvk/dxvk_buffer.cpp | 4 ++-- src/dxvk/dxvk_buffer.h | 10 +++++----- src/dxvk/dxvk_context.cpp | 18 +++++++++--------- src/dxvk/dxvk_image.cpp | 16 ++++++++-------- src/dxvk/dxvk_image.h | 10 +++++----- src/dxvk/dxvk_swapchain_blitter.cpp | 6 +++--- src/dxvk/hud/dxvk_hud_item.cpp | 10 +++++----- src/dxvk/hud/dxvk_hud_renderer.cpp | 14 +++++++------- 17 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/d3d11/d3d11_buffer.h b/src/d3d11/d3d11_buffer.h index 7270b0c09..c2daed447 100644 --- a/src/d3d11/d3d11_buffer.h +++ b/src/d3d11/d3d11_buffer.h @@ -114,11 +114,11 @@ namespace dxvk { } Rc AllocSlice(DxvkLocalAllocationCache* cache) { - return m_buffer->allocateSlice(cache); + return m_buffer->allocateStorage(cache); } Rc DiscardSlice(DxvkLocalAllocationCache* cache) { - auto allocation = m_buffer->allocateSlice(cache); + auto allocation = m_buffer->allocateStorage(cache); m_mapPtr = allocation->mapPtr(); return allocation; } diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index 58104f467..d1c66090e 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -471,10 +471,10 @@ namespace dxvk { ctx->EmitCs([ cImages = std::move(images) ] (DxvkContext* ctx) { - auto allocation = cImages[0]->getAllocation(); + auto allocation = cImages[0]->storage(); for (size_t i = 0u; i + 1 < cImages.size(); i++) - ctx->invalidateImage(cImages[i], cImages[i + 1]->getAllocation()); + ctx->invalidateImage(cImages[i], cImages[i + 1]->storage()); ctx->invalidateImage(cImages[cImages.size() - 1u], std::move(allocation)); }); diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 6a4ce9965..b6d953845 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -713,7 +713,7 @@ namespace dxvk { MappedBuffer result; result.buffer = m_device->GetDXVKDevice()->createBuffer(info, memType); - result.slice = result.buffer->getAllocation(); + result.slice = result.buffer->storage(); return result; } diff --git a/src/d3d11/d3d11_texture.h b/src/d3d11/d3d11_texture.h index 3902cbcfe..870443852 100644 --- a/src/d3d11/d3d11_texture.h +++ b/src/d3d11/d3d11_texture.h @@ -221,7 +221,7 @@ namespace dxvk { */ Rc DiscardSlice(UINT Subresource) { if (Subresource < m_buffers.size()) { - Rc slice = m_buffers[Subresource].buffer->allocateSlice(); + Rc slice = m_buffers[Subresource].buffer->allocateStorage(); m_buffers[Subresource].slice = slice; return slice; } else { diff --git a/src/d3d11/d3d11_video.cpp b/src/d3d11/d3d11_video.cpp index 747dd2a3e..962f23dac 100644 --- a/src/d3d11/d3d11_video.cpp +++ b/src/d3d11/d3d11_video.cpp @@ -1295,7 +1295,7 @@ namespace dxvk { uboData.yMax = 0.9215686f; } - Rc uboSlice = m_ubo->allocateSlice(); + Rc uboSlice = m_ubo->allocateStorage(); memcpy(uboSlice->mapPtr(), &uboData, sizeof(uboData)); ctx->invalidateBuffer(m_ubo, std::move(uboSlice)); diff --git a/src/d3d9/d3d9_common_buffer.cpp b/src/d3d9/d3d9_common_buffer.cpp index a12d7b86c..4246c36bd 100644 --- a/src/d3d9/d3d9_common_buffer.cpp +++ b/src/d3d9/d3d9_common_buffer.cpp @@ -14,7 +14,7 @@ namespace dxvk { if (m_mapMode == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER) m_stagingBuffer = CreateStagingBuffer(); - m_allocation = GetMapBuffer()->getAllocation(); + m_allocation = GetMapBuffer()->storage(); if (m_desc.Pool != D3DPOOL_DEFAULT) m_dirtyRange = D3D9Range(0, m_desc.Size); diff --git a/src/d3d9/d3d9_common_buffer.h b/src/d3d9/d3d9_common_buffer.h index d6fd75ee9..15a012f27 100644 --- a/src/d3d9/d3d9_common_buffer.h +++ b/src/d3d9/d3d9_common_buffer.h @@ -134,7 +134,7 @@ namespace dxvk { } inline Rc DiscardMapSlice() { - m_allocation = GetMapBuffer()->allocateSlice(); + m_allocation = GetMapBuffer()->allocateStorage(); return m_allocation; } diff --git a/src/d3d9/d3d9_constant_buffer.cpp b/src/d3d9/d3d9_constant_buffer.cpp index f59376366..cac2a2897 100644 --- a/src/d3d9/d3d9_constant_buffer.cpp +++ b/src/d3d9/d3d9_constant_buffer.cpp @@ -48,7 +48,7 @@ namespace dxvk { size = align(size, m_align); if (unlikely(m_offset + size > m_size)) { - m_slice = m_buffer->allocateSlice(); + m_slice = m_buffer->allocateStorage(); m_offset = 0; m_device->EmitCs([ @@ -78,7 +78,7 @@ namespace dxvk { if (unlikely(m_buffer == nullptr)) m_slice = this->createBuffer(); else - m_slice = m_buffer->allocateSlice(); + m_slice = m_buffer->allocateStorage(); m_device->EmitCs([ cBuffer = m_buffer, @@ -124,7 +124,7 @@ namespace dxvk { ctx->bindUniformBuffer(cStages, cBinding, std::move(cSlice)); }); - return m_buffer->getAllocation(); + return m_buffer->storage(); } diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 76e0c2012..c84ab4e61 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -4477,7 +4477,7 @@ namespace dxvk { VkDeviceSize alignedSize = align(size, CACHE_LINE_SIZE); if (unlikely(m_upBufferOffset + alignedSize > UPBufferSize)) { - auto slice = m_upBuffer->allocateSlice(); + auto slice = m_upBuffer->allocateStorage(); m_upBufferOffset = 0; m_upBufferMapPtr = slice->mapPtr(); diff --git a/src/dxvk/dxvk_buffer.cpp b/src/dxvk/dxvk_buffer.cpp index 192a12d94..c9b9e555a 100644 --- a/src/dxvk/dxvk_buffer.cpp +++ b/src/dxvk/dxvk_buffer.cpp @@ -18,7 +18,7 @@ namespace dxvk { m_sharingMode (device->getSharingMode()), m_info (createInfo) { // Create and assign actual buffer resource - assignSlice(allocateSlice()); + assignStorage(allocateStorage()); } @@ -40,7 +40,7 @@ namespace dxvk { info.size = m_info.size; m_sharingMode.fill(info); - assignSlice(allocator.importBufferResource(info, importInfo)); + assignStorage(allocator.importBufferResource(info, importInfo)); } diff --git a/src/dxvk/dxvk_buffer.h b/src/dxvk/dxvk_buffer.h index 2d6539bce..628225076 100644 --- a/src/dxvk/dxvk_buffer.h +++ b/src/dxvk/dxvk_buffer.h @@ -300,8 +300,8 @@ namespace dxvk { * \brief Allocates new buffer slice * \returns The new backing resource */ - Rc allocateSlice() { - return allocateSlice(nullptr); + Rc allocateStorage() { + return allocateStorage(nullptr); } /** @@ -312,7 +312,7 @@ namespace dxvk { * \param [in] cache Optional allocation cache * \returns The new buffer slice */ - Rc allocateSlice(DxvkLocalAllocationCache* cache) { + Rc allocateStorage(DxvkLocalAllocationCache* cache) { VkBufferCreateInfo info = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO }; info.flags = m_info.flags; info.usage = m_info.usage; @@ -332,7 +332,7 @@ namespace dxvk { * \param [in] slice The new backing resource * \returns Previous buffer allocation */ - Rc assignSlice(Rc&& slice) { + Rc assignStorage(Rc&& slice) { Rc result = std::move(m_storage); m_storage = std::move(slice); @@ -347,7 +347,7 @@ namespace dxvk { * \brief Retrieves current backing storage * \returns Current buffer allocation */ - Rc getAllocation() const { + Rc storage() const { return m_storage; } diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 03a7dcc83..116847e9f 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1380,7 +1380,7 @@ namespace dxvk { void DxvkContext::invalidateBuffer( const Rc& buffer, Rc&& slice) { - Rc prevAllocation = buffer->assignSlice(std::move(slice)); + Rc prevAllocation = buffer->assignStorage(std::move(slice)); m_cmd->trackResource(std::move(prevAllocation)); // We also need to update all bindings that the buffer @@ -1436,7 +1436,7 @@ namespace dxvk { const Rc& image, Rc&& slice, const DxvkImageUsageInfo& usageInfo) { - Rc prevAllocation = image->assignResourceWithUsage(std::move(slice), usageInfo); + Rc prevAllocation = image->assignStorageWithUsage(std::move(slice), usageInfo); m_cmd->trackResource(std::move(prevAllocation)); VkImageUsageFlags usage = image->info().usage; @@ -1478,7 +1478,7 @@ namespace dxvk { // that the stable adress bit is respected if set for the first time. if (isUsageAndFormatCompatible && isAccessAndLayoutCompatible) { if (usageInfo.stableGpuAddress && image->canRelocate()) - image->assignResourceWithUsage(image->getAllocation(), usageInfo); + image->assignStorageWithUsage(image->storage(), usageInfo); return true; } @@ -1495,7 +1495,7 @@ namespace dxvk { VkImageLayout oldLayout = image->info().layout; VkImageLayout newLayout = usageInfo.layout ? usageInfo.layout : oldLayout; - image->assignResourceWithUsage(image->getAllocation(), usageInfo); + image->assignStorageWithUsage(image->storage(), usageInfo); accessImage(DxvkCmdBuffer::ExecBuffer, *image, image->getAvailableSubresources(), oldLayout, image->info().stages, image->info().access, @@ -1587,7 +1587,7 @@ namespace dxvk { DxvkImageUsageInfo usage = usageInfo; usage.flags |= createFlags; - auto storage = image->createResourceWithUsage(usage); + auto storage = image->allocateStorageWithUsage(usage); DxvkRelocateImageInfo relocateInfo; relocateInfo.image = image; @@ -6198,7 +6198,7 @@ namespace dxvk { && (m_flags.test(DxvkContextFlag::GpXfbActive))) this->spillRenderPass(true); - this->invalidateBuffer(buffer, buffer->allocateSlice()); + this->invalidateBuffer(buffer, buffer->allocateStorage()); return true; } @@ -6271,7 +6271,7 @@ namespace dxvk { for (size_t i = 0; i < imageCount; i++) { const auto& info = imageInfos[i]; - auto oldStorage = info.image->getAllocation(); + auto oldStorage = info.image->storage(); VkImageMemoryBarrier2 dstBarrier = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2 }; dstBarrier.srcStageMask = info.image->info().stages; @@ -6321,7 +6321,7 @@ namespace dxvk { // Copy and invalidate all buffers for (size_t i = 0; i < bufferCount; i++) { const auto& info = bufferInfos[i]; - auto oldStorage = info.buffer->getAllocation(); + auto oldStorage = info.buffer->storage(); DxvkResourceBufferInfo dstInfo = info.storage->getBufferInfo(); DxvkResourceBufferInfo srcInfo = oldStorage->getBufferInfo(); @@ -6346,7 +6346,7 @@ namespace dxvk { // Copy and invalidate all images for (size_t i = 0; i < imageCount; i++) { const auto& info = imageInfos[i]; - auto oldStorage = info.image->getAllocation(); + auto oldStorage = info.image->storage(); DxvkResourceImageInfo dstInfo = info.storage->getImageInfo(); DxvkResourceImageInfo srcInfo = oldStorage->getImageInfo(); diff --git a/src/dxvk/dxvk_image.cpp b/src/dxvk/dxvk_image.cpp index b0007af30..146f8c846 100644 --- a/src/dxvk/dxvk_image.cpp +++ b/src/dxvk/dxvk_image.cpp @@ -29,7 +29,7 @@ namespace dxvk { if (m_info.sharing.mode != DxvkSharedHandleMode::Import) m_uninitializedSubresourceCount = m_info.numLayers * m_info.mipLevels; - assignResource(createResource()); + assignStorage(allocateStorage()); } @@ -48,7 +48,7 @@ namespace dxvk { // Create backing storage for existing image resource VkImageCreateInfo imageInfo = getImageCreateInfo(DxvkImageUsageInfo()); - assignResource(m_allocator->importImageResource(imageInfo, imageHandle)); + assignStorage(m_allocator->importImageResource(imageInfo, imageHandle)); } @@ -112,12 +112,12 @@ namespace dxvk { } - Rc DxvkImage::createResource() { - return createResourceWithUsage(DxvkImageUsageInfo()); + Rc DxvkImage::allocateStorage() { + return allocateStorageWithUsage(DxvkImageUsageInfo()); } - Rc DxvkImage::createResourceWithUsage(const DxvkImageUsageInfo& usageInfo) { + Rc DxvkImage::allocateStorageWithUsage(const DxvkImageUsageInfo& usageInfo) { const DxvkFormatInfo* formatInfo = lookupFormatInfo(m_info.format); small_vector localViewFormats; @@ -178,13 +178,13 @@ namespace dxvk { } - Rc DxvkImage::assignResource( + Rc DxvkImage::assignStorage( Rc&& resource) { - return assignResourceWithUsage(std::move(resource), DxvkImageUsageInfo()); + return assignStorageWithUsage(std::move(resource), DxvkImageUsageInfo()); } - Rc DxvkImage::assignResourceWithUsage( + Rc DxvkImage::assignStorageWithUsage( Rc&& resource, const DxvkImageUsageInfo& usageInfo) { Rc old = std::move(m_storage); diff --git a/src/dxvk/dxvk_image.h b/src/dxvk/dxvk_image.h index f1e93c7da..f7c06c9a1 100644 --- a/src/dxvk/dxvk_image.h +++ b/src/dxvk/dxvk_image.h @@ -522,7 +522,7 @@ namespace dxvk { * The returned image can be used as backing storage. * \returns New underlying image resource */ - Rc createResource(); + Rc allocateStorage(); /** * \brief Creates image resource with extra usage @@ -532,7 +532,7 @@ namespace dxvk { * \param [in] usage Usage flags to add * \returns New underlying image resource */ - Rc createResourceWithUsage( + Rc allocateStorageWithUsage( const DxvkImageUsageInfo& usage); /** @@ -542,7 +542,7 @@ namespace dxvk { * \param [in] resource New backing storage * \returns Previous backing storage */ - Rc assignResource( + Rc assignStorage( Rc&& resource); /** @@ -553,7 +553,7 @@ namespace dxvk { * \param [in] usageInfo Added usage info * \returns Previous backing storage */ - Rc assignResourceWithUsage( + Rc assignStorageWithUsage( Rc&& resource, const DxvkImageUsageInfo& usageInfo); @@ -561,7 +561,7 @@ namespace dxvk { * \brief Retrieves current backing storage * \returns Backing storage for this image */ - Rc getAllocation() const { + Rc storage() const { return m_storage; } diff --git a/src/dxvk/dxvk_swapchain_blitter.cpp b/src/dxvk/dxvk_swapchain_blitter.cpp index 613b55b5d..fd1af7f05 100644 --- a/src/dxvk/dxvk_swapchain_blitter.cpp +++ b/src/dxvk/dxvk_swapchain_blitter.cpp @@ -344,7 +344,7 @@ namespace dxvk { ctx.cmd->trackResource(dstView->image()); if (m_gammaImage) - ctx.cmd->trackResource(m_gammaImage->getAllocation()); + ctx.cmd->trackResource(m_gammaImage->storage()); ctx.cmd->trackSampler(m_samplerGamma); ctx.cmd->trackSampler(m_samplerPresent); @@ -444,8 +444,8 @@ namespace dxvk { ctx.cmd->cmdPipelineBarrier(DxvkCmdBuffer::ExecBuffer, &depInfo); - ctx.cmd->trackResource(buffer->getAllocation()); - ctx.cmd->trackResource(image->getAllocation()); + ctx.cmd->trackResource(buffer->storage()); + ctx.cmd->trackResource(image->storage()); } diff --git a/src/dxvk/hud/dxvk_hud_item.cpp b/src/dxvk/hud/dxvk_hud_item.cpp index 87a65d426..7b7a11468 100644 --- a/src/dxvk/hud/dxvk_hud_item.cpp +++ b/src/dxvk/hud/dxvk_hud_item.cpp @@ -373,7 +373,7 @@ namespace dxvk::hud { drawInfoBuffer, textBufferView, 2u); // Make sure GPU resources are being kept alive as necessary - ctx.cmd->trackResource(m_gpuBuffer->getAllocation()); + ctx.cmd->trackResource(m_gpuBuffer->storage()); ctx.cmd->trackQuery(Rc(m_query)); } @@ -419,7 +419,7 @@ namespace dxvk::hud { ctx.cmd->cmdDraw(4, 1, 0, 0); - ctx.cmd->trackResource(m_gpuBuffer->getAllocation()); + ctx.cmd->trackResource(m_gpuBuffer->storage()); } @@ -473,7 +473,7 @@ namespace dxvk::hud { depInfo.pMemoryBarriers = &barrier; ctx.cmd->cmdPipelineBarrier(DxvkCmdBuffer::InitBuffer, &depInfo); - ctx.cmd->trackResource(m_gpuBuffer->getAllocation()); + ctx.cmd->trackResource(m_gpuBuffer->storage()); m_query = m_device->createRawQuery(VK_QUERY_TYPE_TIMESTAMP); } @@ -1176,7 +1176,7 @@ namespace dxvk::hud { ctx.cmd->cmdDraw(4, m_drawInfos.size(), 0, 0); // Track data buffer lifetime - ctx.cmd->trackResource(m_dataBuffer->getAllocation()); + ctx.cmd->trackResource(m_dataBuffer->storage()); m_drawInfos.clear(); } @@ -1206,7 +1206,7 @@ namespace dxvk::hud { VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } else { // Ensure we can update the buffer without overriding live data - m_dataBuffer->assignSlice(m_dataBuffer->allocateSlice()); + m_dataBuffer->assignStorage(m_dataBuffer->allocateStorage()); } // Update draw infos and pad unused area with zeroes diff --git a/src/dxvk/hud/dxvk_hud_renderer.cpp b/src/dxvk/hud/dxvk_hud_renderer.cpp index d63c84ca6..7e0129663 100644 --- a/src/dxvk/hud/dxvk_hud_renderer.cpp +++ b/src/dxvk/hud/dxvk_hud_renderer.cpp @@ -155,7 +155,7 @@ namespace dxvk::hud { m_textBufferView = m_textBuffer->createView(textViewInfo); } else { // Discard and invalidate buffer so we can safely update it - m_textBuffer->assignSlice(Rc(m_textBuffer->allocateSlice())); + m_textBuffer->assignStorage(Rc(m_textBuffer->allocateStorage())); } // Upload aligned text data in such a way that we write full cache lines @@ -190,9 +190,9 @@ namespace dxvk::hud { m_textBufferView->handle(), m_textDraws.size()); // Ensure all used resources are kept alive - ctx.cmd->trackResource(m_textBuffer->getAllocation()); - ctx.cmd->trackResource(m_fontBuffer->getAllocation()); - ctx.cmd->trackResource(m_fontTexture->getAllocation()); + ctx.cmd->trackResource(m_textBuffer->storage()); + ctx.cmd->trackResource(m_fontBuffer->storage()); + ctx.cmd->trackResource(m_fontTexture->storage()); ctx.cmd->trackSampler(m_fontSampler); // Reset internal text buffers @@ -481,9 +481,9 @@ namespace dxvk::hud { ctx.cmd->cmdPipelineBarrier(DxvkCmdBuffer::InitBuffer, &depInfo); - ctx.cmd->trackResource(uploadBuffer->getAllocation()); - ctx.cmd->trackResource(m_fontBuffer->getAllocation()); - ctx.cmd->trackResource(m_fontTexture->getAllocation()); + ctx.cmd->trackResource(uploadBuffer->storage()); + ctx.cmd->trackResource(m_fontBuffer->storage()); + ctx.cmd->trackResource(m_fontTexture->storage()); }