mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[dxvk] Detect Xfb and set rasterized stream index
This commit is contained in:
parent
1f135f59ed
commit
a27e440272
@ -232,9 +232,13 @@ namespace dxvk {
|
||||
|
||||
DxvkShaderOptions shaderOptions = { };
|
||||
|
||||
if (m_moduleInfo.xfb != nullptr)
|
||||
if (m_moduleInfo.xfb != nullptr) {
|
||||
shaderOptions.rasterizedStream = m_moduleInfo.xfb->rasterizedStream;
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
shaderOptions.xfbStrides[i] = m_moduleInfo.xfb->strides[i];
|
||||
}
|
||||
|
||||
// Create the shader module object
|
||||
return new DxvkShader(
|
||||
m_programInfo.shaderStage(),
|
||||
|
@ -69,6 +69,9 @@ namespace dxvk {
|
||||
|
||||
m_vsIn = vs != nullptr ? vs->interfaceSlots().inputSlots : 0;
|
||||
m_fsOut = fs != nullptr ? fs->interfaceSlots().outputSlots : 0;
|
||||
|
||||
if (gs != nullptr && gs->hasCapability(spv::CapabilityTransformFeedback))
|
||||
m_flags.set(DxvkGraphicsPipelineFlag::HasTransformFeedback);
|
||||
|
||||
m_common.msSampleShadingEnable = fs != nullptr && fs->hasCapability(spv::CapabilitySampleRateShading);
|
||||
m_common.msSampleShadingFactor = 1.0f;
|
||||
@ -226,7 +229,11 @@ namespace dxvk {
|
||||
viDivisorDesc[id].divisor = state.ilDivisors[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t rasterizedStream = m_gs != nullptr
|
||||
? m_gs->shader()->shaderOptions().rasterizedStream
|
||||
: 0;
|
||||
|
||||
VkPipelineVertexInputDivisorStateCreateInfoEXT viDivisorInfo;
|
||||
viDivisorInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT;
|
||||
viDivisorInfo.pNext = nullptr;
|
||||
@ -271,12 +278,18 @@ namespace dxvk {
|
||||
vpInfo.scissorCount = state.rsViewportCount;
|
||||
vpInfo.pScissors = nullptr;
|
||||
|
||||
VkPipelineRasterizationStateStreamCreateInfoEXT xfbStreamInfo;
|
||||
xfbStreamInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT;
|
||||
xfbStreamInfo.pNext = nullptr;
|
||||
xfbStreamInfo.flags = 0;
|
||||
xfbStreamInfo.rasterizationStream = uint32_t(rasterizedStream);
|
||||
|
||||
VkPipelineRasterizationStateCreateInfo rsInfo;
|
||||
rsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||
rsInfo.pNext = nullptr;
|
||||
rsInfo.flags = 0;
|
||||
rsInfo.depthClampEnable = state.rsDepthClampEnable;
|
||||
rsInfo.rasterizerDiscardEnable= VK_FALSE;
|
||||
rsInfo.rasterizerDiscardEnable = rasterizedStream < 0;
|
||||
rsInfo.polygonMode = state.rsPolygonMode;
|
||||
rsInfo.cullMode = state.rsCullMode;
|
||||
rsInfo.frontFace = state.rsFrontFace;
|
||||
@ -286,6 +299,9 @@ namespace dxvk {
|
||||
rsInfo.depthBiasSlopeFactor = 0.0f;
|
||||
rsInfo.lineWidth = 1.0f;
|
||||
|
||||
if (rasterizedStream > 0)
|
||||
rsInfo.pNext = &xfbStreamInfo;
|
||||
|
||||
VkPipelineMultisampleStateCreateInfo msInfo;
|
||||
msInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||
msInfo.pNext = nullptr;
|
||||
|
@ -15,6 +15,16 @@ namespace dxvk {
|
||||
|
||||
class DxvkDevice;
|
||||
class DxvkPipelineManager;
|
||||
|
||||
/**
|
||||
* \brief Flags that describe pipeline properties
|
||||
*/
|
||||
enum class DxvkGraphicsPipelineFlag {
|
||||
HasTransformFeedback,
|
||||
};
|
||||
|
||||
using DxvkGraphicsCommonPipelineFlags = Flags<DxvkGraphicsPipelineFlag>;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Graphics pipeline state info
|
||||
@ -156,6 +166,14 @@ namespace dxvk {
|
||||
const Rc<DxvkShader>& fs);
|
||||
~DxvkGraphicsPipeline();
|
||||
|
||||
/**
|
||||
* \brief Returns graphics pipeline flags
|
||||
* \returns Graphics pipeline property flags
|
||||
*/
|
||||
DxvkGraphicsCommonPipelineFlags flags() const {
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Pipeline layout
|
||||
*
|
||||
@ -213,6 +231,7 @@ namespace dxvk {
|
||||
uint32_t m_vsIn = 0;
|
||||
uint32_t m_fsOut = 0;
|
||||
|
||||
DxvkGraphicsCommonPipelineFlags m_flags;
|
||||
DxvkGraphicsCommonPipelineStateInfo m_common;
|
||||
|
||||
// List of pipeline instances, shared between threads
|
||||
|
@ -59,6 +59,8 @@ namespace dxvk {
|
||||
struct DxvkShaderOptions {
|
||||
/// Rasterized stream, or -1
|
||||
int32_t rasterizedStream;
|
||||
/// Xfb vertex strides
|
||||
uint32_t xfbStrides[MaxNumXfbBuffers];
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user