mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[dxvk] Apply spec constants to compute shaders as well
This commit is contained in:
parent
e926ceb9cc
commit
e253183bc2
@ -9,6 +9,24 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
DxvkComputePipelineStateInfo::DxvkComputePipelineStateInfo() {
|
||||||
|
std::memset(this, 0, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DxvkComputePipelineStateInfo::DxvkComputePipelineStateInfo(
|
||||||
|
const DxvkComputePipelineStateInfo& other) {
|
||||||
|
std::memcpy(this, &other, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DxvkComputePipelineStateInfo& DxvkComputePipelineStateInfo::operator = (
|
||||||
|
const DxvkComputePipelineStateInfo& other) {
|
||||||
|
std::memcpy(this, &other, sizeof(*this));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DxvkComputePipelineStateInfo::operator == (const DxvkComputePipelineStateInfo& other) const {
|
bool DxvkComputePipelineStateInfo::operator == (const DxvkComputePipelineStateInfo& other) const {
|
||||||
return std::memcmp(this, &other, sizeof(DxvkComputePipelineStateInfo)) == 0;
|
return std::memcmp(this, &other, sizeof(DxvkComputePipelineStateInfo)) == 0;
|
||||||
}
|
}
|
||||||
@ -107,6 +125,9 @@ namespace dxvk {
|
|||||||
for (uint32_t i = 0; i < m_layout->bindingCount(); i++)
|
for (uint32_t i = 0; i < m_layout->bindingCount(); i++)
|
||||||
specData.set(i, state.bsBindingMask.test(i), true);
|
specData.set(i, state.bsBindingMask.test(i), true);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < MaxNumSpecConstants; i++)
|
||||||
|
specData.set(getSpecId(i), state.scSpecConstants[i], 0u);
|
||||||
|
|
||||||
VkSpecializationInfo specInfo = specData.getSpecInfo();
|
VkSpecializationInfo specInfo = specData.getSpecInfo();
|
||||||
|
|
||||||
DxvkShaderModuleCreateInfo moduleInfo;
|
DxvkShaderModuleCreateInfo moduleInfo;
|
||||||
|
@ -27,10 +27,18 @@ namespace dxvk {
|
|||||||
* \brief Compute pipeline state info
|
* \brief Compute pipeline state info
|
||||||
*/
|
*/
|
||||||
struct DxvkComputePipelineStateInfo {
|
struct DxvkComputePipelineStateInfo {
|
||||||
|
DxvkComputePipelineStateInfo();
|
||||||
|
DxvkComputePipelineStateInfo(
|
||||||
|
const DxvkComputePipelineStateInfo& other);
|
||||||
|
|
||||||
|
DxvkComputePipelineStateInfo& operator = (
|
||||||
|
const DxvkComputePipelineStateInfo& other);
|
||||||
|
|
||||||
bool operator == (const DxvkComputePipelineStateInfo& other) const;
|
bool operator == (const DxvkComputePipelineStateInfo& other) const;
|
||||||
bool operator != (const DxvkComputePipelineStateInfo& other) const;
|
bool operator != (const DxvkComputePipelineStateInfo& other) const;
|
||||||
|
|
||||||
DxvkBindingMask bsBindingMask;
|
DxvkBindingMask bsBindingMask;
|
||||||
|
uint32_t scSpecConstants[MaxNumSpecConstants];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2344,11 +2344,19 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxvkContext::setSpecConstant(
|
void DxvkContext::setSpecConstant(
|
||||||
|
VkPipelineBindPoint pipeline,
|
||||||
uint32_t index,
|
uint32_t index,
|
||||||
uint32_t value) {
|
uint32_t value) {
|
||||||
if (m_state.gp.state.scSpecConstants[index] != value) {
|
auto& specConst = pipeline == VK_PIPELINE_BIND_POINT_GRAPHICS
|
||||||
m_state.gp.state.scSpecConstants[index] = value;
|
? m_state.gp.state.scSpecConstants[index]
|
||||||
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
: m_state.cp.state.scSpecConstants[index];
|
||||||
|
|
||||||
|
if (specConst != value) {
|
||||||
|
specConst = value;
|
||||||
|
|
||||||
|
m_flags.set(pipeline == VK_PIPELINE_BIND_POINT_GRAPHICS
|
||||||
|
? DxvkContextFlag::GpDirtyPipelineState
|
||||||
|
: DxvkContextFlag::CpDirtyPipelineState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,10 +917,12 @@ namespace dxvk {
|
|||||||
* Replaces current specialization constants with
|
* Replaces current specialization constants with
|
||||||
* the given list of constant entries. The specId
|
* the given list of constant entries. The specId
|
||||||
* in the shader can be computed with \c getSpecId.
|
* in the shader can be computed with \c getSpecId.
|
||||||
|
* \param [in] pipeline Graphics or Compute pipeline
|
||||||
* \param [in] index Constant index
|
* \param [in] index Constant index
|
||||||
* \param [in] value Constant value
|
* \param [in] value Constant value
|
||||||
*/
|
*/
|
||||||
void setSpecConstant(
|
void setSpecConstant(
|
||||||
|
VkPipelineBindPoint pipeline,
|
||||||
uint32_t index,
|
uint32_t index,
|
||||||
uint32_t value);
|
uint32_t value);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user