Commit Graph

1587 Commits

Author SHA1 Message Date
Gregory Hainaut eb0fa8c7dc gsdx-ogl: fix bad detection of overlapping
avoid rendering corruption with SW blending
2015-08-01 01:27:22 +02:00
Gregory Hainaut fff59f547d gsdx-ogl: fbmask regression! don't use bit operation with integer 2015-07-31 19:43:06 +02:00
Gregory Hainaut a0edcb58af gsdx-ogl: extend cclip blending level with destination alpha blending
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.
2015-07-31 09:45:28 +02:00
Gregory Hainaut 97b38d9e1b gsdx-ogl: directly set impossible mode in the blending table
Avoid to hack it in the creation

Allow in the future to reuse the table directly instead of converting
in a blend object
2015-07-31 09:45:28 +02:00
Gregory Hainaut 8554f32086 gsdx-ogl: clean the blend table
Remove old shader define
Prefix macro with BLEND_
Add some notes to explain the special symbol
2015-07-31 09:45:28 +02:00
Gregory Hainaut cfd0fd6cc8 gsdx-ogl: remove old colclip algo 2015-07-31 09:45:28 +02:00
Gregory Hainaut 93c47feb7c gsdx-ogl: replace old colclip algo with the HDR algo
Similar speed but more accurate

Allow to clean the code
2015-07-31 09:45:28 +02:00
Gregory Hainaut 83f874db93 gsdx-ogl: remove bsel.ps
Just clear bsel.abe to disable blending
2015-07-31 09:45:28 +02:00
Gregory Hainaut 25298c70f7 gsdx-ogl: move blending management into a separate function 2015-07-31 09:45:28 +02:00
Gregory Hainaut 25bd5f5e85 gsdx-ogl: request texture barrier to emulate accurate date
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.
2015-07-31 09:45:28 +02:00
Gregory Hainaut 2901e94ebc gsdx-ogl: always bind the RT as input texture
To avoid code duplication
2015-07-31 09:45:28 +02:00
Gregory Hainaut 1fe3e04ce3 gsdx-ogl: don't alias m_env/m_context variable
It is cumbersome to move code
2015-07-31 09:45:28 +02:00
Gregory Hainaut 8f27a5a92b gsdx-ogl: only enable fast accurate colclip in level3
Until we drop the old method
2015-07-31 09:45:05 +02:00
Gregory Hainaut 83dfc6b633 gsdx-ogl: clean a bit selector code
Use countof macro (avoid to duplicate the size)
Fix the size of array
Remove useless alpha_stencil case
2015-07-30 18:36:05 +02:00
Gregory Hainaut e026f1bac6 gsdx-ogl: implement a fast accurate colclip algo
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)
2015-07-30 18:34:52 +02:00
Gregory Hainaut aa8f5848d1 gsdx-ogl: always issue a barrier when requested
Safer this way
2015-07-30 18:24:36 +02:00
refractionpcsx2 28fbae4791 gsdx-gui: Tidy up GUI options 2015-07-30 18:24:32 +02:00
Gregory Hainaut 88bd0996f5 gsdx-ogl: only print same tex/rt message when prims overlaps
Avoid most of the false positive
2015-07-30 18:24:32 +02:00
Akash 350e373e3f gsdx-gui: Remove Aggressive CRC hack.
The option is pretty much useless, CRC hack level controls the usage of hacks already.
2015-07-30 18:24:28 +02:00
Akash 68833e10d1 gsdx-gui: Accurate blending unit for Windows.
The following patch merges all the Accurate options related to the blending unit into a single one.
2015-07-30 18:24:19 +02:00
Gregory Hainaut d191ae4aba glsl: use rounding in convert 4 shader
It will avoid texture rouding error with negative number
2015-07-30 18:22:59 +02:00
Gregory Hainaut 7b9fa8fbe5 gsdx-ogl: add an assertion that will save me 2015-07-30 18:22:59 +02:00
Gregory Hainaut 46a1525668 gsdx-ogl: support various texture format creation
Such as GL_RGBA32F/GL_RGBA16F/GL_RGBA16UI/GL_RGBA16I/GL_RGBA16

Not yet used
2015-07-30 18:22:59 +02:00
Gregory Hainaut ee9edb0b19 gsdx-ogl: create a copy rect with conversion function
Previous CopyRect function does a memcopy without conversion.

This function will allow to use different format for input/output. Just a
possibility for the future
2015-07-30 18:22:59 +02:00
Gregory Hainaut ae8df002af gsdx-ogl: optimize Cs * As + Cd and Cs * Af + Cd blending
Basically the code does the alpha multiplication in the shader therefore
the blend unit only does a pure addition. This way the multiplication is
accurate and accurate_blending doesn't requires a costly barrier.

This code also avoid variable duplication to make the code more separated.
Hopefully blending can be done in a separated function

It is preliminary work to support fast color clipping with HDR

v2: fix assertion compilation failure

v3: fix regression in not accurate mode

v3: Cs * As/Af is not an accumulation

Those cases don't need the Cd addition and were already optimized anyway

Fix a regression on GoW2
2015-07-30 18:22:59 +02:00
Gregory Hainaut 12fdc37599 gsdx-ogl: reorganize blending in the renderer
Do DATE algo selection before blending. This way we can detect bad
interaction.

Regroup all blending/colclip in a single block.  Avoid to check abe &&
rt multiple times.

v2: only enable sw blending when abe is true
2015-07-30 18:21:01 +02:00
Gregory Hainaut caadc73e1b gsdx-ogl: add a new level for accurate blending
The updated medium level will run for all sprites. It helps sotc blooming effect and it remains
fast enough to be enabled by default (at least on 3D games)
The new high level will run for all sprites + color clipping
2015-07-30 18:21:01 +02:00
Gregory Hainaut 95c374bbcc glsl: Round 0.95+ to 1 for texel colors
It improves SotC blooming. Suikoden seems to be fine too.
2015-07-30 18:21:01 +02:00
Gregory Hainaut 01a1b1a5e6 gsdx-ogl: add the code to handle point and line in SW blending 2015-07-30 18:21:01 +02:00
Gregory Hainaut a85894e159 gsdx-ogl: move texture shuffle and fbmask into a dedicated function
DrawPrims is really too big now
2015-07-30 18:21:01 +02:00
Gregory Hainaut b632b2a478 gsdx-linux: add a new combo box to select the blend accuracy level 2015-07-30 18:21:00 +02:00
Gregory Hainaut 5c1b8986c6 gsdx-ogl: use SW blending when no barrier is required
Speed penality is small (only GPU) but it is more accurate
2015-07-30 18:21:00 +02:00
Gregory Hainaut 8c8fe633a5 gsdx-ogl: merge 3 accurate* option into a nice combobox
It is much easier to configure this way
2015-07-30 18:21:00 +02:00
Gregory Hainaut 8da63cf95a gsdx-ogl: try to enable sw blending for sprite rendering
The idea is that sprites are often use for post-processing effect (ofc except 2D games)

Most of the time post-processing supports SW blending with a small speed penality. SW
blending is more accurate so it is better to use it.
2015-07-30 18:21:00 +02:00
Gregory Hainaut f4e881ad30 gsdx: always set texture shuffle flag
Avoid bad effects in 16 bits RT games
2015-07-30 09:15:04 +02:00
Miguel A. Colón Vélez e4ab71abf3 Add authors comment that suggest public-domain license.
Sourceforge was dead for more than a week therefore add the license
information. I could not find the original TGM source (dead link) so I'm not
even sure if this still applies or if the glsl was totally rewritten. None
of the glsl files have a copyright header so it's hard to tell.
2015-07-27 14:21:29 -04:00
Gregory Hainaut f2c77ffa08 gsdx:tc: detect texture shuffle in previous frame
GoW2 uses the effect at the start of a new frame and therefore need the
state of the previous frame. (Note 1 issue remains)

Ricky need to be tested.
2015-07-26 10:14:07 +02:00
Gregory Hainaut cb4af8fe83 gsdx-ogl: small optimization for the GPU
Gain: 1% at 4x on SotC (it partially compensates recent additions)

When the color is constant and equal to 128, the MODULATE mode is
equivalent to the DECAL mode. It saves 5 instructions on the FS.
2015-07-21 08:19:36 +02:00
Gregory Hainaut 7ca463bf75 gsdx: NaN is likely not well supported for S & T
Add also a comment to explain the NaN issue on Q
2015-07-21 08:19:36 +02:00
Gregory Hainaut 223b7daa1d gsdx-ogl: fix fbmask regression
I forget to remove an useless 255.0f factor
2015-07-19 23:55:27 +02:00
Gregory Hainaut a54e636364 gsdx-linux: add a tooltip for the filtering option 2015-07-19 23:27:45 +02:00
Gregory Hainaut 5c740ff41e gsdx-ogl: wipeout AlphaStencil & Alpha hack
Accurate options do a better jobs. Technically it can still
be useful for old gpu/driver that doesn't support the GL4.5 extension.

On Windows, you can still rely on Dx

On linux, free driver support it (except Intel)
2015-07-19 22:43:48 +02:00
Gregory Hainaut 759e75091a gsdx-gui: yes openGL support correctly 8 bits texture 2015-07-19 17:29:25 +02:00
Gregory Hainaut 6719fc89a6 gsdx-sw: Nan is not well supported in Vertex
It fixes the bad light on Silent Hill with the SW renderer.

Full story
if Q is NaN, m_vt.m_eq.q becomes wrongly true
/Q will wrongly be optimized in the "Vertex Shader" of the SW

Note: Add an assert for the STQ handler

Code path is quite hot so no need to add extra check for nothing
2015-07-19 16:41:05 +02:00
Gregory Hainaut 7f76883b98 Merge pull request #658 from ssakash/patch-34
Add Accurate Frame Buffer mask for Windows [GUI] and remove some old options.
2015-07-19 09:07:13 +02:00
Gregory Hainaut 38c086008d glsl: round blending as SW renderer
Better tone on God of War with ultra accurate mode
2015-07-18 17:16:46 +02:00
Gregory Hainaut 88cd333839 gsdx-ogl: don't enable both HW&SW blending 2015-07-18 16:15:52 +02:00
Gregory Hainaut c4e165067d glsl: use signed integer when working with substraction...
It mostly fixes rendering of GoW with ultra blending

Color is still a bit wrong but rounding is likely incorrect
2015-07-18 14:41:03 +02:00
Gregory Hainaut c701ab4368 glsl: don't use normalized value for color range
Globally shader uses less intruction (except blending part)

It would also allow to improve the rounding of color
2015-07-18 14:41:03 +02:00
Gregory Hainaut 57394a03e0 partially revert: glsl: disable computing of extra alpha coeff in SW blending
It generates undefined data in screen. Maybe blending isn't switch off properly.
I need to investigate it.
2015-07-18 14:41:03 +02:00