mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 14:52:10 +01:00
[dxvk] Rename various storage-related functions
This commit is contained in:
parent
43355ecd73
commit
d72346f2cb
@ -114,11 +114,11 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
Rc<DxvkResourceAllocation> AllocSlice(DxvkLocalAllocationCache* cache) {
|
||||
return m_buffer->allocateSlice(cache);
|
||||
return m_buffer->allocateStorage(cache);
|
||||
}
|
||||
|
||||
Rc<DxvkResourceAllocation> DiscardSlice(DxvkLocalAllocationCache* cache) {
|
||||
auto allocation = m_buffer->allocateSlice(cache);
|
||||
auto allocation = m_buffer->allocateStorage(cache);
|
||||
m_mapPtr = allocation->mapPtr();
|
||||
return allocation;
|
||||
}
|
||||
|
@ -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));
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ namespace dxvk {
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> DiscardSlice(UINT Subresource) {
|
||||
if (Subresource < m_buffers.size()) {
|
||||
Rc<DxvkResourceAllocation> slice = m_buffers[Subresource].buffer->allocateSlice();
|
||||
Rc<DxvkResourceAllocation> slice = m_buffers[Subresource].buffer->allocateStorage();
|
||||
m_buffers[Subresource].slice = slice;
|
||||
return slice;
|
||||
} else {
|
||||
|
@ -1295,7 +1295,7 @@ namespace dxvk {
|
||||
uboData.yMax = 0.9215686f;
|
||||
}
|
||||
|
||||
Rc<DxvkResourceAllocation> uboSlice = m_ubo->allocateSlice();
|
||||
Rc<DxvkResourceAllocation> uboSlice = m_ubo->allocateStorage();
|
||||
memcpy(uboSlice->mapPtr(), &uboData, sizeof(uboData));
|
||||
|
||||
ctx->invalidateBuffer(m_ubo, std::move(uboSlice));
|
||||
|
@ -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);
|
||||
|
@ -134,7 +134,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
inline Rc<DxvkResourceAllocation> DiscardMapSlice() {
|
||||
m_allocation = GetMapBuffer()->allocateSlice();
|
||||
m_allocation = GetMapBuffer()->allocateStorage();
|
||||
return m_allocation;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,8 +300,8 @@ namespace dxvk {
|
||||
* \brief Allocates new buffer slice
|
||||
* \returns The new backing resource
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> allocateSlice() {
|
||||
return allocateSlice(nullptr);
|
||||
Rc<DxvkResourceAllocation> allocateStorage() {
|
||||
return allocateStorage(nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,7 +312,7 @@ namespace dxvk {
|
||||
* \param [in] cache Optional allocation cache
|
||||
* \returns The new buffer slice
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> allocateSlice(DxvkLocalAllocationCache* cache) {
|
||||
Rc<DxvkResourceAllocation> 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<DxvkResourceAllocation> assignSlice(Rc<DxvkResourceAllocation>&& slice) {
|
||||
Rc<DxvkResourceAllocation> assignStorage(Rc<DxvkResourceAllocation>&& slice) {
|
||||
Rc<DxvkResourceAllocation> 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<DxvkResourceAllocation> getAllocation() const {
|
||||
Rc<DxvkResourceAllocation> storage() const {
|
||||
return m_storage;
|
||||
}
|
||||
|
||||
|
@ -1380,7 +1380,7 @@ namespace dxvk {
|
||||
void DxvkContext::invalidateBuffer(
|
||||
const Rc<DxvkBuffer>& buffer,
|
||||
Rc<DxvkResourceAllocation>&& slice) {
|
||||
Rc<DxvkResourceAllocation> prevAllocation = buffer->assignSlice(std::move(slice));
|
||||
Rc<DxvkResourceAllocation> prevAllocation = buffer->assignStorage(std::move(slice));
|
||||
m_cmd->trackResource<DxvkAccess::None>(std::move(prevAllocation));
|
||||
|
||||
// We also need to update all bindings that the buffer
|
||||
@ -1436,7 +1436,7 @@ namespace dxvk {
|
||||
const Rc<DxvkImage>& image,
|
||||
Rc<DxvkResourceAllocation>&& slice,
|
||||
const DxvkImageUsageInfo& usageInfo) {
|
||||
Rc<DxvkResourceAllocation> prevAllocation = image->assignResourceWithUsage(std::move(slice), usageInfo);
|
||||
Rc<DxvkResourceAllocation> prevAllocation = image->assignStorageWithUsage(std::move(slice), usageInfo);
|
||||
m_cmd->trackResource<DxvkAccess::None>(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();
|
||||
|
@ -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<DxvkResourceAllocation> DxvkImage::createResource() {
|
||||
return createResourceWithUsage(DxvkImageUsageInfo());
|
||||
Rc<DxvkResourceAllocation> DxvkImage::allocateStorage() {
|
||||
return allocateStorageWithUsage(DxvkImageUsageInfo());
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkResourceAllocation> DxvkImage::createResourceWithUsage(const DxvkImageUsageInfo& usageInfo) {
|
||||
Rc<DxvkResourceAllocation> DxvkImage::allocateStorageWithUsage(const DxvkImageUsageInfo& usageInfo) {
|
||||
const DxvkFormatInfo* formatInfo = lookupFormatInfo(m_info.format);
|
||||
small_vector<VkFormat, 4> localViewFormats;
|
||||
|
||||
@ -178,13 +178,13 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkResourceAllocation> DxvkImage::assignResource(
|
||||
Rc<DxvkResourceAllocation> DxvkImage::assignStorage(
|
||||
Rc<DxvkResourceAllocation>&& resource) {
|
||||
return assignResourceWithUsage(std::move(resource), DxvkImageUsageInfo());
|
||||
return assignStorageWithUsage(std::move(resource), DxvkImageUsageInfo());
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkResourceAllocation> DxvkImage::assignResourceWithUsage(
|
||||
Rc<DxvkResourceAllocation> DxvkImage::assignStorageWithUsage(
|
||||
Rc<DxvkResourceAllocation>&& resource,
|
||||
const DxvkImageUsageInfo& usageInfo) {
|
||||
Rc<DxvkResourceAllocation> old = std::move(m_storage);
|
||||
|
@ -522,7 +522,7 @@ namespace dxvk {
|
||||
* The returned image can be used as backing storage.
|
||||
* \returns New underlying image resource
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> createResource();
|
||||
Rc<DxvkResourceAllocation> 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<DxvkResourceAllocation> createResourceWithUsage(
|
||||
Rc<DxvkResourceAllocation> allocateStorageWithUsage(
|
||||
const DxvkImageUsageInfo& usage);
|
||||
|
||||
/**
|
||||
@ -542,7 +542,7 @@ namespace dxvk {
|
||||
* \param [in] resource New backing storage
|
||||
* \returns Previous backing storage
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> assignResource(
|
||||
Rc<DxvkResourceAllocation> assignStorage(
|
||||
Rc<DxvkResourceAllocation>&& resource);
|
||||
|
||||
/**
|
||||
@ -553,7 +553,7 @@ namespace dxvk {
|
||||
* \param [in] usageInfo Added usage info
|
||||
* \returns Previous backing storage
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> assignResourceWithUsage(
|
||||
Rc<DxvkResourceAllocation> assignStorageWithUsage(
|
||||
Rc<DxvkResourceAllocation>&& resource,
|
||||
const DxvkImageUsageInfo& usageInfo);
|
||||
|
||||
@ -561,7 +561,7 @@ namespace dxvk {
|
||||
* \brief Retrieves current backing storage
|
||||
* \returns Backing storage for this image
|
||||
*/
|
||||
Rc<DxvkResourceAllocation> getAllocation() const {
|
||||
Rc<DxvkResourceAllocation> storage() const {
|
||||
return m_storage;
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ namespace dxvk {
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(dstView->image());
|
||||
|
||||
if (m_gammaImage)
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(m_gammaImage->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(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<DxvkAccess::Read>(buffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(image->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(buffer->storage());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(image->storage());
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,7 +373,7 @@ namespace dxvk::hud {
|
||||
drawInfoBuffer, textBufferView, 2u);
|
||||
|
||||
// Make sure GPU resources are being kept alive as necessary
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_gpuBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_gpuBuffer->storage());
|
||||
ctx.cmd->trackQuery(Rc<DxvkGpuQuery>(m_query));
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ namespace dxvk::hud {
|
||||
|
||||
ctx.cmd->cmdDraw(4, 1, 0, 0);
|
||||
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(m_gpuBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(m_gpuBuffer->storage());
|
||||
}
|
||||
|
||||
|
||||
@ -473,7 +473,7 @@ namespace dxvk::hud {
|
||||
depInfo.pMemoryBarriers = &barrier;
|
||||
|
||||
ctx.cmd->cmdPipelineBarrier(DxvkCmdBuffer::InitBuffer, &depInfo);
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_gpuBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(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<DxvkAccess::Read>(m_dataBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(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
|
||||
|
@ -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<DxvkResourceAllocation>(m_textBuffer->allocateSlice()));
|
||||
m_textBuffer->assignStorage(Rc<DxvkResourceAllocation>(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<DxvkAccess::None>(m_textBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(m_fontBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(m_fontTexture->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::None>(m_textBuffer->storage());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(m_fontBuffer->storage());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(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<DxvkAccess::Read>(uploadBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_fontBuffer->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_fontTexture->getAllocation());
|
||||
ctx.cmd->trackResource<DxvkAccess::Read>(uploadBuffer->storage());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_fontBuffer->storage());
|
||||
ctx.cmd->trackResource<DxvkAccess::Write>(m_fontTexture->storage());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user