[dxvk] Remove asynchronous pipeline compiler

This commit is contained in:
Philip Rebohle 2018-09-13 21:39:56 +02:00
parent d4947261c6
commit 18927dc958
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
9 changed files with 14 additions and 90 deletions

View File

@ -397,7 +397,7 @@ namespace dxvk {
const Rc<DxvkImageView>& imageView,
VkImageAspectFlags clearAspects,
const VkClearValue& clearValue) {
this->updateFramebuffer(false);
this->updateFramebuffer();
// Prepare attachment ops
DxvkColorAttachmentOps colorOp;
@ -1639,7 +1639,7 @@ namespace dxvk {
VkOffset3D offset,
VkExtent3D extent,
VkClearValue value) {
this->updateFramebuffer(false);
this->updateFramebuffer();
// Find out if the render target view is currently bound,
// so that we can avoid spilling the render pass if it is.
@ -1974,8 +1974,7 @@ namespace dxvk {
m_gpActivePipeline = m_state.gp.pipeline != nullptr && m_state.om.framebuffer != nullptr
? m_state.gp.pipeline->getPipelineHandle(m_state.gp.state,
m_state.om.framebuffer->getRenderPass(), m_cmd->statCounters(),
this->checkAsyncCompilationCompat())
m_state.om.framebuffer->getRenderPass(), m_cmd->statCounters())
: VK_NULL_HANDLE;
if (m_gpActivePipeline != VK_NULL_HANDLE) {
@ -2234,7 +2233,7 @@ namespace dxvk {
}
void DxvkContext::updateFramebuffer(bool isDraw) {
void DxvkContext::updateFramebuffer() {
if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer)) {
m_flags.clr(DxvkContextFlag::GpDirtyFramebuffer);
@ -2253,11 +2252,6 @@ namespace dxvk {
: VkComponentMapping();
}
if (isDraw) {
for (uint32_t i = 0; i < fb->numAttachments(); i++)
fb->getAttachment(i).view->setRtBindingFrameId(m_device->getCurrentFrameId());
}
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
}
}
@ -2399,7 +2393,7 @@ namespace dxvk {
void DxvkContext::commitGraphicsState() {
this->updateFramebuffer(true);
this->updateFramebuffer();
this->startRenderPass();
this->updateGraphicsPipeline();
this->updateIndexBufferBinding();
@ -2525,17 +2519,5 @@ namespace dxvk {
}
}
}
bool DxvkContext::checkAsyncCompilationCompat() {
bool fbCompat = m_device->config().asyncPipeCompiler;
for (uint32_t i = 0; fbCompat && i < m_state.om.framebuffer->numAttachments(); i++) {
const auto& attachment = m_state.om.framebuffer->getAttachment(i);
fbCompat &= attachment.view->getRtBindingAsyncCompilationCompat();
}
return fbCompat;
}
}

View File

@ -713,7 +713,7 @@ namespace dxvk {
VkDescriptorSet set,
const DxvkPipelineLayout* layout);
void updateFramebuffer(bool isDraw);
void updateFramebuffer();
void updateIndexBufferBinding();
void updateVertexBufferBindings();
@ -729,8 +729,6 @@ namespace dxvk {
void commitComputeInitBarriers();
void commitComputePostBarriers();
bool checkAsyncCompilationCompat();
Rc<DxvkBuffer> getTransferBuffer(VkDeviceSize size);
};

View File

@ -56,14 +56,12 @@ namespace dxvk {
DxvkGraphicsPipeline::DxvkGraphicsPipeline(
const DxvkDevice* device,
const Rc<DxvkPipelineCache>& cache,
const Rc<DxvkPipelineCompiler>& compiler,
const Rc<DxvkShader>& vs,
const Rc<DxvkShader>& tcs,
const Rc<DxvkShader>& tes,
const Rc<DxvkShader>& gs,
const Rc<DxvkShader>& fs)
: m_device(device), m_vkd(device->vkd()),
m_cache(cache), m_compiler(compiler) {
: m_device(device), m_vkd(device->vkd()), m_cache(cache) {
DxvkDescriptorSlotMapping slotMapping;
if (vs != nullptr) vs ->defineResourceSlots(slotMapping);
if (tcs != nullptr) tcs->defineResourceSlots(slotMapping);
@ -102,8 +100,7 @@ namespace dxvk {
VkPipeline DxvkGraphicsPipeline::getPipelineHandle(
const DxvkGraphicsPipelineStateInfo& state,
const DxvkRenderPass& renderPass,
DxvkStatCounters& stats,
bool async) {
DxvkStatCounters& stats) {
VkRenderPass renderPassHandle = renderPass.getDefaultHandle();
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
@ -123,12 +120,8 @@ namespace dxvk {
// If no pipeline instance exists with the given state
// vector, create a new one and add it to the list.
VkPipeline newPipelineBase = m_basePipeline.load();
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
if (!async) {
newPipelineHandle = this->compilePipeline(
state, renderPassHandle, newPipelineBase);
}
VkPipeline newPipelineHandle = this->compilePipeline(
state, renderPassHandle, newPipelineBase);
Rc<DxvkGraphicsPipelineInstance> newPipeline =
new DxvkGraphicsPipelineInstance(m_device->vkd(),
@ -154,10 +147,6 @@ namespace dxvk {
if (newPipelineBase == VK_NULL_HANDLE && newPipelineHandle != VK_NULL_HANDLE)
m_basePipeline.compare_exchange_strong(newPipelineBase, newPipelineHandle);
// Compile pipeline asynchronously if requested
if (async)
m_compiler->queueCompilation(this, newPipeline);
return newPipelineHandle;
}

View File

@ -167,7 +167,6 @@ namespace dxvk {
DxvkGraphicsPipeline(
const DxvkDevice* device,
const Rc<DxvkPipelineCache>& cache,
const Rc<DxvkPipelineCompiler>& compiler,
const Rc<DxvkShader>& vs,
const Rc<DxvkShader>& tcs,
const Rc<DxvkShader>& tes,
@ -195,14 +194,12 @@ namespace dxvk {
* \param [in] state Pipeline state vector
* \param [in] renderPass The render pass
* \param [in,out] stats Stat counter
* \param [in] async Compile asynchronously
* \returns Pipeline handle
*/
VkPipeline getPipelineHandle(
const DxvkGraphicsPipelineStateInfo& state,
const DxvkRenderPass& renderPass,
DxvkStatCounters& stats,
bool async);
DxvkStatCounters& stats);
/**
* \brief Compiles optimized pipeline
@ -226,7 +223,6 @@ namespace dxvk {
const Rc<vk::DeviceFn> m_vkd;
Rc<DxvkPipelineCache> m_cache;
Rc<DxvkPipelineCompiler> m_compiler;
Rc<DxvkPipelineLayout> m_layout;
Rc<DxvkShaderModule> m_vs;

View File

@ -377,37 +377,6 @@ namespace dxvk {
return m_image->pickLayout(layout);
}
/**
* \brief Sets render target usage frame number
*
* The image view will track internally when
* it was last used as a render target. This
* info is used for async shader compilation.
* \param [in] frameId Frame number
*/
void setRtBindingFrameId(uint32_t frameId) {
if (frameId != m_rtBindingFrameId) {
if (frameId == m_rtBindingFrameId + 1)
m_rtBindingFrameCount += 1;
else
m_rtBindingFrameCount = 0;
m_rtBindingFrameId = frameId;
}
}
/**
* \brief Checks for async pipeline compatibility
*
* Asynchronous pipeline compilation may be enabled if the
* render target has been drawn to in the previous frames.
* \param [in] frameId Current frame ID
* \returns \c true if async compilation is supported
*/
bool getRtBindingAsyncCompilationCompat() const {
return m_rtBindingFrameCount >= 5;
}
private:
Rc<vk::DeviceFn> m_vkd;
@ -416,9 +385,6 @@ namespace dxvk {
DxvkImageViewCreateInfo m_info;
VkImageView m_views[ViewCount];
uint32_t m_rtBindingFrameId = 0;
uint32_t m_rtBindingFrameCount = 0;
void createView(VkImageViewType type, uint32_t numLayers);
};

View File

@ -4,7 +4,6 @@ namespace dxvk {
DxvkOptions::DxvkOptions(const Config& config) {
allowMemoryOvercommit = config.getOption<bool>("dxvk.allowMemoryOvercommit", false);
asyncPipeCompiler = false; // config.getOption<bool>("dxvk.asyncPipeCompiler", false);
}
}

View File

@ -10,9 +10,6 @@ namespace dxvk {
/// Allow allocating more memory from
/// a heap than the device supports.
bool allowMemoryOvercommit;
/// Enable asynchronous pipeline compilation.
bool asyncPipeCompiler;
};
}

View File

@ -40,10 +40,8 @@ namespace dxvk {
DxvkPipelineManager::DxvkPipelineManager(const DxvkDevice* device)
: m_device (device),
m_cache (new DxvkPipelineCache(device->vkd())),
m_compiler(nullptr) {
if (m_device->config().asyncPipeCompiler)
m_compiler = new DxvkPipelineCompiler();
m_cache (new DxvkPipelineCache(device->vkd())) {
}
@ -97,7 +95,7 @@ namespace dxvk {
return pair->second;
Rc<DxvkGraphicsPipeline> pipeline = new DxvkGraphicsPipeline(
m_device, m_cache, m_compiler, vs, tcs, tes, gs, fs);
m_device, m_cache, vs, tcs, tes, gs, fs);
m_graphicsPipelines.insert(std::make_pair(key, pipeline));
return pipeline;

View File

@ -99,7 +99,6 @@ namespace dxvk {
const DxvkDevice* m_device;
Rc<DxvkPipelineCache> m_cache;
Rc<DxvkPipelineCompiler> m_compiler;
std::mutex m_mutex;