mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[dxvk] Factor out fragment shader state setup
This commit is contained in:
parent
33067f2a23
commit
47ac5f49cb
@ -340,6 +340,32 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DxvkGraphicsPipelineFragmentShaderState::DxvkGraphicsPipelineFragmentShaderState() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DxvkGraphicsPipelineFragmentShaderState::DxvkGraphicsPipelineFragmentShaderState(
|
||||||
|
const DxvkDevice* device,
|
||||||
|
const DxvkGraphicsPipelineStateInfo& state) {
|
||||||
|
dsInfo.depthTestEnable = state.ds.enableDepthTest();
|
||||||
|
dsInfo.depthWriteEnable = state.ds.enableDepthWrite();
|
||||||
|
dsInfo.depthCompareOp = state.ds.depthCompareOp();
|
||||||
|
dsInfo.depthBoundsTestEnable = state.ds.enableDepthBoundsTest();
|
||||||
|
dsInfo.stencilTestEnable = state.ds.enableStencilTest();
|
||||||
|
dsInfo.front = state.dsFront.state();
|
||||||
|
dsInfo.back = state.dsBack.state();
|
||||||
|
|
||||||
|
if ((state.rt.getDepthStencilReadOnlyAspects() & VK_IMAGE_ASPECT_DEPTH_BIT))
|
||||||
|
dsInfo.depthWriteEnable = VK_FALSE;
|
||||||
|
|
||||||
|
if ((state.rt.getDepthStencilReadOnlyAspects() & VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||||
|
dsInfo.front.writeMask = 0;
|
||||||
|
dsInfo.back.writeMask = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkGraphicsPipeline::DxvkGraphicsPipeline(
|
DxvkGraphicsPipeline::DxvkGraphicsPipeline(
|
||||||
DxvkPipelineManager* pipeMgr,
|
DxvkPipelineManager* pipeMgr,
|
||||||
DxvkGraphicsPipelineShaders shaders,
|
DxvkGraphicsPipelineShaders shaders,
|
||||||
@ -517,20 +543,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxvkGraphicsPipelineVertexInputState viState(device, state);
|
DxvkGraphicsPipelineVertexInputState viState(device, state);
|
||||||
DxvkGraphicsPipelinePreRasterizationState prState(device, state, m_shaders.gs.ptr());
|
DxvkGraphicsPipelinePreRasterizationState prState(device, state, m_shaders.gs.ptr());
|
||||||
|
DxvkGraphicsPipelineFragmentShaderState fsState(device, state);
|
||||||
DxvkGraphicsPipelineFragmentOutputState foState(device, state, m_shaders.fs.ptr());
|
DxvkGraphicsPipelineFragmentOutputState foState(device, state, m_shaders.fs.ptr());
|
||||||
|
|
||||||
VkPipelineDepthStencilStateCreateInfo dsInfo = { VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO };
|
|
||||||
dsInfo.depthTestEnable = state.ds.enableDepthTest();
|
|
||||||
dsInfo.depthWriteEnable = state.ds.enableDepthWrite();
|
|
||||||
dsInfo.depthCompareOp = state.ds.depthCompareOp();
|
|
||||||
dsInfo.depthBoundsTestEnable = state.ds.enableDepthBoundsTest();
|
|
||||||
dsInfo.stencilTestEnable = state.ds.enableStencilTest();
|
|
||||||
dsInfo.front = state.dsFront.state();
|
|
||||||
dsInfo.back = state.dsBack.state();
|
|
||||||
|
|
||||||
if ((state.rt.getDepthStencilReadOnlyAspects() & VK_IMAGE_ASPECT_DEPTH_BIT))
|
|
||||||
dsInfo.depthWriteEnable = VK_FALSE;
|
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo dyInfo = { VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
|
VkPipelineDynamicStateCreateInfo dyInfo = { VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
|
||||||
dyInfo.dynamicStateCount = dynamicStateCount;
|
dyInfo.dynamicStateCount = dynamicStateCount;
|
||||||
dyInfo.pDynamicStates = dynamicStates.data();
|
dyInfo.pDynamicStates = dynamicStates.data();
|
||||||
@ -544,7 +559,7 @@ namespace dxvk {
|
|||||||
info.pViewportState = &prState.vpInfo;
|
info.pViewportState = &prState.vpInfo;
|
||||||
info.pRasterizationState = &prState.rsInfo;
|
info.pRasterizationState = &prState.rsInfo;
|
||||||
info.pMultisampleState = &foState.msInfo;
|
info.pMultisampleState = &foState.msInfo;
|
||||||
info.pDepthStencilState = &dsInfo;
|
info.pDepthStencilState = &fsState.dsInfo;
|
||||||
info.pColorBlendState = &foState.cbInfo;
|
info.pColorBlendState = &foState.cbInfo;
|
||||||
info.pDynamicState = &dyInfo;
|
info.pDynamicState = &dyInfo;
|
||||||
info.layout = m_bindings->getPipelineLayout();
|
info.layout = m_bindings->getPipelineLayout();
|
||||||
|
@ -99,6 +99,23 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Fragment shader state info for graphics pipelines
|
||||||
|
*
|
||||||
|
* Can only be used when compiling full graphics pipelines
|
||||||
|
* when all pipeline state is known.
|
||||||
|
*/
|
||||||
|
struct DxvkGraphicsPipelineFragmentShaderState {
|
||||||
|
DxvkGraphicsPipelineFragmentShaderState();
|
||||||
|
|
||||||
|
DxvkGraphicsPipelineFragmentShaderState(
|
||||||
|
const DxvkDevice* device,
|
||||||
|
const DxvkGraphicsPipelineStateInfo& state);
|
||||||
|
|
||||||
|
VkPipelineDepthStencilStateCreateInfo dsInfo = { VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Flags that describe pipeline properties
|
* \brief Flags that describe pipeline properties
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user