Skip to content

Pushbuffer based rendering draft PR#2438

Draft
jackchentwkh wants to merge 503 commits into
Cxbx-Reloaded:masterfrom
jackchentwkh:pushbuffer_based_rendering
Draft

Pushbuffer based rendering draft PR#2438
jackchentwkh wants to merge 503 commits into
Cxbx-Reloaded:masterfrom
jackchentwkh:pushbuffer_based_rendering

Conversation

@jackchentwkh
Copy link
Copy Markdown
Contributor

This draft PR isn't for being merged with mater.
The purpose of this draft PR is for automatically building the branch so users can download the build binaries.

…ountered because the NV2A uses long jump as a subroutine return. this fixed the pushbuffer data corruption in Otogi1.
quad strip is actually using the same vertex order as triangle strip, so simply comert the pritimtive type from quad strip to triangle strip is enough.
updaet CxbxUpdateHostViewport() to pick up viewport from NV2A and use scales from NV2A when in pgraph draw calls.
add BackBufferScale support
polish CxbxrImpl_Swap(), a little bit.
…1.0,1.0) in HLE patched D3DDevice_Swap(), this fixed the viewport size in final swap pass.

  creating new host surface for buffer surface without getting xbox backbuffer. this prevent us getting in trouble when the title doesn't have D3DDevice_GetBackBuffer()
use D3DDevice_SetTexture() trampoline in
patched  D3DDevice_SwitchTexture()
…se token to sync implementation with pgraph.

correcting trampoline of XBTRMP(D3DDevice_SwitchTexture) since it's a __fastcall
revised texture stage texture cache to store pTexture in map.
…_0, D3DDevice_SetScreenSpaceOffset() with pgraph
…h pgraph.

todo: D3DDevice_SetTransform() might need to cache the matrix passed in with pMatrix.
… after sending sync token.

unpatch and reshape HLE sync code in D3DDevice_LoadVertexShader() and D3DDevice_SelectVertexShader() , this could enable future HLE patched api to work directly in sync with LLE
…DDevice_SetFlickerFilter() D3DDevice_SetFlickerFilter_0() D3DDevice_SetGammaRamp()

D3DDevice_SetSoftDisplayFilter()
…SelectVertexShader_4__LTCG_eax1 and update the token enum for ease of debugging.
@medievil1
Copy link
Copy Markdown
Contributor

was asked to post this here, apparently there some issues in master?? that seem to be fixed in this PT (however due to timing/syncing issues the game does not startup correctly, I disabled rdtsc patching to get it running at double speed)
image

Add HLE_PushInit(); to HLE_PushPrepare
@medievil1
Copy link
Copy Markdown
Contributor

medievil1 commented Dec 6, 2023

ok 2 changes needed to improve compatibility (or investigated why they make a big difference)
both in direct3d9.cpp
first simply add HLE_PushInit(); to the HLE_PushPrepare(X_D3DAPI_ENUM hleAPI, int dword_count) function @ 3294
and secondly change EmuKickOff(); to EmuKickOffWait(X_D3DDevice_EndPush);
@ 4144 (EndPush function)
it is even slightly mentioned as WAIT in the line before // this EmuKickOffWait() must be called in order to keep pushbuffer/HLE from race condition.

medievil1 and others added 9 commits December 8, 2023 05:26
....in EndPush was EmuKickOff should have been EmuKickOffWait(X_D3DDevice_EndPush)
…has a higher precedence than bitwise operator."
…butes (this might actually fix `BACKDIFFUSE` related rendering issues!)
…conversion from 'int' to 'uint8_t' requires a narrowing conversion"
…xbox::longlong_xt' to 'xbox::dword_xt' requires a narrowing conversion", by explicitly assigning to LARGE_INTEGER.QuadPart.

This, because the LARGE_INTEGER union initializer assigns its argument to the dword_xt LARGE_INTEGER.u.LowPart member, instead of to the obviously intended longlong_xt LARGE_INTEGER.QuadPart.

This can alternatively be solved by moving the QuadPart member above the u member, but I felt reluctant to do that, since that might cause unintentional side-effects.
… to X_D3DSurface (the code is already working with a surface)
@PatrickvL PatrickvL force-pushed the pushbuffer_based_rendering branch from 83a3f5f to c01bda1 Compare December 8, 2023 17:51
argv[3] used twice instead of 3 and 4
@ObiKKa
Copy link
Copy Markdown

ObiKKa commented Dec 25, 2023

Just copying in here my edited comment 1 week ago in the development thread of emulator's discord server, regarding other testers' notes (eg. Flynnyfoo) and screens on compat changes.

And added in a couple combined screenshots from that dev thread & the showcase thread.


Conflict: Desert Storm was playable or thereabouts for a long time. The US version was reported (on Cxbx-R's website) as playable 3 years ago. But I did remember there were model render problems.

Flynnyfoo's comment:

using medievils test build that adds a 1ns delay to HLE sync i can now make it in game in conflict desert storm 1, previous hit unhandled exception at main menu. game looks good with exception of character meshes being kinda invisible, if sun is facing towards you its completely invisible if in shadowed area can see outline of mesh

The US version of Disney Extreme Skate Adventure was reported to be playable 2 yrs ago. Oh well.
Flynnyfoo now says it gets in-game again.

The US version of one release of Tony Hawk's Pro Skater 4 was reported to be ingame 3 years ago. So unfortunately, the game has currently regressed as Flynnyfoo stated.

--
But that Sims 2 game being ingame is prob the first time any of us have ever known about it.
It had a report of only booting status 3 yrs ago.
The screen should be on this PB PR page.

Interestingly, according to what Flynnyfoo typed in the dev thread & the screen in showcase thread, the game, Kingdom Under Fire: Heroes, might be improved to playable from its old report of in-game status for the PAL version 2 years ago.
That screen should be on this PR page too.
Flynnyfoo stated that the unresponsive inputs during load screens are solved in this PR.

[End edited copy]

InCollage_20231226_050906588_optimized


Testers and coders regularly point out bugs with render timings and are trying to debug this new code. But hopefully, this PR or another replacement will eventually be merged and more fixes to come later.

medievil1 and others added 10 commits January 20, 2024 03:09
address review comment
everything in this branch crashes on startup unless there is some kind of delay here
Sleep(0) also works
key thing is the routine seems to try to run before everything is set
changed fog enable/ fog table code flow
FF templates, for some reason didn't take first time, comments should be fixed now
per discussion, created FloatFalse and FloatTrue, placed them more centrally in Direct3D9.h and adjusted fogEnable  variable setter... also corrected spacing on one line in the FF pixel shader template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake cmake graphics GPU and/or game graphics related HLE High Level Emulation informational useful information, not a bug kernel xbox kernel related LLE Low Level Emulation memory memory manager problem modules submodules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants