Skip to content

Conversation

polymetal0
Copy link

@polymetal0 polymetal0 commented Feb 4, 2025

I have reuploaded this PR because renaming my fork's branch automatically closed the other one.

RECAP

  • Added NV_PGRAPH_CONTROL_3_TEXTURE_PERSPECTIVE_ENABLE and NV_PGRAPH_ZCOMPRESSOCCLUDE_CULL_NEAR_FAR_EN
  • Removed vtx_inv_w and vtx_inv_w_flat
  • Implement clipping and [-1, 1] clip volume change for ogl from frag shader
  • Added depth buffer shader variable to store w coordinate
  • Apply zbias to w buffer

Fixes/shows progress (captures taken in Vulkan, 2x)
W_param tests
https://github.com/abaire/nxdk_pgraph_tests_golden_results/tree/main/W_param
PR
w_gaps
xemu-2025-01-11-23-13-46
w_neg_strip
xemu-2025-01-11-23-13-50
w_pos_strip (fixed)
xemu-2025-01-11-23-14-04

ZMinMaxControl tests
https://github.com/abaire/nxdk_pgraph_tests_golden_results/tree/main/ZMinMaxControl
PR
Ctrl_NEARFAR_ZCLAMP
Ctrl_NEARFAR_ZCLAMP_IgnW
Ctrl_NEARFAR_ZCULL
Ctrl_NEARFAR_ZCULL_IgnW
Ctrl_WBuf_NEARFAR_ZCLAMP
Ctrl_WBuf_NEARFAR_ZCLAMP_IgnW
Ctrl_WBuf_NEARFAR_ZCULL
Ctrl_WBuf_NEARFAR_ZCULL_IgnW
Ctrl_WBuf_ZCLAMP
Ctrl_WBuf_ZCLAMP_IgnW
Ctrl_WBuf_ZCULL
Ctrl_WBuf_ZCULL_IgnW
Ctrl_ZCLAMP
Ctrl_ZCLAMP_IgnW
Ctrl_ZCULL
Ctrl_ZCULL_IgnW
CtrlFixed_NEARFAR_ZCLAMP
CtrlFixed_NEARFAR_ZCLAMP_IgnW
CtrlFixed_NEARFAR_ZCULL
CtrlFixed_NEARFAR_ZCULL_IgnW
CtrlFixed_WBuf_NEARFAR_ZCLAMP
CtrlFixed_WBuf_NEARFAR_ZCLAMP_IgnW
CtrlFixed_WBuf_NEARFAR_ZCULL
CtrlFixed_WBuf_NEARFAR_ZCULL_IgnW
CtrlFixed_WBuf_ZCLAMP
CtrlFixed_WBuf_ZCLAMP_IgnW
CtrlFixed_WBuf_ZCULL
CtrlFixed_WBuf_ZCULL_IgnW
CtrlFixed_ZCLAMP
CtrlFixed_ZCLAMP_IgnW
CtrlFixed_ZCULL
CtrlFixed_ZCULL_IgnW

Comments: clipping planes match HW behavior at 1x but are a bit off at higher scales (most likely unrelated). Near/far custom clipping planes are incorrect; they're hardcoded to test behavior and to approach HW results. OGL shows erratic behavior when running fixed function tests specifically, as shown here (fixed in the latest commit)

I'm leaving it here. "NEARFAR" feature is implemented but not fixed, left some comments in the code. I'll fix it in another PR if I find a solution, or let someone else beat me to it

Passing clipRange variable as a uniform and performing perspective divide in fragment shader for z_perspective = true solves the see through issue that affects many games.

Shader code for z_perspective = false is virtually unaltered.
They are still there, but unused
- z_perspective refactor to PixelShader and texture_perspective var added
- vtx_inv_w and vtx_inv_w_flat vars totally removed
- Fixes warping of textures from previous commit w/o breaking tests
- Also fixes dashboard menu background regression
This reverts commit 4da74db.
- Regression of some fixed missing shadows from xemu-project#577, identified the source of the problem
Restores shadows for many games in xemu-project#577 w/o removing the Xbox dashboard background
Do not specify cull mode if NV_PGRAPH_SETUPRASTER_CULLENABLE = false
Partially fixes fixed function, w-buffer, z cull tests
- Discard fragments from shader
- Implemented zbias when w-buffering
- Clipping volume change to [-1 , 1] for OGL moved to frag shader to avoid floating point precission loss
- Added parameter NV097_SET_ZMIN_MAX_CONTROL_CULL_NEAR_FAR_EN_TRUE
- Added depth buffer variable to shaders to store w coordinate
- They are there just to test behavior and most likely incorrect, but close enough to HW. It's a good starting point for future work
- Fixed texture perspective issue in fixed function
@crashGG
Copy link

crashGG commented Feb 4, 2025

You really scared me. I thought such a good PR was closed because there was no response for a long time...

- This fixes OGL not refreshing display properly when running some tests
@mborgerson
Copy link
Member

mborgerson commented Feb 10, 2025

Like your PR #1896, this PR appears to contain unsubmitted work in progress from @coldhex's development branch... As I commented on #1896, the unattributed work of others mixed with your original work cannot be accepted into the project. For this reason, I'll move this PR into draft state for now.

@mborgerson mborgerson marked this pull request as draft February 10, 2025 22:24
@polymetal0
Copy link
Author

Like your PR #1896, this PR appears to contain unsubmitted work in progress from @coldhex's development branch... As I commented on #1896, the unattributed work of others mixed with your original work cannot be accepted into the project. For this reason, I'll move this PR into draft state for now.

It's not like that in this case. In fact, I submitted this before the branch you're citing was submitted. I did use some of his work as I said back in #1707, but that branch was quite different since it wasn't implemented for Vulkan yet, which I did. That and the implementation of the texture_perspective variable (which I needed to avoid texture warping) are the only things I used from his branch. Any other resemblance is coincidental.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants