From 36907ec01ca28c165235c2026b6bdcd29ab24f82 Mon Sep 17 00:00:00 2001 From: WinterSnowfall Date: Mon, 30 Sep 2024 22:58:31 +0300 Subject: [PATCH] [d3d8] Adjust shader handles to skip 0x0001 --- src/d3d8/d3d8_device.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d3d8/d3d8_device.cpp b/src/d3d8/d3d8_device.cpp index af9f0997..154c4f07 100644 --- a/src/d3d8/d3d8_device.cpp +++ b/src/d3d8/d3d8_device.cpp @@ -18,7 +18,7 @@ namespace dxvk { static constexpr DWORD getShaderIndex(DWORD Handle) { if ((Handle & D3DFVF_RESERVED0) != 0) { - return (Handle & ~(D3DFVF_RESERVED0)) >> 1; + return ((Handle & ~(D3DFVF_RESERVED0)) >> 1) - 1; } else { return Handle; } @@ -1657,7 +1657,7 @@ namespace dxvk { if (likely(SUCCEEDED(res))) { // Set bit to indicate this is not an FVF - *pHandle = getShaderHandle(m_vertexShaders.size() - 1); + *pHandle = getShaderHandle(m_vertexShaders.size()); } return res; @@ -1858,7 +1858,7 @@ namespace dxvk { if (likely(SUCCEEDED(res))) { m_pixelShaders.push_back(pPixelShader); // Still set the shader bit, to prevent conflicts with NULL. - *pHandle = getShaderHandle(m_pixelShaders.size() - 1); + *pHandle = getShaderHandle(m_pixelShaders.size()); } return res;