mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 22:54:16 +01:00
[dxvk] Don't use reference counting for pipeline objects
Again not necessary since these objects are persistent. Eliminates refcount overhead of pipeline lookups entirely.
This commit is contained in:
parent
8cd13cc5bd
commit
eaa41eb76c
@ -42,7 +42,7 @@ namespace dxvk {
|
||||
* pipelines do not need to be recompiled against any sort
|
||||
* of pipeline state.
|
||||
*/
|
||||
class DxvkComputePipeline : public RcObject {
|
||||
class DxvkComputePipeline {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -117,14 +117,14 @@ namespace dxvk {
|
||||
DxvkGraphicsPipelineShaders shaders;
|
||||
DxvkGraphicsPipelineStateInfo state;
|
||||
DxvkGraphicsPipelineFlags flags;
|
||||
Rc<DxvkGraphicsPipeline> pipeline;
|
||||
DxvkGraphicsPipeline* pipeline = nullptr;
|
||||
};
|
||||
|
||||
|
||||
struct DxvkComputePipelineState {
|
||||
DxvkComputePipelineShaders shaders;
|
||||
DxvkComputePipelineStateInfo state;
|
||||
Rc<DxvkComputePipeline> pipeline;
|
||||
DxvkComputePipeline* pipeline = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -198,7 +198,7 @@ namespace dxvk {
|
||||
* recompile the graphics pipeline against a given
|
||||
* pipeline state vector.
|
||||
*/
|
||||
class DxvkGraphicsPipeline : public RcObject {
|
||||
class DxvkGraphicsPipeline {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkComputePipeline> DxvkPipelineManager::createComputePipeline(
|
||||
DxvkComputePipeline* DxvkPipelineManager::createComputePipeline(
|
||||
const DxvkComputePipelineShaders& shaders) {
|
||||
if (shaders.cs == nullptr)
|
||||
return nullptr;
|
||||
@ -65,16 +65,17 @@ namespace dxvk {
|
||||
|
||||
auto pair = m_computePipelines.find(shaders);
|
||||
if (pair != m_computePipelines.end())
|
||||
return pair->second;
|
||||
return &pair->second;
|
||||
|
||||
Rc<DxvkComputePipeline> pipeline = new DxvkComputePipeline(this, shaders);
|
||||
|
||||
m_computePipelines.insert(std::make_pair(shaders, pipeline));
|
||||
return pipeline;
|
||||
auto iter = m_computePipelines.emplace(
|
||||
std::piecewise_construct,
|
||||
std::tuple(shaders),
|
||||
std::tuple(this, shaders));
|
||||
return &iter.first->second;
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkGraphicsPipeline> DxvkPipelineManager::createGraphicsPipeline(
|
||||
DxvkGraphicsPipeline* DxvkPipelineManager::createGraphicsPipeline(
|
||||
const DxvkGraphicsPipelineShaders& shaders) {
|
||||
if (shaders.vs == nullptr)
|
||||
return nullptr;
|
||||
@ -83,12 +84,13 @@ namespace dxvk {
|
||||
|
||||
auto pair = m_graphicsPipelines.find(shaders);
|
||||
if (pair != m_graphicsPipelines.end())
|
||||
return pair->second;
|
||||
return &pair->second;
|
||||
|
||||
Rc<DxvkGraphicsPipeline> pipeline = new DxvkGraphicsPipeline(this, shaders);
|
||||
|
||||
m_graphicsPipelines.insert(std::make_pair(shaders, pipeline));
|
||||
return pipeline;
|
||||
auto iter = m_graphicsPipelines.emplace(
|
||||
std::piecewise_construct,
|
||||
std::tuple(shaders),
|
||||
std::tuple(this, shaders));
|
||||
return &iter.first->second;
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace dxvk {
|
||||
* \param [in] shaders Shaders for the pipeline
|
||||
* \returns Compute pipeline object
|
||||
*/
|
||||
Rc<DxvkComputePipeline> createComputePipeline(
|
||||
DxvkComputePipeline* createComputePipeline(
|
||||
const DxvkComputePipelineShaders& shaders);
|
||||
|
||||
/**
|
||||
@ -75,7 +75,7 @@ namespace dxvk {
|
||||
* \param [in] shaders Shaders for the pipeline
|
||||
* \returns Graphics pipeline object
|
||||
*/
|
||||
Rc<DxvkGraphicsPipeline> createGraphicsPipeline(
|
||||
DxvkGraphicsPipeline* createGraphicsPipeline(
|
||||
const DxvkGraphicsPipelineShaders& shaders);
|
||||
|
||||
/*
|
||||
@ -114,13 +114,13 @@ namespace dxvk {
|
||||
|
||||
std::unordered_map<
|
||||
DxvkComputePipelineShaders,
|
||||
Rc<DxvkComputePipeline>,
|
||||
DxvkComputePipeline,
|
||||
DxvkPipelineKeyHash,
|
||||
DxvkPipelineKeyEq> m_computePipelines;
|
||||
|
||||
std::unordered_map<
|
||||
DxvkGraphicsPipelineShaders,
|
||||
Rc<DxvkGraphicsPipeline>,
|
||||
DxvkGraphicsPipeline,
|
||||
DxvkPipelineKeyHash,
|
||||
DxvkPipelineKeyEq> m_graphicsPipelines;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user