1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[dxvk] Remove in-memory pipeline cache

Doesn't really do much and only prevents Nvidia's disk cache
from working on 515.49.06 drivers.
This commit is contained in:
Philip Rebohle 2022-07-08 19:25:19 +02:00
parent 645886db8d
commit f4fd8c6c65
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
12 changed files with 17 additions and 99 deletions

View File

@ -17,7 +17,6 @@ namespace dxvk {
DxvkBindingLayoutObjects* layout,
DxvkShaderPipelineLibrary* library)
: m_device (device),
m_cache (&pipeMgr->m_cache),
m_stateCache (&pipeMgr->m_stateCache),
m_stats (&pipeMgr->m_stats),
m_library (library),
@ -130,7 +129,7 @@ namespace dxvk {
VkPipeline pipeline = VK_NULL_HANDLE;
if (vk->vkCreateComputePipelines(vk->device(),
m_cache->handle(), 1, &info, nullptr, &pipeline) != VK_SUCCESS) {
VK_NULL_HANDLE, 1, &info, nullptr, &pipeline) != VK_SUCCESS) {
Logger::err("DxvkComputePipeline: Failed to compile pipeline");
Logger::err(str::format(" cs : ", m_shaders.cs->debugName()));
return VK_NULL_HANDLE;

View File

@ -6,7 +6,6 @@
#include "dxvk_bind_mask.h"
#include "dxvk_graphics_state.h"
#include "dxvk_pipecache.h"
#include "dxvk_pipelayout.h"
#include "dxvk_resource.h"
#include "dxvk_shader.h"
@ -114,7 +113,6 @@ namespace dxvk {
private:
DxvkDevice* m_device;
DxvkPipelineCache* m_cache;
DxvkStateCache* m_stateCache;
DxvkPipelineStats* m_stats;

View File

@ -13,7 +13,6 @@
#include "dxvk_meta_clear.h"
#include "dxvk_objects.h"
#include "dxvk_options.h"
#include "dxvk_pipecache.h"
#include "dxvk_pipemanager.h"
#include "dxvk_queue.h"
#include "dxvk_recycler.h"

View File

@ -137,8 +137,7 @@ namespace dxvk {
DxvkGraphicsPipelineVertexInputLibrary::DxvkGraphicsPipelineVertexInputLibrary(
DxvkDevice* device,
const DxvkGraphicsPipelineVertexInputState& state,
VkPipelineCache cache)
const DxvkGraphicsPipelineVertexInputState& state)
: m_device(device) {
auto vk = m_device->vkd();
@ -152,7 +151,7 @@ namespace dxvk {
info.basePipelineIndex = -1;
VkResult vr = vk->vkCreateGraphicsPipelines(vk->device(),
cache, 1, &info, nullptr, &m_pipeline);
VK_NULL_HANDLE, 1, &info, nullptr, &m_pipeline);
if (vr)
throw DxvkError("Failed to create vertex input pipeline library");
@ -341,8 +340,7 @@ namespace dxvk {
DxvkGraphicsPipelineFragmentOutputLibrary::DxvkGraphicsPipelineFragmentOutputLibrary(
DxvkDevice* device,
const DxvkGraphicsPipelineFragmentOutputState& state,
VkPipelineCache cache)
const DxvkGraphicsPipelineFragmentOutputState& state)
: m_device(device) {
auto vk = m_device->vkd();
@ -368,7 +366,7 @@ namespace dxvk {
info.basePipelineIndex = -1;
VkResult vr = vk->vkCreateGraphicsPipelines(vk->device(),
cache, 1, &info, nullptr, &m_pipeline);
VK_NULL_HANDLE, 1, &info, nullptr, &m_pipeline);
if (vr)
throw DxvkError("Failed to create vertex input pipeline library");
@ -467,7 +465,6 @@ namespace dxvk {
: m_device (device),
m_manager (pipeMgr),
m_workers (&pipeMgr->m_workers),
m_cache (&pipeMgr->m_cache),
m_stateCache (&pipeMgr->m_stateCache),
m_stats (&pipeMgr->m_stats),
m_shaders (std::move(shaders)),
@ -722,7 +719,7 @@ namespace dxvk {
VkPipeline pipeline = VK_NULL_HANDLE;
if ((vk->vkCreateGraphicsPipelines(vk->device(), m_cache->handle(), 1, &info, nullptr, &pipeline)))
if ((vk->vkCreateGraphicsPipelines(vk->device(), VK_NULL_HANDLE, 1, &info, nullptr, &pipeline)))
Logger::err("DxvkGraphicsPipeline: Failed to create base pipeline");
return pipeline;
@ -814,7 +811,7 @@ namespace dxvk {
info.pTessellationState = nullptr;
VkPipeline pipeline = VK_NULL_HANDLE;
if (vk->vkCreateGraphicsPipelines(vk->device(), m_cache->handle(), 1, &info, nullptr, &pipeline) != VK_SUCCESS) {
if (vk->vkCreateGraphicsPipelines(vk->device(), VK_NULL_HANDLE, 1, &info, nullptr, &pipeline) != VK_SUCCESS) {
Logger::err("DxvkGraphicsPipeline: Failed to compile pipeline");
this->logPipelineState(LogLevel::Error, state);
return VK_NULL_HANDLE;

View File

@ -7,7 +7,6 @@
#include "dxvk_bind_mask.h"
#include "dxvk_constant_state.h"
#include "dxvk_graphics_state.h"
#include "dxvk_pipecache.h"
#include "dxvk_pipelayout.h"
#include "dxvk_renderpass.h"
#include "dxvk_resource.h"
@ -62,8 +61,7 @@ namespace dxvk {
DxvkGraphicsPipelineVertexInputLibrary(
DxvkDevice* device,
const DxvkGraphicsPipelineVertexInputState& state,
VkPipelineCache cache);
const DxvkGraphicsPipelineVertexInputState& state);
~DxvkGraphicsPipelineVertexInputLibrary();
@ -122,8 +120,7 @@ namespace dxvk {
DxvkGraphicsPipelineFragmentOutputLibrary(
DxvkDevice* device,
const DxvkGraphicsPipelineFragmentOutputState& state,
VkPipelineCache cache);
const DxvkGraphicsPipelineFragmentOutputState& state);
~DxvkGraphicsPipelineFragmentOutputLibrary();
@ -392,7 +389,6 @@ namespace dxvk {
DxvkDevice* m_device;
DxvkPipelineManager* m_manager;
DxvkPipelineWorkers* m_workers;
DxvkPipelineCache* m_cache;
DxvkStateCache* m_stateCache;
DxvkPipelineStats* m_stats;

View File

@ -1,24 +0,0 @@
#include "dxvk_pipecache.h"
#include "dxvk_device.h"
namespace dxvk {
DxvkPipelineCache::DxvkPipelineCache(DxvkDevice* device)
: m_device(device) {
auto vk = m_device->vkd();
// It's not critical if this fails since this is only an in-memory cache
VkPipelineCacheCreateInfo info = { VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO };
if (vk->vkCreatePipelineCache(vk->device(), &info, nullptr, &m_handle))
Logger::err("DxvkPipelineCache: Failed to create cache");
}
DxvkPipelineCache::~DxvkPipelineCache() {
auto vk = m_device->vkd();
vk->vkDestroyPipelineCache(vk->device(), m_handle, nullptr);
}
}

View File

@ -1,37 +0,0 @@
#pragma once
#include "dxvk_include.h"
namespace dxvk {
class DxvkDevice;
/**
* \brief Pipeline cache
*
* Allows the Vulkan implementation to
* re-use previously compiled pipelines.
*/
class DxvkPipelineCache {
public:
DxvkPipelineCache(DxvkDevice* device);
~DxvkPipelineCache();
/**
* \brief Pipeline cache handle
* \returns Pipeline cache handle
*/
VkPipelineCache handle() const {
return m_handle;
}
private:
DxvkDevice* m_device;
VkPipelineCache m_handle = VK_NULL_HANDLE;
};
}

View File

@ -7,9 +7,7 @@
namespace dxvk {
DxvkPipelineWorkers::DxvkPipelineWorkers(
DxvkDevice* device,
DxvkPipelineCache* cache)
: m_cache(cache) {
DxvkDevice* device) {
// Use a reasonably large number of threads for compiling, but
// leave some cores to the application to avoid excessive stutter
uint32_t numCpuCores = dxvk::thread::hardware_concurrency();
@ -164,8 +162,7 @@ namespace dxvk {
DxvkPipelineManager::DxvkPipelineManager(
DxvkDevice* device)
: m_device (device),
m_cache (device),
m_workers (device, &m_cache),
m_workers (device),
m_stateCache(device, this, &m_workers) {
Logger::info(str::format("DXVK: Graphics pipeline libraries ",
(m_device->canUseGraphicsPipelineLibrary() ? "supported" : "not supported")));
@ -260,7 +257,7 @@ namespace dxvk {
auto iter = m_vertexInputLibraries.emplace(
std::piecewise_construct,
std::tuple(state),
std::tuple(m_device, state, m_cache.handle()));
std::tuple(m_device, state));
return &iter.first->second;
}
@ -276,7 +273,7 @@ namespace dxvk {
auto iter = m_fragmentOutputLibraries.emplace(
std::piecewise_construct,
std::tuple(state),
std::tuple(m_device, state, m_cache.handle()));
std::tuple(m_device, state));
return &iter.first->second;
}

View File

@ -45,8 +45,7 @@ namespace dxvk {
public:
DxvkPipelineWorkers(
DxvkDevice* device,
DxvkPipelineCache* cache);
DxvkDevice* device);
~DxvkPipelineWorkers();
@ -108,7 +107,6 @@ namespace dxvk {
DxvkShaderPipelineLibrary* pipelineLibrary;
};
DxvkPipelineCache* m_cache;
std::atomic<uint64_t> m_pendingTasks = { 0ull };
dxvk::mutex m_queueLock;
@ -223,7 +221,6 @@ namespace dxvk {
private:
DxvkDevice* m_device;
DxvkPipelineCache m_cache;
DxvkPipelineWorkers m_workers;
DxvkStateCache m_stateCache;
DxvkPipelineStats m_stats;

View File

@ -431,7 +431,6 @@ namespace dxvk {
const DxvkShader* shader,
const DxvkBindingLayoutObjects* layout)
: m_device (device),
m_cache (&manager->m_cache),
m_stats (&manager->m_stats),
m_shader (shader),
m_layout (layout) {
@ -559,7 +558,7 @@ namespace dxvk {
VkPipeline pipeline = VK_NULL_HANDLE;
if (vk->vkCreateGraphicsPipelines(vk->device(), m_cache->handle(), 1, &info, nullptr, &pipeline))
if (vk->vkCreateGraphicsPipelines(vk->device(), VK_NULL_HANDLE, 1, &info, nullptr, &pipeline))
throw DxvkError("DxvkShaderPipelineLibrary: Failed to create compute pipeline");
return pipeline;
@ -640,7 +639,7 @@ namespace dxvk {
VkPipeline pipeline = VK_NULL_HANDLE;
if (vk->vkCreateGraphicsPipelines(vk->device(), m_cache->handle(), 1, &info, nullptr, &pipeline))
if (vk->vkCreateGraphicsPipelines(vk->device(), VK_NULL_HANDLE, 1, &info, nullptr, &pipeline))
throw DxvkError("DxvkShaderPipelineLibrary: Failed to create compute pipeline");
return pipeline;
@ -662,7 +661,7 @@ namespace dxvk {
VkPipeline pipeline = VK_NULL_HANDLE;
if (vk->vkCreateComputePipelines(vk->device(), m_cache->handle(), 1, &info, nullptr, &pipeline))
if (vk->vkCreateComputePipelines(vk->device(), VK_NULL_HANDLE, 1, &info, nullptr, &pipeline))
throw DxvkError("DxvkShaderPipelineLibrary: Failed to create compute pipeline");
return pipeline;

View File

@ -4,7 +4,6 @@
#include "dxvk_include.h"
#include "dxvk_limits.h"
#include "dxvk_pipecache.h"
#include "dxvk_pipelayout.h"
#include "dxvk_shader_key.h"
@ -367,7 +366,6 @@ namespace dxvk {
private:
const DxvkDevice* m_device;
DxvkPipelineCache* m_cache;
DxvkPipelineStats* m_stats;
const DxvkShader* m_shader;
const DxvkBindingLayoutObjects* m_layout;

View File

@ -91,7 +91,6 @@ dxvk_src = files([
'dxvk_openvr.cpp',
'dxvk_openxr.cpp',
'dxvk_options.cpp',
'dxvk_pipecache.cpp',
'dxvk_pipelayout.cpp',
'dxvk_pipemanager.cpp',
'dxvk_queue.cpp',