mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-07 16:54:14 +01:00
[dxvk] Move DxvkGraphicsPipelineStateInfo to new file
We're going to put a lot of code here, so try to keep things clean.
This commit is contained in:
parent
9dad44a6b1
commit
8d09aa12da
@ -1,5 +1,4 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "dxvk_device.h"
|
#include "dxvk_device.h"
|
||||||
#include "dxvk_graphics.h"
|
#include "dxvk_graphics.h"
|
||||||
@ -9,34 +8,6 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
DxvkGraphicsPipelineStateInfo::DxvkGraphicsPipelineStateInfo() {
|
|
||||||
std::memset(this, 0, sizeof(DxvkGraphicsPipelineStateInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkGraphicsPipelineStateInfo::DxvkGraphicsPipelineStateInfo(
|
|
||||||
const DxvkGraphicsPipelineStateInfo& other) {
|
|
||||||
std::memcpy(this, &other, sizeof(DxvkGraphicsPipelineStateInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkGraphicsPipelineStateInfo& DxvkGraphicsPipelineStateInfo::operator = (
|
|
||||||
const DxvkGraphicsPipelineStateInfo& other) {
|
|
||||||
std::memcpy(this, &other, sizeof(DxvkGraphicsPipelineStateInfo));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool DxvkGraphicsPipelineStateInfo::operator == (const DxvkGraphicsPipelineStateInfo& other) const {
|
|
||||||
return std::memcmp(this, &other, sizeof(DxvkGraphicsPipelineStateInfo)) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool DxvkGraphicsPipelineStateInfo::operator != (const DxvkGraphicsPipelineStateInfo& other) const {
|
|
||||||
return std::memcmp(this, &other, sizeof(DxvkGraphicsPipelineStateInfo)) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkGraphicsPipeline::DxvkGraphicsPipeline(
|
DxvkGraphicsPipeline::DxvkGraphicsPipeline(
|
||||||
DxvkPipelineManager* pipeMgr,
|
DxvkPipelineManager* pipeMgr,
|
||||||
DxvkGraphicsPipelineShaders shaders)
|
DxvkGraphicsPipelineShaders shaders)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "dxvk_bind_mask.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_constant_state.h"
|
#include "dxvk_constant_state.h"
|
||||||
|
#include "dxvk_graphics_state.h"
|
||||||
#include "dxvk_pipecache.h"
|
#include "dxvk_pipecache.h"
|
||||||
#include "dxvk_pipelayout.h"
|
#include "dxvk_pipelayout.h"
|
||||||
#include "dxvk_renderpass.h"
|
#include "dxvk_renderpass.h"
|
||||||
@ -54,92 +55,6 @@ namespace dxvk {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Graphics pipeline state info
|
|
||||||
*
|
|
||||||
* Stores all information that is required to create
|
|
||||||
* a graphics pipeline, except the shader objects
|
|
||||||
* themselves. Also used to identify pipelines using
|
|
||||||
* the current pipeline state vector.
|
|
||||||
*/
|
|
||||||
struct DxvkGraphicsPipelineStateInfo {
|
|
||||||
DxvkGraphicsPipelineStateInfo();
|
|
||||||
DxvkGraphicsPipelineStateInfo(
|
|
||||||
const DxvkGraphicsPipelineStateInfo& other);
|
|
||||||
|
|
||||||
DxvkGraphicsPipelineStateInfo& operator = (
|
|
||||||
const DxvkGraphicsPipelineStateInfo& other);
|
|
||||||
|
|
||||||
bool operator == (const DxvkGraphicsPipelineStateInfo& other) const;
|
|
||||||
bool operator != (const DxvkGraphicsPipelineStateInfo& other) const;
|
|
||||||
|
|
||||||
bool useDynamicStencilRef() const {
|
|
||||||
return dsEnableStencilTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool useDynamicDepthBias() const {
|
|
||||||
return rsDepthBiasEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool useDynamicDepthBounds() const {
|
|
||||||
return dsEnableDepthBoundsTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool useDynamicBlendConstants() const {
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumRenderTargets && !result; i++) {
|
|
||||||
result |= omBlendAttachments[i].blendEnable
|
|
||||||
&& (util::isBlendConstantBlendFactor(omBlendAttachments[i].srcColorBlendFactor)
|
|
||||||
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].dstColorBlendFactor)
|
|
||||||
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].srcAlphaBlendFactor)
|
|
||||||
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].dstAlphaBlendFactor));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
DxvkBindingMask bsBindingMask;
|
|
||||||
|
|
||||||
VkPrimitiveTopology iaPrimitiveTopology;
|
|
||||||
VkBool32 iaPrimitiveRestart;
|
|
||||||
uint32_t iaPatchVertexCount;
|
|
||||||
|
|
||||||
uint32_t ilAttributeCount;
|
|
||||||
uint32_t ilBindingCount;
|
|
||||||
VkVertexInputAttributeDescription ilAttributes[DxvkLimits::MaxNumVertexAttributes];
|
|
||||||
VkVertexInputBindingDescription ilBindings[DxvkLimits::MaxNumVertexBindings];
|
|
||||||
uint32_t ilDivisors[DxvkLimits::MaxNumVertexBindings];
|
|
||||||
|
|
||||||
VkBool32 rsDepthClipEnable;
|
|
||||||
VkBool32 rsDepthBiasEnable;
|
|
||||||
VkPolygonMode rsPolygonMode;
|
|
||||||
VkCullModeFlags rsCullMode;
|
|
||||||
VkFrontFace rsFrontFace;
|
|
||||||
uint32_t rsViewportCount;
|
|
||||||
VkSampleCountFlags rsSampleCount;
|
|
||||||
|
|
||||||
VkSampleCountFlags msSampleCount;
|
|
||||||
uint32_t msSampleMask;
|
|
||||||
VkBool32 msEnableAlphaToCoverage;
|
|
||||||
|
|
||||||
VkBool32 dsEnableDepthTest;
|
|
||||||
VkBool32 dsEnableDepthWrite;
|
|
||||||
VkBool32 dsEnableDepthBoundsTest;
|
|
||||||
VkBool32 dsEnableStencilTest;
|
|
||||||
VkCompareOp dsDepthCompareOp;
|
|
||||||
VkStencilOpState dsStencilOpFront;
|
|
||||||
VkStencilOpState dsStencilOpBack;
|
|
||||||
|
|
||||||
VkBool32 omEnableLogicOp;
|
|
||||||
VkLogicOp omLogicOp;
|
|
||||||
VkPipelineColorBlendAttachmentState omBlendAttachments[MaxNumRenderTargets];
|
|
||||||
VkComponentMapping omComponentMapping[MaxNumRenderTargets];
|
|
||||||
|
|
||||||
uint32_t scSpecConstants[MaxNumSpecConstants];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
104
src/dxvk/dxvk_graphics_state.h
Normal file
104
src/dxvk/dxvk_graphics_state.h
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "dxvk_limits.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Packed graphics pipeline state
|
||||||
|
*
|
||||||
|
* Stores a compressed representation of the full
|
||||||
|
* graphics pipeline state which is optimized for
|
||||||
|
* lookup performance.
|
||||||
|
*/
|
||||||
|
struct alignas(32) DxvkGraphicsPipelineStateInfo {
|
||||||
|
DxvkGraphicsPipelineStateInfo() {
|
||||||
|
std::memset(this, 0, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
DxvkGraphicsPipelineStateInfo(const DxvkGraphicsPipelineStateInfo& other) {
|
||||||
|
std::memcpy(this, &other, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
DxvkGraphicsPipelineStateInfo& operator = (const DxvkGraphicsPipelineStateInfo& other) {
|
||||||
|
std::memcpy(this, &other, sizeof(*this));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator == (const DxvkGraphicsPipelineStateInfo& other) const {
|
||||||
|
return !std::memcmp(this, &other, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator != (const DxvkGraphicsPipelineStateInfo& other) const {
|
||||||
|
return std::memcmp(this, &other, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useDynamicStencilRef() const {
|
||||||
|
return dsEnableStencilTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useDynamicDepthBias() const {
|
||||||
|
return rsDepthBiasEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useDynamicDepthBounds() const {
|
||||||
|
return dsEnableDepthBoundsTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useDynamicBlendConstants() const {
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < MaxNumRenderTargets && !result; i++) {
|
||||||
|
result |= omBlendAttachments[i].blendEnable
|
||||||
|
&& (util::isBlendConstantBlendFactor(omBlendAttachments[i].srcColorBlendFactor)
|
||||||
|
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].dstColorBlendFactor)
|
||||||
|
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].srcAlphaBlendFactor)
|
||||||
|
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].dstAlphaBlendFactor));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
DxvkBindingMask bsBindingMask;
|
||||||
|
|
||||||
|
VkPrimitiveTopology iaPrimitiveTopology;
|
||||||
|
VkBool32 iaPrimitiveRestart;
|
||||||
|
uint32_t iaPatchVertexCount;
|
||||||
|
|
||||||
|
uint32_t ilAttributeCount;
|
||||||
|
uint32_t ilBindingCount;
|
||||||
|
VkVertexInputAttributeDescription ilAttributes[DxvkLimits::MaxNumVertexAttributes];
|
||||||
|
VkVertexInputBindingDescription ilBindings[DxvkLimits::MaxNumVertexBindings];
|
||||||
|
uint32_t ilDivisors[DxvkLimits::MaxNumVertexBindings];
|
||||||
|
|
||||||
|
VkBool32 rsDepthClipEnable;
|
||||||
|
VkBool32 rsDepthBiasEnable;
|
||||||
|
VkPolygonMode rsPolygonMode;
|
||||||
|
VkCullModeFlags rsCullMode;
|
||||||
|
VkFrontFace rsFrontFace;
|
||||||
|
uint32_t rsViewportCount;
|
||||||
|
VkSampleCountFlags rsSampleCount;
|
||||||
|
|
||||||
|
VkSampleCountFlags msSampleCount;
|
||||||
|
uint32_t msSampleMask;
|
||||||
|
VkBool32 msEnableAlphaToCoverage;
|
||||||
|
|
||||||
|
VkBool32 dsEnableDepthTest;
|
||||||
|
VkBool32 dsEnableDepthWrite;
|
||||||
|
VkBool32 dsEnableDepthBoundsTest;
|
||||||
|
VkBool32 dsEnableStencilTest;
|
||||||
|
VkCompareOp dsDepthCompareOp;
|
||||||
|
VkStencilOpState dsStencilOpFront;
|
||||||
|
VkStencilOpState dsStencilOpBack;
|
||||||
|
|
||||||
|
VkBool32 omEnableLogicOp;
|
||||||
|
VkLogicOp omLogicOp;
|
||||||
|
VkPipelineColorBlendAttachmentState omBlendAttachments[MaxNumRenderTargets];
|
||||||
|
VkComponentMapping omComponentMapping[MaxNumRenderTargets];
|
||||||
|
|
||||||
|
uint32_t scSpecConstants[MaxNumSpecConstants];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user