Skip to content
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

Dx9 depal - needs debugging before merge #6920

Merged
merged 9 commits into from
Mar 1, 2015
Merged

Dx9 depal - needs debugging before merge #6920

merged 9 commits into from
Mar 1, 2015

Conversation

hrydgard
Copy link
Owner

Pretty much the same as GL ES 2.0 depalettization.

Doesn't work yet though, hope someone else can spot what's wrong.

@unknownbrackets
Copy link
Collaborator

I found several things, but not working yet... hmm. Will send a pull.

-[Unknown]

pD3Ddevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
pD3Ddevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
pD3Ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pD3Ddevice->SetFVF(D3DFVF_XYZ | D3DFVF_TEX0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"D3DFVF_TEX0" means "I have 0 texture coordinates in the vertices", I think this ought to be D3DFVF_TEX1. I still don't think that will fix it.

-[Unknown]

@unknownbrackets
Copy link
Collaborator

I don't know what's going wrong here. In 3rd Birthday, if I alter the shader to just return index, I get completely the wrong thing. But the texture/etc. seems to be bound... arg. Sometimes it even shows an older version of the framebuffer...

Not sure if somehow a temp fbo/surface is being bound, or if something needs to sync for render to texture...

-[Unknown]

@sum2012
Copy link
Collaborator

sum2012 commented Sep 28, 2014

This branch need rebase

@DonelBueno
Copy link

Is this PR still relevant?

Doesn't DX9 already have depalettization?

@unknownbrackets
Copy link
Collaborator

No, it doesn't. This is still relevant but it doesn't work, and we still haven't figured out why. I think it ought to work...

-[Unknown]

@unknownbrackets
Copy link
Collaborator

Interestingly, #2917 in Direct3D isn't actually corrected by this, though it makes it better. The artifacts are like horizontal stripes with this change.

The reason that is interesting is that Brave Story doesn't use depal, it just uses render-to-self (which is also covered by this pull request.) So, that seems to indicate there's a problem with the render copy stuff, instead of / in addition to the depal.

Here's a version merged with master, conflicts resolved:
https://github.com/unknownbrackets/ppsspp/tree/dx9-depal

-[Unknown]

@unknownbrackets
Copy link
Collaborator

I'm wrong, debugging it more, the stripes are caused by off-by-one errors or something. It draws horizontal boxes from top to bottom to darken the texture, and there's some overlap or underlap on how they are drawn, even though the vertices are clean and exact.

#7206 seems to actually help that slightly, but it's still off. The game uses throughmode and draws 8px tall slices, which don't exactly line up.

But shouldn't the projection translation affect all points equally anyway? I'm not clear on how that could affect overlap.

-[Unknown]

@hrydgard
Copy link
Owner Author

One would think so, yes, although occasionally when using point sampling and sampling exactly on the border between texels you can get very strange off-by-one effects due to rounding errors...

@unknownbrackets
Copy link
Collaborator

Removing the offset float texel_offset = ((float)clutBase - 0.5f) / texturePixels; gets me more correctish colors but still wrong. Hmm. At least it's like sorta working now with #7208...

-[Unknown]

@unknownbrackets
Copy link
Collaborator

I think I may have it (somewhat) working, but I found a totally different problem. The game I'm testing depal with is that Dragon Ball Z one, since it's pretty obvious when depal is not working.

The game clears the stencil and depth buffer every frame, but not the color buffer. It does this in the pretty standard way of several vertical boxes. Depth and stencil are cleared, but alpha is not. I've tried messing with the masks and blending, but it didn't help... and there's no d3d errors.

Not sure why that's happening...

-[Unknown]

@unknownbrackets
Copy link
Collaborator

So, I think this actually works. Dragon Ball Z doesn't work because absdiff is missing.

I say merge.

-[Unknown]

hrydgard added a commit that referenced this pull request Mar 1, 2015
Dx9 depal - needs debugging before merge
@hrydgard hrydgard merged commit c0450f7 into master Mar 1, 2015
@hrydgard hrydgard deleted the dx9-depal branch March 1, 2015 20:04
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.

4 participants