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

Hdr colclip #688

Merged
merged 16 commits into from Aug 2, 2015
Merged

Hdr colclip #688

merged 16 commits into from Aug 2, 2015

Conversation

gregory38
Copy link
Contributor

This branch replaces the standard inaccurate colclip algo with a new version based on HDR rendering. I expect speed to be comparable however it reduces the likelihood to have an overflow of the color. This new algo also provides a good speed up of the high level of blending. Therefore I extend it to support properly destination alpha testing (fog effect) :)

Code really needs a good testing and also some performances measurement between the basic/medium/high level of blending accuracy. Maybe medium and high could be merged together.

The idea is to use a floating texture to accumulate the data and
then do a final postprocessing pass to apply the modulo

v2:
* use bounding box to
* fix vertex corruption issue
* use negative number in shader which allow to use half float (+12
  fps@4x)
Use countof macro (avoid to duplicate the size)
Fix the size of array
Remove useless alpha_stencil case
It is cumbersome to move code
Actually it can partially be done with GL_ARB_shader_image_load_store
extension. However all drivers that support shader_image have
texture barrier too.
Just clear bsel.abe to disable blending
Similar speed but more accurate

Allow to clean the code
Remove old shader define
Prefix macro with BLEND_
Add some notes to explain the special symbol
Avoid to hack it in the creation

Allow in the future to reuse the table directly instead of converting
in a blend object
The purpose is to emulate correctly destination alpha factor

An alpha channel of 128 is 1.0 in the GS but only ~0.5 in the GPU

I think few draw call use destination alpha so impact on perf must remains small.
@gregory38
Copy link
Contributor Author

@prafullpcsx2
It is your turn to work now :p

Seriously, I remember that FIFA used to need ultra accurate blend for the lighting effect on the ground. Could you try to play with the new blending level and check the speed impact?

@refractionpcsx2
Copy link
Member

I'm guessing the windows dialog will need updating?

@gregory38
Copy link
Contributor Author

No, I don't think so. It must be automatic based on the vector content.

@refractionpcsx2
Copy link
Member

Cool, that's good to know :)

@prafullpcsx2
Copy link
Contributor

I think you once explained what were the differences between all different blending units. Can you paste that post here also? I want to know whether Ultra means Full + FBMask or there are other differences too? I am asking this because Main FIFA games now give correct lighting effect (only on top half of the screen) with Full but they also require FBMask so I have to select Ultra as the option.

@gregory38
Copy link
Contributor Author

Hum, maybe if we remove the linux define, it will show a tooltip ;)

none => easy ;)
basic => fbmask + impossible blend + draws that do a single texture mapping without self-intersection (only require a texture flush so nearly free from a cpu PoV) + draws that don't need barrier (for example As*Cs)
Normally basic give you already lots of goodies with a very speed penality. Note, in this case the impossible blend are the one of the form (1 + X).

Medium: do it for all sprites rendering (because they're often use in post processing effect, note most of them are already covered in previous level. It just a small addition)

High: do the destination alpha blending too. Typically the game that could render better in DX9. This level also add the few remaining case of accurate color clipping (not sure one remains actually).

Full: run nearly everything on the shader (except some small corner case). It is the old ultra_accurate blend.
Ultra: nearly the same as full, it is only to test a different rounding of color (I expect similar result as full, barely faster).

High is the latest playable level from my point of view and it must emulate 95% of the effect correctly.

@prafullpcsx2
Copy link
Contributor

@gregory38 : FBMask isn't working with medium, Full & Ultimate. Is it the expected behaviour?

@gregory38
Copy link
Contributor Author

no

@prafullpcsx2
Copy link
Contributor

Working only with basic, high and ultra. But this was the first build that I compiled. So may be I messed up something on my side. Will reconfirm after testing with another build.

@gregory38
Copy link
Contributor Author

usual small regression :p nothing to see ;)

@prafullpcsx2
Copy link
Contributor

Compiled latest version and it's working fine now.

Here are some performance results:-

FIFA 2010 (to get correct field) - 61 fps then 66 fps now
God of war 2 (to get correct fog effect) - 26 fps then 72 fps now ( Unbelievable)
Kya - No noticeable difference at native resolution but at X3 resolution 55 fps then 65 fps now

@gregory38
Copy link
Contributor Author

OoO, if you're asthmatic (no offense) PC can handle blending at high level, I may need to remove the "high-end" part in the tool tip 👍
Could you compare the difference of perf between the different level of blending. Maybe medium&high can be merged together.

@gregory38
Copy link
Contributor Author

@prafullpcsx2 I pushed the 2 fixes of socom2 here. This way you have only a single build to test. I deeply hope it will work nicely.
Please recheck the performance too.

@prafullpcsx2
Copy link
Contributor

I found no regressions so far. Socom 2 text is also fixed. Performance is on par with builds before Socom 2 fix. Incase anyone else wants to test this here is Windows sse2 version:-

http://www.filedropper.com/gsdx32-sse2-hdrcolclip

@gregory38
Copy link
Contributor Author

@prafullpcsx2 could you check the shadows of hulk too?

@aphirst could you check this branch (you just need to compile GSdx) on your Intel driver. I want to be sure there is no massive regression due to the lack of texture barrier.

@prafullpcsx2
Copy link
Contributor

Hulk shadows are fine.

@aphirst
Copy link
Contributor

aphirst commented Aug 2, 2015

I did a build from this branch just now, and things seem to work just like before. I can provide some more specific detail if you need?

gregory38 added a commit that referenced this pull request Aug 2, 2015
@gregory38 gregory38 merged commit 8424c18 into master Aug 2, 2015
@gregory38 gregory38 deleted the hdr-colclip branch August 4, 2015 19:56
@karasuhebi
Copy link
Contributor

This might be a dumb question but are any of these changes going to affect the way color shows up in games? Are you making adjustments to the colors? Before I didn't think that but now you're even mentioning HDR so I'm wondering if colors will be less console-accurate now?

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.

None yet

5 participants