mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[d3d11] Implement conservative rasterization
Needed for Nvidia ShadowLibs in Final Fantasy XV.
This commit is contained in:
parent
e3b92bcfac
commit
2f553b5b16
@ -1121,7 +1121,11 @@ namespace dxvk {
|
||||
|
||||
if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc)))
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
||||
if (desc.ConservativeRaster != D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF
|
||||
&& !m_dxvkDevice->extensions().extConservativeRasterization)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!ppRasterizerState)
|
||||
return S_FALSE;
|
||||
|
||||
@ -1682,6 +1686,12 @@ namespace dxvk {
|
||||
info->TiledResourcesTier = D3D11_TILED_RESOURCES_NOT_SUPPORTED;
|
||||
info->StandardSwizzle = FALSE;
|
||||
info->UnifiedMemoryArchitecture = m_dxvkDevice->isUnifiedMemoryArchitecture();
|
||||
|
||||
if (m_dxvkDevice->extensions().extConservativeRasterization) {
|
||||
// We don't have a way to query uncertainty regions, so just check degenerate triangle behaviour
|
||||
info->ConservativeRasterizationTier = m_dxvkDevice->properties().extConservativeRasterization.degenerateTrianglesRasterized
|
||||
? D3D11_CONSERVATIVE_RASTERIZATION_TIER_2 : D3D11_CONSERVATIVE_RASTERIZATION_TIER_1;
|
||||
}
|
||||
} return S_OK;
|
||||
|
||||
case D3D11_FEATURE_D3D11_OPTIONS3: {
|
||||
|
@ -35,7 +35,7 @@ namespace dxvk {
|
||||
// we do not need to enable it in case the parameters are both 0.
|
||||
m_state.depthBiasEnable = desc.DepthBias != 0 || desc.SlopeScaledDepthBias != 0.0f;
|
||||
m_state.depthClipEnable = desc.DepthClipEnable;
|
||||
m_state.conservativeMode = VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT;
|
||||
m_state.conservativeMode = DecodeConservativeRasterizationMode(desc.ConservativeRaster);
|
||||
m_state.sampleCount = VkSampleCountFlags(desc.ForcedSampleCount);
|
||||
|
||||
m_depthBias.depthBiasConstant = float(desc.DepthBias);
|
||||
@ -189,10 +189,6 @@ namespace dxvk {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Conservative rasterization currently not supported
|
||||
if (pDesc->ConservativeRaster != D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
||||
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode) {
|
||||
switch (Mode) {
|
||||
case D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF:
|
||||
return VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT;
|
||||
case D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON:
|
||||
return VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT;
|
||||
}
|
||||
|
||||
Logger::err(str::format("D3D11: Unsupported conservative raster mode: ", Mode));
|
||||
return VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT;
|
||||
}
|
||||
|
||||
|
||||
VkShaderStageFlagBits GetShaderStage(DxbcProgramType ProgramType) {
|
||||
switch (ProgramType) {
|
||||
case DxbcProgramType::VertexShader: return VK_SHADER_STAGE_VERTEX_BIT;
|
||||
|
@ -31,6 +31,9 @@ namespace dxvk {
|
||||
VkCompareOp DecodeCompareOp(
|
||||
D3D11_COMPARISON_FUNC Mode);
|
||||
|
||||
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
||||
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode);
|
||||
|
||||
VkShaderStageFlagBits GetShaderStage(
|
||||
DxbcProgramType ProgramType);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user