mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Implement backend support for D3D11 forced sample count
We don't support rasterization with a sample count different from the framebuffer sample count, but if there are no attachments, any sample count is allowed.
This commit is contained in:
parent
4469ef1ec1
commit
482930f04a
@ -47,12 +47,10 @@ namespace dxvk {
|
|||||||
m_state.depthBiasClamp = desc.DepthBiasClamp;
|
m_state.depthBiasClamp = desc.DepthBiasClamp;
|
||||||
m_state.depthBiasSlope = desc.SlopeScaledDepthBias;
|
m_state.depthBiasSlope = desc.SlopeScaledDepthBias;
|
||||||
m_state.depthClampEnable = desc.DepthClipEnable ? VK_FALSE : VK_TRUE;
|
m_state.depthClampEnable = desc.DepthClipEnable ? VK_FALSE : VK_TRUE;
|
||||||
|
m_state.sampleCount = VkSampleCountFlags(desc.ForcedSampleCount);
|
||||||
|
|
||||||
if (desc.AntialiasedLineEnable)
|
if (desc.AntialiasedLineEnable)
|
||||||
Logger::err("D3D11RasterizerState: Antialiased lines not supported");
|
Logger::err("D3D11RasterizerState: Antialiased lines not supported");
|
||||||
|
|
||||||
if (desc.ForcedSampleCount)
|
|
||||||
Logger::err("D3D11RasterizerState: Forced sample count not supported");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ namespace dxvk {
|
|||||||
float depthBiasConstant;
|
float depthBiasConstant;
|
||||||
float depthBiasClamp;
|
float depthBiasClamp;
|
||||||
float depthBiasSlope;
|
float depthBiasSlope;
|
||||||
|
VkSampleCountFlags sampleCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1562,6 +1562,7 @@ namespace dxvk {
|
|||||||
m_state.gp.state.rsPolygonMode = rs.polygonMode;
|
m_state.gp.state.rsPolygonMode = rs.polygonMode;
|
||||||
m_state.gp.state.rsCullMode = rs.cullMode;
|
m_state.gp.state.rsCullMode = rs.cullMode;
|
||||||
m_state.gp.state.rsFrontFace = rs.frontFace;
|
m_state.gp.state.rsFrontFace = rs.frontFace;
|
||||||
|
m_state.gp.state.rsSampleCount = rs.sampleCount;
|
||||||
|
|
||||||
m_state.ds.depthBiasConstant = rs.depthBiasConstant;
|
m_state.ds.depthBiasConstant = rs.depthBiasConstant;
|
||||||
m_state.ds.depthBiasClamp = rs.depthBiasClamp;
|
m_state.ds.depthBiasClamp = rs.depthBiasClamp;
|
||||||
|
@ -79,11 +79,17 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Sample count
|
* \brief Framebuffer sample count
|
||||||
|
*
|
||||||
|
* Returns the sample count of the color
|
||||||
|
* and depth-stencil attachments, or 0 if
|
||||||
|
* there are no attachments.
|
||||||
* \returns Sample count
|
* \returns Sample count
|
||||||
*/
|
*/
|
||||||
VkSampleCountFlagBits getSampleCount() const {
|
VkSampleCountFlags getSampleCount() const {
|
||||||
return m_renderPass->getSampleCount();
|
return m_attachmentCount != 0
|
||||||
|
? m_renderPass->getSampleCount()
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,9 +160,18 @@ namespace dxvk {
|
|||||||
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
||||||
VK_DYNAMIC_STATE_STENCIL_REFERENCE,
|
VK_DYNAMIC_STATE_STENCIL_REFERENCE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Figure out the actual sample count to use
|
||||||
|
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT;
|
||||||
|
|
||||||
|
if (state.msSampleCount)
|
||||||
|
sampleCount = VkSampleCountFlagBits(state.msSampleCount);
|
||||||
|
else if (state.rsSampleCount)
|
||||||
|
sampleCount = VkSampleCountFlagBits(state.rsSampleCount);
|
||||||
|
|
||||||
|
// Set up some specialization constants
|
||||||
DxvkSpecConstantData specData;
|
DxvkSpecConstantData specData;
|
||||||
specData.rasterizerSampleCount = uint32_t(state.msSampleCount);
|
specData.rasterizerSampleCount = uint32_t(sampleCount);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
||||||
specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE;
|
specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE;
|
||||||
@ -272,7 +281,7 @@ namespace dxvk {
|
|||||||
msInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
msInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||||
msInfo.pNext = nullptr;
|
msInfo.pNext = nullptr;
|
||||||
msInfo.flags = 0;
|
msInfo.flags = 0;
|
||||||
msInfo.rasterizationSamples = state.msSampleCount;
|
msInfo.rasterizationSamples = sampleCount;
|
||||||
msInfo.sampleShadingEnable = m_common.msSampleShadingEnable;
|
msInfo.sampleShadingEnable = m_common.msSampleShadingEnable;
|
||||||
msInfo.minSampleShading = m_common.msSampleShadingFactor;
|
msInfo.minSampleShading = m_common.msSampleShadingFactor;
|
||||||
msInfo.pSampleMask = &state.msSampleMask;
|
msInfo.pSampleMask = &state.msSampleMask;
|
||||||
|
@ -52,8 +52,9 @@ namespace dxvk {
|
|||||||
VkCullModeFlags rsCullMode;
|
VkCullModeFlags rsCullMode;
|
||||||
VkFrontFace rsFrontFace;
|
VkFrontFace rsFrontFace;
|
||||||
uint32_t rsViewportCount;
|
uint32_t rsViewportCount;
|
||||||
|
VkSampleCountFlags rsSampleCount;
|
||||||
|
|
||||||
VkSampleCountFlagBits msSampleCount;
|
VkSampleCountFlags msSampleCount;
|
||||||
uint32_t msSampleMask;
|
uint32_t msSampleMask;
|
||||||
VkBool32 msEnableAlphaToCoverage;
|
VkBool32 msEnableAlphaToCoverage;
|
||||||
VkBool32 msEnableAlphaToOne;
|
VkBool32 msEnableAlphaToOne;
|
||||||
|
Loading…
Reference in New Issue
Block a user