mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 07:24:15 +01:00
[d3d11] Use FORCE_UNORM depth bias representation for UNORM formats
This commit is contained in:
parent
b30a4f0cc7
commit
6f87ccdafc
@ -3389,8 +3389,24 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
static VkDepthBiasRepresentationEXT FormatToDepthBiasRepresentation(DXGI_FORMAT format) {
|
||||
switch (format) {
|
||||
default:
|
||||
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
|
||||
case DXGI_FORMAT_D32_FLOAT:
|
||||
return VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT;
|
||||
|
||||
case DXGI_FORMAT_D24_UNORM_S8_UINT:
|
||||
case DXGI_FORMAT_D16_UNORM:
|
||||
return VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename ContextType>
|
||||
void D3D11CommonContext<ContextType>::BindFramebuffer() {
|
||||
DxvkDepthBiasRepresentation depthBiasRepresentation =
|
||||
{ VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT,
|
||||
m_device->features().extDepthBiasControl.depthBiasExact };
|
||||
DxvkRenderTargets attachments;
|
||||
uint32_t sampleCount = 0;
|
||||
|
||||
@ -3411,12 +3427,17 @@ namespace dxvk {
|
||||
m_state.om.dsv->GetImageView(),
|
||||
m_state.om.dsv->GetRenderLayout() };
|
||||
sampleCount = m_state.om.dsv->GetSampleCount();
|
||||
|
||||
if (m_device->features().extDepthBiasControl.leastRepresentableValueForceUnormRepresentation)
|
||||
depthBiasRepresentation.depthBiasRepresentation = FormatToDepthBiasRepresentation(m_state.om.dsv->GetViewFormat());
|
||||
}
|
||||
|
||||
// Create and bind the framebuffer object to the context
|
||||
EmitCs([
|
||||
cAttachments = std::move(attachments)
|
||||
cAttachments = std::move(attachments),
|
||||
cRepresentation = depthBiasRepresentation
|
||||
] (DxvkContext* ctx) mutable {
|
||||
ctx->setDepthBiasRepresentation(cRepresentation);
|
||||
ctx->bindRenderTargets(Forwarder::move(cAttachments), 0u);
|
||||
});
|
||||
|
||||
|
@ -1953,6 +1953,11 @@ namespace dxvk {
|
||||
enabled.core.features.shaderFloat64 = supported.core.features.shaderFloat64;
|
||||
enabled.core.features.shaderInt64 = supported.core.features.shaderInt64;
|
||||
|
||||
// Depth bias control
|
||||
enabled.extDepthBiasControl.depthBiasControl = supported.extDepthBiasControl.depthBiasControl;
|
||||
enabled.extDepthBiasControl.depthBiasExact = supported.extDepthBiasControl.depthBiasExact;
|
||||
enabled.extDepthBiasControl.leastRepresentableValueForceUnormRepresentation = supported.extDepthBiasControl.leastRepresentableValueForceUnormRepresentation;
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,10 @@ namespace dxvk {
|
||||
return mask;
|
||||
}
|
||||
|
||||
DXGI_FORMAT GetViewFormat() const {
|
||||
return m_desc.Format;
|
||||
}
|
||||
|
||||
D3D10DepthStencilView* GetD3D10Iface() {
|
||||
return &m_d3d10;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user