mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Use DxvkObjects to create and pass around common objects
This commit is contained in:
parent
35679d2ba7
commit
65c1e58bd9
@ -6,30 +6,15 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
DxvkContext::DxvkContext(
|
DxvkContext::DxvkContext(const Rc<DxvkDevice>& device)
|
||||||
const Rc<DxvkDevice>& device,
|
|
||||||
const Rc<DxvkPipelineManager>& pipelineManager,
|
|
||||||
const Rc<DxvkGpuEventPool>& gpuEventPool,
|
|
||||||
const Rc<DxvkGpuQueryPool>& gpuQueryPool,
|
|
||||||
const Rc<DxvkMetaClearObjects>& metaClearObjects,
|
|
||||||
const Rc<DxvkMetaCopyObjects>& metaCopyObjects,
|
|
||||||
const Rc<DxvkMetaResolveObjects>& metaResolveObjects,
|
|
||||||
const Rc<DxvkMetaMipGenObjects>& metaMipGenObjects,
|
|
||||||
const Rc<DxvkMetaPackObjects>& metaPackObjects)
|
|
||||||
: m_device (device),
|
: m_device (device),
|
||||||
m_pipeMgr (pipelineManager),
|
m_common (&device->m_objects),
|
||||||
m_gpuEvents (gpuEventPool),
|
|
||||||
m_metaClear (metaClearObjects),
|
|
||||||
m_metaCopy (metaCopyObjects),
|
|
||||||
m_metaResolve (metaResolveObjects),
|
|
||||||
m_metaMipGen (metaMipGenObjects),
|
|
||||||
m_metaPack (metaPackObjects),
|
|
||||||
m_sdmaAcquires(DxvkCmdBuffer::SdmaBuffer),
|
m_sdmaAcquires(DxvkCmdBuffer::SdmaBuffer),
|
||||||
m_sdmaBarriers(DxvkCmdBuffer::SdmaBuffer),
|
m_sdmaBarriers(DxvkCmdBuffer::SdmaBuffer),
|
||||||
m_initBarriers(DxvkCmdBuffer::InitBuffer),
|
m_initBarriers(DxvkCmdBuffer::InitBuffer),
|
||||||
m_execAcquires(DxvkCmdBuffer::ExecBuffer),
|
m_execAcquires(DxvkCmdBuffer::ExecBuffer),
|
||||||
m_execBarriers(DxvkCmdBuffer::ExecBuffer),
|
m_execBarriers(DxvkCmdBuffer::ExecBuffer),
|
||||||
m_queryManager(gpuQueryPool),
|
m_queryManager(m_common->queryPool()),
|
||||||
m_staging (device) {
|
m_staging (device) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -422,7 +407,7 @@ namespace dxvk {
|
|||||||
m_execBarriers.recordCommands(m_cmd);
|
m_execBarriers.recordCommands(m_cmd);
|
||||||
|
|
||||||
// Query pipeline objects to use for this clear operation
|
// Query pipeline objects to use for this clear operation
|
||||||
DxvkMetaClearPipeline pipeInfo = m_metaClear->getClearBufferPipeline(
|
DxvkMetaClearPipeline pipeInfo = m_common->metaClear().getClearBufferPipeline(
|
||||||
imageFormatInfo(bufferView->info().format)->flags);
|
imageFormatInfo(bufferView->info().format)->flags);
|
||||||
|
|
||||||
// Create a descriptor set pointing to the view
|
// Create a descriptor set pointing to the view
|
||||||
@ -1109,7 +1094,7 @@ namespace dxvk {
|
|||||||
this->unbindComputePipeline();
|
this->unbindComputePipeline();
|
||||||
|
|
||||||
// Retrieve compute pipeline for the given format
|
// Retrieve compute pipeline for the given format
|
||||||
auto pipeInfo = m_metaPack->getPackPipeline(format);
|
auto pipeInfo = m_common->metaPack().getPackPipeline(format);
|
||||||
|
|
||||||
if (!pipeInfo.pipeHandle)
|
if (!pipeInfo.pipeHandle)
|
||||||
return;
|
return;
|
||||||
@ -1222,8 +1207,7 @@ namespace dxvk {
|
|||||||
m_execBarriers.recordCommands(m_cmd);
|
m_execBarriers.recordCommands(m_cmd);
|
||||||
|
|
||||||
// Retrieve compute pipeline for the given format
|
// Retrieve compute pipeline for the given format
|
||||||
auto pipeInfo = m_metaPack->getUnpackPipeline(
|
auto pipeInfo = m_common->metaPack().getUnpackPipeline(dstImage->info().format, format);
|
||||||
dstImage->info().format, format);
|
|
||||||
|
|
||||||
if (!pipeInfo.pipeHandle) {
|
if (!pipeInfo.pipeHandle) {
|
||||||
Logger::err(str::format(
|
Logger::err(str::format(
|
||||||
@ -1684,7 +1668,7 @@ namespace dxvk {
|
|||||||
passInfo.pClearValues = nullptr;
|
passInfo.pClearValues = nullptr;
|
||||||
|
|
||||||
// Retrieve a compatible pipeline to use for rendering
|
// Retrieve a compatible pipeline to use for rendering
|
||||||
DxvkMetaMipGenPipeline pipeInfo = m_metaMipGen->getPipeline(
|
DxvkMetaMipGenPipeline pipeInfo = m_common->metaMipGen().getPipeline(
|
||||||
mipGenerator->viewType(), imageView->info().format);
|
mipGenerator->viewType(), imageView->info().format);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < mipGenerator->passCount(); i++) {
|
for (uint32_t i = 0; i < mipGenerator->passCount(); i++) {
|
||||||
@ -2342,7 +2326,7 @@ namespace dxvk {
|
|||||||
void DxvkContext::signalGpuEvent(const Rc<DxvkGpuEvent>& event) {
|
void DxvkContext::signalGpuEvent(const Rc<DxvkGpuEvent>& event) {
|
||||||
this->spillRenderPass();
|
this->spillRenderPass();
|
||||||
|
|
||||||
DxvkGpuEventHandle handle = m_gpuEvents->allocEvent();
|
DxvkGpuEventHandle handle = m_common->eventPool().allocEvent();
|
||||||
|
|
||||||
m_cmd->cmdSetEvent(handle.event,
|
m_cmd->cmdSetEvent(handle.event,
|
||||||
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
|
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
|
||||||
@ -2501,7 +2485,7 @@ namespace dxvk {
|
|||||||
m_execBarriers.recordCommands(m_cmd);
|
m_execBarriers.recordCommands(m_cmd);
|
||||||
|
|
||||||
// Query pipeline objects to use for this clear operation
|
// Query pipeline objects to use for this clear operation
|
||||||
DxvkMetaClearPipeline pipeInfo = m_metaClear->getClearImagePipeline(
|
DxvkMetaClearPipeline pipeInfo = m_common->metaClear().getClearImagePipeline(
|
||||||
imageView->type(), imageFormatInfo(imageView->info().format)->flags);
|
imageView->type(), imageFormatInfo(imageView->info().format)->flags);
|
||||||
|
|
||||||
// Create a descriptor set pointing to the view
|
// Create a descriptor set pointing to the view
|
||||||
@ -2666,7 +2650,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render target format to use for this copy
|
// Render target format to use for this copy
|
||||||
VkFormat viewFormat = m_metaCopy->getCopyDestinationFormat(
|
VkFormat viewFormat = m_common->metaCopy().getCopyDestinationFormat(
|
||||||
dstSubresource.aspectMask,
|
dstSubresource.aspectMask,
|
||||||
srcSubresource.aspectMask,
|
srcSubresource.aspectMask,
|
||||||
srcImage->info().format);
|
srcImage->info().format);
|
||||||
@ -2769,7 +2753,7 @@ namespace dxvk {
|
|||||||
m_device->vkd(), tgtImageView, srcImageView, srcStencilView,
|
m_device->vkd(), tgtImageView, srcImageView, srcStencilView,
|
||||||
tgtImage->isFullSubresource(tgtSubresource, extent));
|
tgtImage->isFullSubresource(tgtSubresource, extent));
|
||||||
|
|
||||||
auto pipeInfo = m_metaCopy->getPipeline(
|
auto pipeInfo = m_common->metaCopy().getPipeline(
|
||||||
viewType, viewFormat, tgtImage->info().sampleCount);
|
viewType, viewFormat, tgtImage->info().sampleCount);
|
||||||
|
|
||||||
VkDescriptorImageInfo descriptorImage;
|
VkDescriptorImageInfo descriptorImage;
|
||||||
@ -2997,7 +2981,7 @@ namespace dxvk {
|
|||||||
m_device->vkd(), dstImageView, srcImageView,
|
m_device->vkd(), dstImageView, srcImageView,
|
||||||
dstImage->isFullSubresource(region.dstSubresource, region.extent));
|
dstImage->isFullSubresource(region.dstSubresource, region.extent));
|
||||||
|
|
||||||
auto pipeInfo = m_metaResolve->getPipeline(
|
auto pipeInfo = m_common->metaResolve().getPipeline(
|
||||||
format, srcImage->info().sampleCount);
|
format, srcImage->info().sampleCount);
|
||||||
|
|
||||||
VkDescriptorImageInfo descriptorImage;
|
VkDescriptorImageInfo descriptorImage;
|
||||||
@ -3411,7 +3395,7 @@ namespace dxvk {
|
|||||||
m_flags.clr(DxvkContextFlag::CpDirtyPipeline);
|
m_flags.clr(DxvkContextFlag::CpDirtyPipeline);
|
||||||
|
|
||||||
m_state.cp.state.bsBindingMask.clear();
|
m_state.cp.state.bsBindingMask.clear();
|
||||||
m_state.cp.pipeline = m_pipeMgr->createComputePipeline(m_state.cp.shaders);
|
m_state.cp.pipeline = m_common->pipelineManager().createComputePipeline(m_state.cp.shaders);
|
||||||
|
|
||||||
if (m_state.cp.pipeline != nullptr
|
if (m_state.cp.pipeline != nullptr
|
||||||
&& m_state.cp.pipeline->layout()->pushConstRange().size)
|
&& m_state.cp.pipeline->layout()->pushConstRange().size)
|
||||||
@ -3461,8 +3445,8 @@ namespace dxvk {
|
|||||||
m_flags.clr(DxvkContextFlag::GpDirtyPipeline);
|
m_flags.clr(DxvkContextFlag::GpDirtyPipeline);
|
||||||
|
|
||||||
m_state.gp.state.bsBindingMask.clear();
|
m_state.gp.state.bsBindingMask.clear();
|
||||||
m_state.gp.pipeline = m_pipeMgr->createGraphicsPipeline(m_state.gp.shaders);
|
m_state.gp.pipeline = m_common->pipelineManager().createGraphicsPipeline(m_state.gp.shaders);
|
||||||
m_state.gp.flags = DxvkGraphicsPipelineFlags();
|
m_state.gp.flags = DxvkGraphicsPipelineFlags();
|
||||||
|
|
||||||
if (m_state.gp.pipeline != nullptr) {
|
if (m_state.gp.pipeline != nullptr) {
|
||||||
m_state.gp.flags = m_state.gp.pipeline->flags();
|
m_state.gp.flags = m_state.gp.pipeline->flags();
|
||||||
@ -3645,7 +3629,7 @@ namespace dxvk {
|
|||||||
m_cmd->trackResource(res.sampler);
|
m_cmd->trackResource(res.sampler);
|
||||||
} else {
|
} else {
|
||||||
bindMask.clr(i);
|
bindMask.clr(i);
|
||||||
m_descInfos[i].image = m_device->dummySamplerDescriptor();
|
m_descInfos[i].image = m_common->dummyResources().samplerDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||||
@ -3664,7 +3648,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bindMask.clr(i);
|
bindMask.clr(i);
|
||||||
m_descInfos[i].image = m_device->dummyImageViewDescriptor(binding.view);
|
m_descInfos[i].image = m_common->dummyResources().imageViewDescriptor(binding.view);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
||||||
@ -3684,7 +3668,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bindMask.clr(i);
|
bindMask.clr(i);
|
||||||
m_descInfos[i].image = m_device->dummyImageSamplerDescriptor(binding.view);
|
m_descInfos[i].image = m_common->dummyResources().imageSamplerDescriptor(binding.view);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||||
@ -3699,7 +3683,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bindMask.clr(i);
|
bindMask.clr(i);
|
||||||
m_descInfos[i].texelBuffer = m_device->dummyBufferViewDescriptor();
|
m_descInfos[i].texelBuffer = m_common->dummyResources().bufferViewDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
@ -3711,7 +3695,7 @@ namespace dxvk {
|
|||||||
m_cmd->trackResource(res.bufferSlice.buffer());
|
m_cmd->trackResource(res.bufferSlice.buffer());
|
||||||
} else {
|
} else {
|
||||||
bindMask.clr(i);
|
bindMask.clr(i);
|
||||||
m_descInfos[i].buffer = m_device->dummyBufferDescriptor();
|
m_descInfos[i].buffer = m_common->dummyResources().bufferDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||||
@ -3724,7 +3708,7 @@ namespace dxvk {
|
|||||||
m_cmd->trackResource(res.bufferSlice.buffer());
|
m_cmd->trackResource(res.bufferSlice.buffer());
|
||||||
} else {
|
} else {
|
||||||
bindMask.clr(i);
|
bindMask.clr(i);
|
||||||
m_descInfos[i].buffer = m_device->dummyBufferDescriptor();
|
m_descInfos[i].buffer = m_common->dummyResources().bufferDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -3822,7 +3806,7 @@ namespace dxvk {
|
|||||||
m_cmd->trackResource(m_state.vi.indexBuffer.buffer());
|
m_cmd->trackResource(m_state.vi.indexBuffer.buffer());
|
||||||
} else {
|
} else {
|
||||||
m_cmd->cmdBindIndexBuffer(
|
m_cmd->cmdBindIndexBuffer(
|
||||||
m_device->dummyBufferHandle(),
|
m_common->dummyResources().bufferHandle(),
|
||||||
0, VK_INDEX_TYPE_UINT32);
|
0, VK_INDEX_TYPE_UINT32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3852,7 +3836,7 @@ namespace dxvk {
|
|||||||
if (m_vbTracked.set(binding))
|
if (m_vbTracked.set(binding))
|
||||||
m_cmd->trackResource(m_state.vi.vertexBuffers[binding].buffer());
|
m_cmd->trackResource(m_state.vi.vertexBuffers[binding].buffer());
|
||||||
} else {
|
} else {
|
||||||
buffers[i] = m_device->dummyBufferHandle();
|
buffers[i] = m_common->dummyResources().bufferHandle();
|
||||||
offsets[i] = 0;
|
offsets[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3881,7 +3865,7 @@ namespace dxvk {
|
|||||||
xfbLengths[i] = physSlice.length;
|
xfbLengths[i] = physSlice.length;
|
||||||
|
|
||||||
if (physSlice.handle == VK_NULL_HANDLE)
|
if (physSlice.handle == VK_NULL_HANDLE)
|
||||||
xfbBuffers[i] = m_device->dummyBufferHandle();
|
xfbBuffers[i] = m_common->dummyResources().bufferHandle();
|
||||||
|
|
||||||
if (physSlice.handle != VK_NULL_HANDLE) {
|
if (physSlice.handle != VK_NULL_HANDLE) {
|
||||||
auto buffer = m_state.xfb.buffers[i].buffer();
|
auto buffer = m_state.xfb.buffers[i].buffer();
|
||||||
|
@ -5,15 +5,7 @@
|
|||||||
#include "dxvk_cmdlist.h"
|
#include "dxvk_cmdlist.h"
|
||||||
#include "dxvk_context_state.h"
|
#include "dxvk_context_state.h"
|
||||||
#include "dxvk_data.h"
|
#include "dxvk_data.h"
|
||||||
#include "dxvk_gpu_event.h"
|
#include "dxvk_objects.h"
|
||||||
#include "dxvk_gpu_query.h"
|
|
||||||
#include "dxvk_meta_clear.h"
|
|
||||||
#include "dxvk_meta_copy.h"
|
|
||||||
#include "dxvk_meta_mipgen.h"
|
|
||||||
#include "dxvk_meta_pack.h"
|
|
||||||
#include "dxvk_meta_resolve.h"
|
|
||||||
#include "dxvk_pipecache.h"
|
|
||||||
#include "dxvk_pipemanager.h"
|
|
||||||
#include "dxvk_util.h"
|
#include "dxvk_util.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
@ -29,16 +21,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxvkContext(
|
DxvkContext(const Rc<DxvkDevice>& device);
|
||||||
const Rc<DxvkDevice>& device,
|
|
||||||
const Rc<DxvkPipelineManager>& pipelineManager,
|
|
||||||
const Rc<DxvkGpuEventPool>& gpuEventPool,
|
|
||||||
const Rc<DxvkGpuQueryPool>& gpuQueryPool,
|
|
||||||
const Rc<DxvkMetaClearObjects>& metaClearObjects,
|
|
||||||
const Rc<DxvkMetaCopyObjects>& metaCopyObjects,
|
|
||||||
const Rc<DxvkMetaResolveObjects>& metaResolveObjects,
|
|
||||||
const Rc<DxvkMetaMipGenObjects>& metaMipGenObjects,
|
|
||||||
const Rc<DxvkMetaPackObjects>& metaPackObjects);
|
|
||||||
~DxvkContext();
|
~DxvkContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -996,14 +979,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const Rc<DxvkDevice> m_device;
|
Rc<DxvkDevice> m_device;
|
||||||
const Rc<DxvkPipelineManager> m_pipeMgr;
|
DxvkObjects* m_common;
|
||||||
const Rc<DxvkGpuEventPool> m_gpuEvents;
|
|
||||||
const Rc<DxvkMetaClearObjects> m_metaClear;
|
|
||||||
const Rc<DxvkMetaCopyObjects> m_metaCopy;
|
|
||||||
const Rc<DxvkMetaResolveObjects> m_metaResolve;
|
|
||||||
const Rc<DxvkMetaMipGenObjects> m_metaMipGen;
|
|
||||||
const Rc<DxvkMetaPackObjects> m_metaPack;
|
|
||||||
|
|
||||||
Rc<DxvkCommandList> m_cmd;
|
Rc<DxvkCommandList> m_cmd;
|
||||||
Rc<DxvkDescriptorPool> m_descPool;
|
Rc<DxvkDescriptorPool> m_descPool;
|
||||||
|
@ -17,17 +17,7 @@ namespace dxvk {
|
|||||||
m_features (features),
|
m_features (features),
|
||||||
m_properties (adapter->deviceProperties()),
|
m_properties (adapter->deviceProperties()),
|
||||||
m_perfHints (getPerfHints()),
|
m_perfHints (getPerfHints()),
|
||||||
m_memory (new DxvkMemoryAllocator (this)),
|
m_objects (this),
|
||||||
m_renderPassPool (new DxvkRenderPassPool (this)),
|
|
||||||
m_pipelineManager (new DxvkPipelineManager (this, m_renderPassPool.ptr())),
|
|
||||||
m_gpuEventPool (new DxvkGpuEventPool (this)),
|
|
||||||
m_gpuQueryPool (new DxvkGpuQueryPool (this)),
|
|
||||||
m_metaClearObjects (new DxvkMetaClearObjects (this)),
|
|
||||||
m_metaCopyObjects (new DxvkMetaCopyObjects (this)),
|
|
||||||
m_metaResolveObjects(new DxvkMetaResolveObjects (this)),
|
|
||||||
m_metaMipGenObjects (new DxvkMetaMipGenObjects (this)),
|
|
||||||
m_metaPackObjects (new DxvkMetaPackObjects (this)),
|
|
||||||
m_unboundResources (this),
|
|
||||||
m_submissionQueue (this) {
|
m_submissionQueue (this) {
|
||||||
auto queueFamilies = m_adapter->findQueueFamilies();
|
auto queueFamilies = m_adapter->findQueueFamilies();
|
||||||
m_queues.graphics = getQueue(queueFamilies.graphics, 0);
|
m_queues.graphics = getQueue(queueFamilies.graphics, 0);
|
||||||
@ -88,15 +78,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
Rc<DxvkContext> DxvkDevice::createContext() {
|
Rc<DxvkContext> DxvkDevice::createContext() {
|
||||||
return new DxvkContext(this,
|
return new DxvkContext(this);
|
||||||
m_pipelineManager,
|
|
||||||
m_gpuEventPool,
|
|
||||||
m_gpuQueryPool,
|
|
||||||
m_metaClearObjects,
|
|
||||||
m_metaCopyObjects,
|
|
||||||
m_metaResolveObjects,
|
|
||||||
m_metaMipGenObjects,
|
|
||||||
m_metaPackObjects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +103,7 @@ namespace dxvk {
|
|||||||
m_properties.limits.maxFramebufferLayers };
|
m_properties.limits.maxFramebufferLayers };
|
||||||
|
|
||||||
auto renderPassFormat = DxvkFramebuffer::getRenderPassFormat(renderTargets);
|
auto renderPassFormat = DxvkFramebuffer::getRenderPassFormat(renderTargets);
|
||||||
auto renderPassObject = m_renderPassPool->getRenderPass(renderPassFormat);
|
auto renderPassObject = m_objects.renderPassPool().getRenderPass(renderPassFormat);
|
||||||
|
|
||||||
return new DxvkFramebuffer(m_vkd,
|
return new DxvkFramebuffer(m_vkd,
|
||||||
renderPassObject, renderTargets, defaultSize);
|
renderPassObject, renderTargets, defaultSize);
|
||||||
@ -131,7 +113,7 @@ namespace dxvk {
|
|||||||
Rc<DxvkBuffer> DxvkDevice::createBuffer(
|
Rc<DxvkBuffer> DxvkDevice::createBuffer(
|
||||||
const DxvkBufferCreateInfo& createInfo,
|
const DxvkBufferCreateInfo& createInfo,
|
||||||
VkMemoryPropertyFlags memoryType) {
|
VkMemoryPropertyFlags memoryType) {
|
||||||
return new DxvkBuffer(this, createInfo, *m_memory, memoryType);
|
return new DxvkBuffer(this, createInfo, m_objects.memoryManager(), memoryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,7 +127,7 @@ namespace dxvk {
|
|||||||
Rc<DxvkImage> DxvkDevice::createImage(
|
Rc<DxvkImage> DxvkDevice::createImage(
|
||||||
const DxvkImageCreateInfo& createInfo,
|
const DxvkImageCreateInfo& createInfo,
|
||||||
VkMemoryPropertyFlags memoryType) {
|
VkMemoryPropertyFlags memoryType) {
|
||||||
return new DxvkImage(m_vkd, createInfo, *m_memory, memoryType);
|
return new DxvkImage(m_vkd, createInfo, m_objects.memoryManager(), memoryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,15 +158,15 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxvkStatCounters DxvkDevice::getStatCounters() {
|
DxvkStatCounters DxvkDevice::getStatCounters() {
|
||||||
DxvkMemoryStats mem = m_memory->getMemoryStats();
|
DxvkMemoryStats mem = m_objects.memoryManager().getMemoryStats();
|
||||||
DxvkPipelineCount pipe = m_pipelineManager->getPipelineCount();
|
DxvkPipelineCount pipe = m_objects.pipelineManager().getPipelineCount();
|
||||||
|
|
||||||
DxvkStatCounters result;
|
DxvkStatCounters result;
|
||||||
result.setCtr(DxvkStatCounter::MemoryAllocated, mem.memoryAllocated);
|
result.setCtr(DxvkStatCounter::MemoryAllocated, mem.memoryAllocated);
|
||||||
result.setCtr(DxvkStatCounter::MemoryUsed, mem.memoryUsed);
|
result.setCtr(DxvkStatCounter::MemoryUsed, mem.memoryUsed);
|
||||||
result.setCtr(DxvkStatCounter::PipeCountGraphics, pipe.numGraphicsPipelines);
|
result.setCtr(DxvkStatCounter::PipeCountGraphics, pipe.numGraphicsPipelines);
|
||||||
result.setCtr(DxvkStatCounter::PipeCountCompute, pipe.numComputePipelines);
|
result.setCtr(DxvkStatCounter::PipeCountCompute, pipe.numComputePipelines);
|
||||||
result.setCtr(DxvkStatCounter::PipeCompilerBusy, m_pipelineManager->isCompilingShaders());
|
result.setCtr(DxvkStatCounter::PipeCompilerBusy, m_objects.pipelineManager().isCompilingShaders());
|
||||||
result.setCtr(DxvkStatCounter::GpuIdleTicks, m_submissionQueue.gpuIdleTicks());
|
result.setCtr(DxvkStatCounter::GpuIdleTicks, m_submissionQueue.gpuIdleTicks());
|
||||||
|
|
||||||
std::lock_guard<sync::Spinlock> lock(m_statLock);
|
std::lock_guard<sync::Spinlock> lock(m_statLock);
|
||||||
@ -199,12 +181,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxvkDevice::initResources() {
|
void DxvkDevice::initResources() {
|
||||||
m_unboundResources.clearResources(this);
|
m_objects.dummyResources().clearResources(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkDevice::registerShader(const Rc<DxvkShader>& shader) {
|
void DxvkDevice::registerShader(const Rc<DxvkShader>& shader) {
|
||||||
m_pipelineManager->registerShader(shader);
|
m_objects.pipelineManager().registerShader(shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "dxvk_image.h"
|
#include "dxvk_image.h"
|
||||||
#include "dxvk_memory.h"
|
#include "dxvk_memory.h"
|
||||||
#include "dxvk_meta_clear.h"
|
#include "dxvk_meta_clear.h"
|
||||||
|
#include "dxvk_objects.h"
|
||||||
#include "dxvk_options.h"
|
#include "dxvk_options.h"
|
||||||
#include "dxvk_pipecache.h"
|
#include "dxvk_pipecache.h"
|
||||||
#include "dxvk_pipemanager.h"
|
#include "dxvk_pipemanager.h"
|
||||||
@ -433,22 +434,8 @@ namespace dxvk {
|
|||||||
VkPhysicalDeviceProperties m_properties;
|
VkPhysicalDeviceProperties m_properties;
|
||||||
|
|
||||||
DxvkDevicePerfHints m_perfHints;
|
DxvkDevicePerfHints m_perfHints;
|
||||||
|
DxvkObjects m_objects;
|
||||||
Rc<DxvkMemoryAllocator> m_memory;
|
|
||||||
Rc<DxvkRenderPassPool> m_renderPassPool;
|
|
||||||
Rc<DxvkPipelineManager> m_pipelineManager;
|
|
||||||
|
|
||||||
Rc<DxvkGpuEventPool> m_gpuEventPool;
|
|
||||||
Rc<DxvkGpuQueryPool> m_gpuQueryPool;
|
|
||||||
|
|
||||||
Rc<DxvkMetaClearObjects> m_metaClearObjects;
|
|
||||||
Rc<DxvkMetaCopyObjects> m_metaCopyObjects;
|
|
||||||
Rc<DxvkMetaResolveObjects> m_metaResolveObjects;
|
|
||||||
Rc<DxvkMetaMipGenObjects> m_metaMipGenObjects;
|
|
||||||
Rc<DxvkMetaPackObjects> m_metaPackObjects;
|
|
||||||
|
|
||||||
DxvkUnboundResources m_unboundResources;
|
|
||||||
|
|
||||||
sync::Spinlock m_statLock;
|
sync::Spinlock m_statLock;
|
||||||
DxvkStatCounters m_statCounters;
|
DxvkStatCounters m_statCounters;
|
||||||
|
|
||||||
@ -471,58 +458,6 @@ namespace dxvk {
|
|||||||
uint32_t family,
|
uint32_t family,
|
||||||
uint32_t index) const;
|
uint32_t index) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Dummy buffer handle
|
|
||||||
* \returns Use for unbound vertex buffers.
|
|
||||||
*/
|
|
||||||
VkBuffer dummyBufferHandle() const {
|
|
||||||
return m_unboundResources.bufferHandle();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Dummy buffer descriptor
|
|
||||||
* \returns Descriptor that points to a dummy buffer
|
|
||||||
*/
|
|
||||||
VkDescriptorBufferInfo dummyBufferDescriptor() const {
|
|
||||||
return m_unboundResources.bufferDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Dummy buffer view descriptor
|
|
||||||
* \returns Dummy buffer view handle
|
|
||||||
*/
|
|
||||||
VkBufferView dummyBufferViewDescriptor() const {
|
|
||||||
return m_unboundResources.bufferViewDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Dummy sampler descriptor
|
|
||||||
* \returns Descriptor that points to a dummy sampler
|
|
||||||
*/
|
|
||||||
VkDescriptorImageInfo dummySamplerDescriptor() const {
|
|
||||||
return m_unboundResources.samplerDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Dummy image view descriptor
|
|
||||||
*
|
|
||||||
* \param [in] type Required view type
|
|
||||||
* \returns Descriptor that points to a dummy image
|
|
||||||
*/
|
|
||||||
VkDescriptorImageInfo dummyImageViewDescriptor(VkImageViewType type) const {
|
|
||||||
return m_unboundResources.imageViewDescriptor(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Dummy combined image sampler descriptor
|
|
||||||
*
|
|
||||||
* \param [in] type Required view type
|
|
||||||
* \returns Descriptor that points to a dummy image
|
|
||||||
*/
|
|
||||||
VkDescriptorImageInfo dummyImageSamplerDescriptor(VkImageViewType type) const {
|
|
||||||
return m_unboundResources.imageSamplerDescriptor(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -287,9 +287,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
DxvkGpuQueryManager::DxvkGpuQueryManager(
|
DxvkGpuQueryManager::DxvkGpuQueryManager(DxvkGpuQueryPool& pool)
|
||||||
const Rc<DxvkGpuQueryPool>& pool)
|
: m_pool(&pool), m_activeTypes(0) {
|
||||||
: m_pool(pool), m_activeTypes(0) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,8 +331,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxvkGpuQueryManager(
|
DxvkGpuQueryManager(DxvkGpuQueryPool& pool);
|
||||||
const Rc<DxvkGpuQueryPool>& pool);
|
|
||||||
|
|
||||||
~DxvkGpuQueryManager();
|
~DxvkGpuQueryManager();
|
||||||
|
|
||||||
@ -397,7 +396,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Rc<DxvkGpuQueryPool> m_pool;
|
DxvkGpuQueryPool* m_pool;
|
||||||
uint32_t m_activeTypes;
|
uint32_t m_activeTypes;
|
||||||
std::vector<Rc<DxvkGpuQuery>> m_activeQueries;
|
std::vector<Rc<DxvkGpuQuery>> m_activeQueries;
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "dxvk_sampler.h"
|
#include "dxvk_sampler.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
class DxvkContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Unbound resources
|
* \brief Unbound resources
|
||||||
|
Loading…
x
Reference in New Issue
Block a user