mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-13 07:08:50 +01:00
[dxvk] Simplify pipeline instance data
This commit is contained in:
parent
a72bf02374
commit
2cb9ceba1d
@ -30,7 +30,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxvkComputePipeline::~DxvkComputePipeline() {
|
DxvkComputePipeline::~DxvkComputePipeline() {
|
||||||
for (const auto& instance : m_pipelines)
|
for (const auto& instance : m_pipelines)
|
||||||
this->destroyPipeline(instance.pipeline());
|
this->destroyPipeline(instance.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance->pipeline();
|
return instance->handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ namespace dxvk {
|
|||||||
DxvkComputePipelineInstance* DxvkComputePipeline::findInstance(
|
DxvkComputePipelineInstance* DxvkComputePipeline::findInstance(
|
||||||
const DxvkComputePipelineStateInfo& state) {
|
const DxvkComputePipelineStateInfo& state) {
|
||||||
for (auto& instance : m_pipelines) {
|
for (auto& instance : m_pipelines) {
|
||||||
if (instance.isCompatible(state))
|
if (instance.state == state)
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,44 +39,15 @@ namespace dxvk {
|
|||||||
/**
|
/**
|
||||||
* \brief Compute pipeline instance
|
* \brief Compute pipeline instance
|
||||||
*/
|
*/
|
||||||
class DxvkComputePipelineInstance {
|
struct DxvkComputePipelineInstance {
|
||||||
|
DxvkComputePipelineInstance() { }
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkComputePipelineInstance()
|
|
||||||
: m_stateVector (),
|
|
||||||
m_pipeline (VK_NULL_HANDLE) { }
|
|
||||||
|
|
||||||
DxvkComputePipelineInstance(
|
DxvkComputePipelineInstance(
|
||||||
const DxvkComputePipelineStateInfo& state,
|
const DxvkComputePipelineStateInfo& state_,
|
||||||
VkPipeline pipe)
|
VkPipeline handle_)
|
||||||
: m_stateVector (state),
|
: state(state_), handle(handle_) { }
|
||||||
m_pipeline (pipe) { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Checks for matching pipeline state
|
|
||||||
*
|
|
||||||
* \param [in] stateVector Graphics pipeline state
|
|
||||||
* \param [in] renderPass Render pass handle
|
|
||||||
* \returns \c true if the specialization is compatible
|
|
||||||
*/
|
|
||||||
bool isCompatible(const DxvkComputePipelineStateInfo& state) const {
|
|
||||||
return m_stateVector == state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Retrieves pipeline
|
|
||||||
* \returns The pipeline handle
|
|
||||||
*/
|
|
||||||
VkPipeline pipeline() const {
|
|
||||||
return m_pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
DxvkComputePipelineStateInfo m_stateVector;
|
|
||||||
VkPipeline m_pipeline;
|
|
||||||
|
|
||||||
|
DxvkComputePipelineStateInfo state;
|
||||||
|
VkPipeline handle = VK_NULL_HANDLE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxvkGraphicsPipeline::~DxvkGraphicsPipeline() {
|
DxvkGraphicsPipeline::~DxvkGraphicsPipeline() {
|
||||||
for (const auto& instance : m_pipelines)
|
for (const auto& instance : m_pipelines)
|
||||||
this->destroyPipeline(instance.pipeline());
|
this->destroyPipeline(instance.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance->pipeline();
|
return instance->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ namespace dxvk {
|
|||||||
DxvkGraphicsPipelineInstance* DxvkGraphicsPipeline::findInstance(
|
DxvkGraphicsPipelineInstance* DxvkGraphicsPipeline::findInstance(
|
||||||
const DxvkGraphicsPipelineStateInfo& state) {
|
const DxvkGraphicsPipelineStateInfo& state) {
|
||||||
for (auto& instance : m_pipelines) {
|
for (auto& instance : m_pipelines) {
|
||||||
if (instance.isCompatible(state))
|
if (instance.state == state)
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,44 +236,15 @@ namespace dxvk {
|
|||||||
* Stores a state vector and the
|
* Stores a state vector and the
|
||||||
* corresponding pipeline handle.
|
* corresponding pipeline handle.
|
||||||
*/
|
*/
|
||||||
class DxvkGraphicsPipelineInstance {
|
struct DxvkGraphicsPipelineInstance {
|
||||||
|
DxvkGraphicsPipelineInstance() { }
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkGraphicsPipelineInstance()
|
|
||||||
: m_stateVector (),
|
|
||||||
m_pipeline (VK_NULL_HANDLE) { }
|
|
||||||
|
|
||||||
DxvkGraphicsPipelineInstance(
|
DxvkGraphicsPipelineInstance(
|
||||||
const DxvkGraphicsPipelineStateInfo& state,
|
const DxvkGraphicsPipelineStateInfo& state_,
|
||||||
VkPipeline pipe)
|
VkPipeline handle_)
|
||||||
: m_stateVector (state),
|
: state(state_), handle(handle_) { }
|
||||||
m_pipeline (pipe) { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Checks for matching pipeline state
|
|
||||||
*
|
|
||||||
* \param [in] stateVector Graphics pipeline state
|
|
||||||
* \returns \c true if the specialization is compatible
|
|
||||||
*/
|
|
||||||
bool isCompatible(
|
|
||||||
const DxvkGraphicsPipelineStateInfo& state) {
|
|
||||||
return m_stateVector == state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Retrieves pipeline
|
|
||||||
* \returns The pipeline handle
|
|
||||||
*/
|
|
||||||
VkPipeline pipeline() const {
|
|
||||||
return m_pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
DxvkGraphicsPipelineStateInfo m_stateVector;
|
|
||||||
VkPipeline m_pipeline;
|
|
||||||
|
|
||||||
|
DxvkGraphicsPipelineStateInfo state;
|
||||||
|
VkPipeline handle = VK_NULL_HANDLE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user