-
Notifications
You must be signed in to change notification settings - Fork 84
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
Update CreateVertexShader to fix missing textures #27
Conversation
Update from crosire master
- Updated CreateVertexShader to fix missing textures in some games such as Hitman 2 and Indiana Jones and the Emperor's Tomb - Updated return value for CopyRects, CreateVertexShader, GetVertexShaderDeclaration and CreatePixelShader. Removed 'E_FAIL' and 'E_NOTIMPL' and replaced them with 'D3DERR_INVALIDCALL'. These Direct3D APIs don't list 'E_FAIL' or 'E_NOTIMPL' as supported return values in the Microsoft documentation. - Fixed SetRenderState to call the correct D3DRENDERSTATETYPE when D3DRS_ZBIAS is used.
Nice work! As for the zbias to depthbias mapping - I choose the same mapping a few years ago - see https://github.com/PatrickvL/Dxbx/blob/master/Source/Delphi/src/DxbxKrnl/EmuD3D8/uConvert.pas#L436 this might contain other mappings that could be useful for this project (although to be honest, these weren't tested thoroughly, so I'm not 100% sure those mappings in there are entirely correct, but at least it's a reference that can be looked at, right?) |
Yes, changing It seems that the Boris/ENBSeries converter does something similar to what d3d8to9 does. Here is what ENBSeries does: case D3DRS_ZBIAS:
Biased = static_cast<FLOAT>(Value) * -0.0f;
Value = *reinterpret_cast<const DWORD *>(&Biased);
State = D3DRS_DEPTHBIAS;
SetRenderState(State, Value);
break; Whereas d3d8to9 does this: case D3DRS_ZBIAS:
Biased = static_cast<FLOAT>(Value) * -0.000005f;
Value = *reinterpret_cast<const DWORD *>(&Biased);
State = D3DRS_DEPTHBIAS;
SetRenderState(State, Value);
break; I am not quite sure which one is better. All five games I tested showed the same results no matter which one of these methods I used. So I took the simplest path. As far as the fix for |
There was a game (the first Max Payne I think) that would only write to certain components of some registers, leaving the rest uninitialized. Passing that code to the D3DX assembler would fail with an error, which is why the initialization happens. I don't know if this works even if |
I tested both Max Payne and Max Payne 2. Max Payne fails both with and without this change and never calls Max Payne 2 seems to run fine with d3d8to9 with this change. Let me know if there is some other issue with this change. It seems to work fine on all the games I have tested. |
Alright. Looks good then. |
CreateVertexShader
to fix missing textures in some games such as Hitman 2 Silent Assassin and Indiana Jones and the Emperor's Tomb.CopyRects
,CreateVertexShader
,GetVertexShaderDeclaration
andCreatePixelShader
. RemovedE_FAIL
andE_NOTIMPL
and replaced them withD3DERR_INVALIDCALL
. These Direct3D APIs don't listE_FAIL
andE_NOTIMPL
as supported return values in the Microsoft documentation.SetRenderState
to call the correctD3DRENDERSTATETYPE
whenD3DRS_ZBIAS
is used.