mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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
|
* pipelines do not need to be recompiled against any sort
|
||||||
* of pipeline state.
|
* of pipeline state.
|
||||||
*/
|
*/
|
||||||
class DxvkComputePipeline : public RcObject {
|
class DxvkComputePipeline {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -117,14 +117,14 @@ namespace dxvk {
|
|||||||
DxvkGraphicsPipelineShaders shaders;
|
DxvkGraphicsPipelineShaders shaders;
|
||||||
DxvkGraphicsPipelineStateInfo state;
|
DxvkGraphicsPipelineStateInfo state;
|
||||||
DxvkGraphicsPipelineFlags flags;
|
DxvkGraphicsPipelineFlags flags;
|
||||||
Rc<DxvkGraphicsPipeline> pipeline;
|
DxvkGraphicsPipeline* pipeline = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct DxvkComputePipelineState {
|
struct DxvkComputePipelineState {
|
||||||
DxvkComputePipelineShaders shaders;
|
DxvkComputePipelineShaders shaders;
|
||||||
DxvkComputePipelineStateInfo state;
|
DxvkComputePipelineStateInfo state;
|
||||||
Rc<DxvkComputePipeline> pipeline;
|
DxvkComputePipeline* pipeline = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ namespace dxvk {
|
|||||||
* recompile the graphics pipeline against a given
|
* recompile the graphics pipeline against a given
|
||||||
* pipeline state vector.
|
* pipeline state vector.
|
||||||
*/
|
*/
|
||||||
class DxvkGraphicsPipeline : public RcObject {
|
class DxvkGraphicsPipeline {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rc<DxvkComputePipeline> DxvkPipelineManager::createComputePipeline(
|
DxvkComputePipeline* DxvkPipelineManager::createComputePipeline(
|
||||||
const DxvkComputePipelineShaders& shaders) {
|
const DxvkComputePipelineShaders& shaders) {
|
||||||
if (shaders.cs == nullptr)
|
if (shaders.cs == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -65,16 +65,17 @@ namespace dxvk {
|
|||||||
|
|
||||||
auto pair = m_computePipelines.find(shaders);
|
auto pair = m_computePipelines.find(shaders);
|
||||||
if (pair != m_computePipelines.end())
|
if (pair != m_computePipelines.end())
|
||||||
return pair->second;
|
return &pair->second;
|
||||||
|
|
||||||
Rc<DxvkComputePipeline> pipeline = new DxvkComputePipeline(this, shaders);
|
auto iter = m_computePipelines.emplace(
|
||||||
|
std::piecewise_construct,
|
||||||
m_computePipelines.insert(std::make_pair(shaders, pipeline));
|
std::tuple(shaders),
|
||||||
return pipeline;
|
std::tuple(this, shaders));
|
||||||
|
return &iter.first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rc<DxvkGraphicsPipeline> DxvkPipelineManager::createGraphicsPipeline(
|
DxvkGraphicsPipeline* DxvkPipelineManager::createGraphicsPipeline(
|
||||||
const DxvkGraphicsPipelineShaders& shaders) {
|
const DxvkGraphicsPipelineShaders& shaders) {
|
||||||
if (shaders.vs == nullptr)
|
if (shaders.vs == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -83,12 +84,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
auto pair = m_graphicsPipelines.find(shaders);
|
auto pair = m_graphicsPipelines.find(shaders);
|
||||||
if (pair != m_graphicsPipelines.end())
|
if (pair != m_graphicsPipelines.end())
|
||||||
return pair->second;
|
return &pair->second;
|
||||||
|
|
||||||
Rc<DxvkGraphicsPipeline> pipeline = new DxvkGraphicsPipeline(this, shaders);
|
auto iter = m_graphicsPipelines.emplace(
|
||||||
|
std::piecewise_construct,
|
||||||
m_graphicsPipelines.insert(std::make_pair(shaders, pipeline));
|
std::tuple(shaders),
|
||||||
return pipeline;
|
std::tuple(this, shaders));
|
||||||
|
return &iter.first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace dxvk {
|
|||||||
* \param [in] shaders Shaders for the pipeline
|
* \param [in] shaders Shaders for the pipeline
|
||||||
* \returns Compute pipeline object
|
* \returns Compute pipeline object
|
||||||
*/
|
*/
|
||||||
Rc<DxvkComputePipeline> createComputePipeline(
|
DxvkComputePipeline* createComputePipeline(
|
||||||
const DxvkComputePipelineShaders& shaders);
|
const DxvkComputePipelineShaders& shaders);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,7 +75,7 @@ namespace dxvk {
|
|||||||
* \param [in] shaders Shaders for the pipeline
|
* \param [in] shaders Shaders for the pipeline
|
||||||
* \returns Graphics pipeline object
|
* \returns Graphics pipeline object
|
||||||
*/
|
*/
|
||||||
Rc<DxvkGraphicsPipeline> createGraphicsPipeline(
|
DxvkGraphicsPipeline* createGraphicsPipeline(
|
||||||
const DxvkGraphicsPipelineShaders& shaders);
|
const DxvkGraphicsPipelineShaders& shaders);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -114,13 +114,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
std::unordered_map<
|
std::unordered_map<
|
||||||
DxvkComputePipelineShaders,
|
DxvkComputePipelineShaders,
|
||||||
Rc<DxvkComputePipeline>,
|
DxvkComputePipeline,
|
||||||
DxvkPipelineKeyHash,
|
DxvkPipelineKeyHash,
|
||||||
DxvkPipelineKeyEq> m_computePipelines;
|
DxvkPipelineKeyEq> m_computePipelines;
|
||||||
|
|
||||||
std::unordered_map<
|
std::unordered_map<
|
||||||
DxvkGraphicsPipelineShaders,
|
DxvkGraphicsPipelineShaders,
|
||||||
Rc<DxvkGraphicsPipeline>,
|
DxvkGraphicsPipeline,
|
||||||
DxvkPipelineKeyHash,
|
DxvkPipelineKeyHash,
|
||||||
DxvkPipelineKeyEq> m_graphicsPipelines;
|
DxvkPipelineKeyEq> m_graphicsPipelines;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user