From 782b021690c444b3823fed1d92adf7f5855879b0 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 7 Oct 2019 13:16:00 +0200 Subject: [PATCH] [dxvk] Move compute pipeline state to dxvk_graphics_state.h --- src/dxvk/dxvk_compute.cpp | 30 +----------------------------- src/dxvk/dxvk_compute.h | 20 +------------------- src/dxvk/dxvk_context.cpp | 2 +- src/dxvk/dxvk_graphics_state.h | 30 ++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 49 deletions(-) diff --git a/src/dxvk/dxvk_compute.cpp b/src/dxvk/dxvk_compute.cpp index d40639cc..ad62b6d9 100644 --- a/src/dxvk/dxvk_compute.cpp +++ b/src/dxvk/dxvk_compute.cpp @@ -9,34 +9,6 @@ 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 { - return std::memcmp(this, &other, sizeof(DxvkComputePipelineStateInfo)) == 0; - } - - - bool DxvkComputePipelineStateInfo::operator != (const DxvkComputePipelineStateInfo& other) const { - return std::memcmp(this, &other, sizeof(DxvkComputePipelineStateInfo)) != 0; - } - - DxvkComputePipeline::DxvkComputePipeline( DxvkPipelineManager* pipeMgr, DxvkComputePipelineShaders shaders) @@ -126,7 +98,7 @@ namespace dxvk { specData.set(i, state.bsBindingMask.test(i), true); for (uint32_t i = 0; i < MaxNumSpecConstants; i++) - specData.set(getSpecId(i), state.scSpecConstants[i], 0u); + specData.set(getSpecId(i), state.sc.specConstants[i], 0u); VkSpecializationInfo specInfo = specData.getSpecInfo(); diff --git a/src/dxvk/dxvk_compute.h b/src/dxvk/dxvk_compute.h index f1aab2d0..5be89d6c 100644 --- a/src/dxvk/dxvk_compute.h +++ b/src/dxvk/dxvk_compute.h @@ -4,6 +4,7 @@ #include #include "dxvk_bind_mask.h" +#include "dxvk_graphics_state.h" #include "dxvk_pipecache.h" #include "dxvk_pipelayout.h" #include "dxvk_resource.h" @@ -31,25 +32,6 @@ namespace dxvk { }; - /** - * \brief Compute pipeline state info - */ - struct DxvkComputePipelineStateInfo { - DxvkComputePipelineStateInfo(); - DxvkComputePipelineStateInfo( - const DxvkComputePipelineStateInfo& other); - - DxvkComputePipelineStateInfo& operator = ( - const DxvkComputePipelineStateInfo& other); - - bool operator == (const DxvkComputePipelineStateInfo& other) const; - bool operator != (const DxvkComputePipelineStateInfo& other) const; - - DxvkBindingMask bsBindingMask; - uint32_t scSpecConstants[MaxNumSpecConstants]; - }; - - /** * \brief Compute pipeline instance */ diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 67f30ee2..7e5789ac 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -2351,7 +2351,7 @@ namespace dxvk { uint32_t value) { auto& specConst = pipeline == VK_PIPELINE_BIND_POINT_GRAPHICS ? m_state.gp.state.sc.specConstants[index] - : m_state.cp.state.scSpecConstants[index]; + : m_state.cp.state.sc.specConstants[index]; if (specConst != value) { specConst = value; diff --git a/src/dxvk/dxvk_graphics_state.h b/src/dxvk/dxvk_graphics_state.h index c5925976..bd050a5e 100644 --- a/src/dxvk/dxvk_graphics_state.h +++ b/src/dxvk/dxvk_graphics_state.h @@ -690,4 +690,34 @@ namespace dxvk { DxvkIlBinding ilBindings [DxvkLimits::MaxNumVertexBindings]; }; + + /** + * \brief Compute pipeline state info + */ + struct alignas(32) DxvkComputePipelineStateInfo { + DxvkComputePipelineStateInfo() { + std::memset(this, 0, sizeof(*this)); + } + + DxvkComputePipelineStateInfo(const DxvkComputePipelineStateInfo& other) { + std::memcpy(this, &other, sizeof(*this)); + } + + DxvkComputePipelineStateInfo& operator = (const DxvkComputePipelineStateInfo& other) { + std::memcpy(this, &other, sizeof(*this)); + return *this; + } + + bool operator == (const DxvkComputePipelineStateInfo& other) const { + return !std::memcmp(this, &other, sizeof(*this)); + } + + bool operator != (const DxvkComputePipelineStateInfo& other) const { + return std::memcmp(this, &other, sizeof(*this)); + } + + DxvkBindingMask bsBindingMask; + DxvkScInfo sc; + }; + }