Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d3d9: Use a different rvalue for depth bias on NV #3042

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,8 @@ namespace dxvk {
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);

if (ds != nullptr) {
float rValue = GetDepthBufferRValue(ds->GetCommonTexture()->GetFormatMapping().FormatColor);
const int32_t vendorId = m_dxvkDevice->adapter()->deviceProperties().vendorID;
float rValue = GetDepthBufferRValue(ds->GetCommonTexture()->GetFormatMapping().FormatColor, vendorId);
if (m_depthBiasScale != rValue) {
m_depthBiasScale = rValue;
m_flags.set(D3D9DeviceFlag::DirtyDepthBias);
Expand Down
6 changes: 3 additions & 3 deletions src/d3d9/d3d9_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ namespace dxvk {

void ConvertRect(RECT rect, VkOffset2D& offset, VkExtent2D& extent);

inline float GetDepthBufferRValue(VkFormat Format) {
inline float GetDepthBufferRValue(VkFormat Format, int32_t vendorId) {
switch (Format) {
case VK_FORMAT_D16_UNORM_S8_UINT:
case VK_FORMAT_D16_UNORM:
return float(1 << 16);
return vendorId == 0x10de ? float(1 << 15) : float(1 << 16);

case VK_FORMAT_D24_UNORM_S8_UINT:
return float(1 << 24);
return vendorId == 0x10de ? float(1 << 23) : float(1 << 24);

default:
case VK_FORMAT_D32_SFLOAT_S8_UINT:
Expand Down