1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +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:
Philip Rebohle 2018-09-18 13:21:58 +02:00
parent 4469ef1ec1
commit 482930f04a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
6 changed files with 25 additions and 9 deletions

View File

@ -47,12 +47,10 @@ namespace dxvk {
m_state.depthBiasClamp = desc.DepthBiasClamp;
m_state.depthBiasSlope = desc.SlopeScaledDepthBias;
m_state.depthClampEnable = desc.DepthClipEnable ? VK_FALSE : VK_TRUE;
m_state.sampleCount = VkSampleCountFlags(desc.ForcedSampleCount);
if (desc.AntialiasedLineEnable)
Logger::err("D3D11RasterizerState: Antialiased lines not supported");
if (desc.ForcedSampleCount)
Logger::err("D3D11RasterizerState: Forced sample count not supported");
}

View File

@ -48,6 +48,7 @@ namespace dxvk {
float depthBiasConstant;
float depthBiasClamp;
float depthBiasSlope;
VkSampleCountFlags sampleCount;
};

View File

@ -1562,6 +1562,7 @@ namespace dxvk {
m_state.gp.state.rsPolygonMode = rs.polygonMode;
m_state.gp.state.rsCullMode = rs.cullMode;
m_state.gp.state.rsFrontFace = rs.frontFace;
m_state.gp.state.rsSampleCount = rs.sampleCount;
m_state.ds.depthBiasConstant = rs.depthBiasConstant;
m_state.ds.depthBiasClamp = rs.depthBiasClamp;

View File

@ -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
*/
VkSampleCountFlagBits getSampleCount() const {
return m_renderPass->getSampleCount();
VkSampleCountFlags getSampleCount() const {
return m_attachmentCount != 0
? m_renderPass->getSampleCount()
: 0;
}
/**

View File

@ -160,9 +160,18 @@ namespace dxvk {
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
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;
specData.rasterizerSampleCount = uint32_t(state.msSampleCount);
specData.rasterizerSampleCount = uint32_t(sampleCount);
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
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.pNext = nullptr;
msInfo.flags = 0;
msInfo.rasterizationSamples = state.msSampleCount;
msInfo.rasterizationSamples = sampleCount;
msInfo.sampleShadingEnable = m_common.msSampleShadingEnable;
msInfo.minSampleShading = m_common.msSampleShadingFactor;
msInfo.pSampleMask = &state.msSampleMask;

View File

@ -52,8 +52,9 @@ namespace dxvk {
VkCullModeFlags rsCullMode;
VkFrontFace rsFrontFace;
uint32_t rsViewportCount;
VkSampleCountFlags rsSampleCount;
VkSampleCountFlagBits msSampleCount;
VkSampleCountFlags msSampleCount;
uint32_t msSampleMask;
VkBool32 msEnableAlphaToCoverage;
VkBool32 msEnableAlphaToOne;