-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
zfreeze #1812
zfreeze #1812
Conversation
This needed some actual testing. The following results are real and not fake. Mario Power Tennis works on D3D except for a giant white triangle that covers part of the court screen. Shadows draw correctly. Only works at 1x IR, and apparently this isn't right as well. Gimmick Courts suffer from severe zfighting and white boxes flickering off the court. On OGL the court covers up most of the screen, akin to the software renderer implementation. Need for speed Hot Pursuit 2 shadow works and draws correctly, except it's drawing over the car itself. NBA Street v3 has the same behavior as Need For Speed Hot Pursuit 2 with shadows drawing over the players in this case. Super Mario Strikers has the static shadows work, but the object shadows (blue shells and whatnot) exhibit the EA problem of drawing on top of everything. Working Titles Star Wars Rogue Squadron 2 - Perfect |
I am getting this pixel shader error in Rogue Squadron 3: http://prntscr.com/5nk2rm |
@@ -690,6 +690,24 @@ void VertexShaderManager::ResetView() | |||
bProjectionChanged = true; | |||
} | |||
|
|||
void VertexShaderManager::TransformToClipSpace(const float* data, float *out) | |||
{ | |||
const float *world_matrix = (const float *)xfmem.posMatrices + g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Linktothepast Could you pastebin a copy of bad_ps_0003.txt? |
I deleted that because they piled up, but i made a new one. It happened with d3d btw... |
With open gl i got this instead: http://prntscr.com/5nn5j1 |
I need the bad*.txt dumps, otherwise I can't possibly diagnose the problem. |
A paste of the above opengl vertexshader error: |
Well, that is completely broken. Missing a huge chunk of the vertex shader. I don't think the errors are related to this branch. |
So, we're down to Mario Power Tennis and Super Mario Strikers having issues in D3D at this point. |
OpenGL is now working as well as D3D. The one non-working case in both backends is Mario Power Tennis's Delfino Plaza Court. Every other case is working properly. |
if (s_bEFBScaleChanged) { | ||
dirty = true; | ||
constants.efbscale[0] = 1.0f / float(Renderer::EFBToScaledXf(1)); | ||
constants.efbscale[1] = 1.0f / float(Renderer::EFBToScaledYf(1)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
} | ||
|
||
// if cull mode is CULL_ALL, ignore triangles and quads | ||
if (bpmem.genMode.cullmode == GenMode::CULL_ALL && current_primitive_type == PRIMITIVE_TRIANGLES) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Been testing; the only problems left are in Mario Power Tennis, it seems. The Blooper Court seems to have minor issues (possibly not related to zfreeze) and Delfino Plaza Court (severe zfighting issues) and all the other games are acting correctly it seems. There may be super minor stuff that I'm missing due to having to test 12 games, but, it seems fine to me. |
This is awesome work. Congrats ya'll! :) 👍 |
Good progress phire... I did try this build out though and it doesn't seem to be working completely
Am I missing something in my setup? Tested OGL and D3D, OGL works better |
Could you provide details of your exact GPU and drivers? It's entirely possible (and potentially very annoying) that this solution only works on certain models of GPU. |
hmmm I'm sure it's something on my end because I pulled the built exe from the RS2 thread and it's fine, so maybe I didn't grab the correct code when I built it! :) Sorry about the panic attack! |
Have you cheked the interaction of zfreeze with early z? |
Found the cause of those pixel shader errors, it was per pixel lighting, with it disabled it works fine here. |
@Linktothepast What is the error? Sounds like something is wrong with the pixel shader generation. |
See comments from me above, they have all the info. It seems that per pixel lighting was the cause. |
That shader is so broken I'm not sure how that could even happen. Looks like either Dolphin crashed very badly while outputting the shader or the dump has become corrupted for other reasons. I mean it literally cut off const strings. |
Reporting in here... I was trying to see what was up with the Delfino Gimmick Court in Mario Tennis, but can't find the exact cause... obviously the decals on the court and the mud are being rendered at the same depth causing z-fighting, so it looks like we are somehow missing some zfreeze reference polies, it's very odd this is the only problem, though if you look close enough at the shadows on the first court you can see the chairs and the shadows for the toads have z-fighting going on. I also encountered a huge slow down in Rebel Strike in the "Deception at Destrillion" mission once you get into the sphere trap area after the corridor. The spacebox doesn't render properly and the game goes form 60fps down to 8-11 fps with heavy graphical glitches in the background. I'll let you know if I find anything else out! |
float a = DF31 * -dy12 - DF21 * dy31; | ||
float b = dx31 * DF21 + dx12 * DF31; | ||
float c = -dx12 * dy31 - dx31 * -dy12; | ||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Ok thanks for your feedback i will post a bug report about the crash when mmu is enabled. |
Initial port of original zfreeze branch (3.5-1729) by neobrain into most recent build of Dolphin. Makes Rogue Squadron 2 very playable at full speed thanks to recent core speedups made to Dolphin. Works on DirectX Video plugin only for now. Enjoy! and Merry Xmas!!
Based on the feedback from pull request dolphin-emu#1767 I have put in most of degasus's suggestions in here now. I think we have a real winner here as moving the code to VertexManagerBase for a function has allowed OGL to utilize zfreeze now :) Correct use of the vertex pointer has also corrected most of the issue found in pull request dolphin-emu#1767 that JMC47 stated. Which also for me now has Mario Tennis working with no polygon spikes on the characters anymore! Shadows are still an issue and probably in the other games with shadow problems. Rebel Strike also seems better but random skybox glitches can show up.
Results are still not correct, but things are getting closer. * Don't cull CULLALL primitives so early so they can be used as reference planes. * Convert CalculateZSlope to screenspace coordinates. * Convert Pixelshader to screenspace coordinates (instead of worldspace xy coordinates, which is totally wrong) * Divide depth by 2^24 instead of clamping to 0.0-1.0 as was done before. Progress: * Rouge Squadron 2/3 appear correct in game (videos in rs2 save file selection are missing) * Shadows draw 100% correctly in NHL 2003. * Mario golf menu renders correctly. * NFS: HP2, shadows sometimes render on top of car or below the road. * Mario Tennis, courts and shadows render correctly, but at wrong depth * Blood Omen 2, doesn't work.
OpenGL requires the y coordinates to be flipped. Also refactored PixelGen code to remove duplicate code.
- Calculate ZSlope every flush but only set PixelShader Constant on Reset Buffer when zfreeze - Fixed another Pixel Shader bug in D3D that was giving me grief
This is closer to what the hardware does anyway.
Had to re-do *ShaderManager so they saved their constant arrays instead of completly rebuilding them on restore state.
@@ -89,6 +89,8 @@ void VertexManager::ResetBuffer(u32 stride) | |||
buffer = s_indexBuffer->Map(MAXIBUFFERSIZE * sizeof(u16)); | |||
IndexGenerator::Start((u16*)buffer.first); | |||
s_index_offset = buffer.second; | |||
|
|||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
// Global matrix ID. | ||
u32 mtxIdx = g_main_cp_state.matrix_index_a.PosNormalMtxIdx; | ||
PortableVertexDeclaration vert_decl = format->GetVertexDeclaration(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Also: * Implement support for per-vertex PosMatrixIndex * Only update zslope constant once when zfreeze is activated. * Added a bunch of comments.
@dolphin-emu-bot rebuild |
Ok, we are 99.8% finished. I'm just worried about those failures with llvmpipe on fifoci. I don't have a clean code-path for cull-all triangles and bufferstorage, I suspect they are interacting badly.
|
Instead we keep the loaded vertices in CPU memory.
And Finished. |
As soon as @degasus gives the last commit a look over this can be merged. |
FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:
automated-fifoci-reporter |
#yolo #hype |
// is enabled in the following flush. | ||
for (unsigned int i = 0; i < 3; ++i) | ||
{ | ||
u8* vtx_ptr = s_pCurBufferPointer - vert_decl.stride * (3 - i); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This has been a long journey but zfreeze is finished.
This PR contains code from neobrain, NanoByte011 and phire.
Changes since #1767
Known Issues:
Todo: