Commit Graph

278 Commits

Author SHA1 Message Date
Gregory Hainaut 78569ee833 gsdx-ogl: redo properly the setup of texture format
* add lengthly comment to explain the format
* Likely reduce the number of shader permutation
* Avoid slow AEM (on GPU)

Expect regressions because TC needs some fixes

v2: fix palette mode
2015-09-11 14:14:22 +02:00
Gregory Hainaut ca9b5ce11d gsdx-ogl: move depth conversion shader
Add 2 new shaders:
* ps_main12: cast a 16 bit depth to a RGB5A1 color
* ps_main16: cast a a RGB5A1 color to a 16 bit depth

Shader might be used in future commit as it seems Silent Hill uses this
kind of format.

Fix tab/indentation too
2015-09-08 12:41:05 +02:00
Gregory Hainaut bdc8038e7e glsl: set a size to gl_ClipDistance array
The purpose is to avoid issue on MS-Intel driver without
a dedicated hack in the compilation.

Code doesn't use it so I suspect others implement to discard the
statement.
2015-08-25 18:58:39 +02:00
Gregory Hainaut a1957a685d glsl: drop an useless min in FS
GPU will clamp color anyway. It reduces the number of instruction of 25% (4->3)
2015-08-25 18:58:39 +02:00
Gregory Hainaut bfadd884c9 glsl: expand tab into space
The mix of the 2 was awful
2015-08-22 13:34:02 +02:00
Gregory Hainaut a46c11b088 gsdx-ogl: delete various leftovers 2015-08-22 13:33:32 +02:00
Gregory Hainaut 7002ff3ec3 gsdx-ogl: move texture scale from vs_cb to fs_cb
It avoid useless update of the vs_cb.
2015-08-22 13:33:04 +02:00
Gregory Hainaut c5a786ed2c gsdx-ogl: remove support WMS/T == 2 in hardware unit
I think behavior was wrong because only first texel coordinate was clamped.

Beside we can't interpolate if AEM isn't yet applied
2015-08-20 23:01:43 +02:00
Gregory Hainaut 78dd957717 gsdx-ogl: use normalized index coordinate for palette texture
In palette mode, 90% of texture accesses are done in 8 bits.
So let's keep this path as light as possible. It reduces GPU load.
2015-08-20 23:01:43 +02:00
Gregory Hainaut 6b84a89b6a gsdx-ogl: remove old ati hack for point sampler
Was never used on openGL

In the future absolute coordinate will be use anyway
2015-08-18 19:09:45 +02:00
Miguel A. Colón Vélez 21c4e6caa6 Fix things found by lintian.
I: pcsx2: spelling-error-in-binary usr/lib/i386-linux-gnu/pcsx2/libGSdx-1.0.0.so allows to allows one to
I: pcsx2: spelling-error-in-binary usr/lib/i386-linux-gnu/pcsx2/libGSdx-1.0.0.so Allow to Allow one to
.
Apparently lintian checks grammar too (most common ones).
2015-08-17 22:00:07 -04:00
Gregory Hainaut bd0de8fbaf glsl: (colclip) HDR doesn't need wrapping neither clamping
Might save a couple of instruction in the PS
2015-08-08 09:18:09 +02:00
Gregory Hainaut d822b6bd1a gsdx-ogl: add some comments for the future 2015-08-08 09:17:06 +02:00
Gregory Hainaut b17803bb34 gsdx-ogl: wipeout of GL_ARB_bindless_texture
Code is completely broken. It doesn't help to improve speed.

Remove 200 lines ;)
2015-08-08 09:16:49 +02:00
Gregory Hainaut 36554c3375 Merge branch 'hdr-colclip-32bits' 2015-08-04 21:55:40 +02:00
Gregory Hainaut 45bb27d6db gsdx-ogl: extend HDR colclip to 32 bits texture
Unfortunately 16 bits wasn't enough for Castlevania.
2015-08-04 21:54:27 +02:00
Gregory Hainaut 744f9ebc09 gsdx-ogl: rare corner case when both texture shuffle and date are enabled
In texture shuffle mode the texture data is either RG or BA. It means
that DATE must either checks MSB of G or A.

Close #693
2015-08-04 20:10:44 +02:00
gabest11 542dd33169 Merge branch 'master' of https://github.com/pcsx2/pcsx2 2015-08-02 20:27:33 +02:00
gabest11 a1a842b07f gsdx: date/datm fix for 16-bit frame buffer in sw rendering mode 2015-08-02 20:21:49 +02:00
Gregory Hainaut 4a3c145c72 gsdx-ogl: depth support: better support of 16 bits z buffer
Fix issue in socom2
2015-08-01 01:28:41 +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 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 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 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 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
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 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 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 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 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
Gregory Hainaut 036cb229a3 glsl: add various comment for future idea
For example GL4 GPU supports special bit operation
2015-07-18 14:40:57 +02:00
Gregory Hainaut 36e83b42ce glsl: round texture and fragment color as the SW renderer
GS uses integer value and does integer operation too.

This commit trunc the sampled texture, the interpoled fragment color
and the product of the 2.

It impacts negatively the perf of about 3/4% (GPU) but it fixes rendering on
suikoden and potentially some others games too.
2015-07-17 21:08:49 +02:00
Gregory Hainaut 5f247a6e16 glsl: rewrite tfx function to ease future update
No need to put lots of ifdef, compiler will optimize everything
It increases a bit the readability
2015-07-17 21:08:49 +02:00
Gregory Hainaut ea9e608288 gsdx-ogl: fix texture palette mask 2015-07-17 21:08:49 +02:00
Gregory Hainaut b4c04ed00a gsdx-ogl: wipeout subroutine code
Code was completey bitrotten
Code was a partial test (and yet 500 lines already)
Shader is more and more complex and multithreading support greatly
reduce the cost of shader switch
2015-07-17 21:08:49 +02:00
Gregory Hainaut e3751f6cd9 glsl: disable computing of extra alpha coeff in SW blending
Hum, I'm curious of the impact to enable only this code when it is actually used.
2015-07-17 21:08:49 +02:00
Gregory Hainaut 784822a5c2 glsl: redo blending management to use A/B/C/D directly
1/ Code is much more readable
2/ It will allow to round differently the operation in the future
2015-07-17 21:08:49 +02:00
Gregory Hainaut 91fbe6f108 gsdx-ogl: add some code to fix black netting on some renderings
Code is not yet enabled because it requires extensive test

The idea is to replace point by a 1 pixels sprite with the help of
a geometry shader. In 4x, point will be replaced by a 4x4 sprite.
2015-07-11 14:35:35 +02:00
Gregory Hainaut 5e7ce63ed1 glsl: add a geometry shader to upscale GS_POINT
The purpose is to avoid upscaling issue on POINT rendering (black netting on some FMVs)
2015-07-11 14:35:34 +02:00
Gregory Hainaut 986754bde7 glsl: don't declare gl_FragDepth
Fix compilation issue on Mesa driver

(hope it doesn't break Catalyst)
2015-07-05 18:12:36 +02:00
Gregory Hainaut a9f49ab9ab glsl: fix rounding error for shadow computation
Better shadow on Castlevania/Nemo (others :) )
2015-07-01 09:36:54 +02:00
Gregory Hainaut 6121677aa1 gsdx-tc: use a single shader pass to convert texture in 8 bits format
It might save a couple of fps

Add a define to test the perf if we keep only the blue channel. It brokes
the code in Prince Of Persia that use the Red/Green channel... Maybe the
speed hack :( Or find a way to replace all if with a lookup table

Note: it is only supported on OpenGL currently
2015-07-01 09:36:54 +02:00
Gregory Hainaut e2727f10ba glsl: fix for AMD
I hope :)
2015-07-01 09:36:54 +02:00
Gregory Hainaut d29e375f72 gsdx-tc: GPU accelerate 8 bits texture conversion
Only native is supported currently
2015-07-01 09:36:54 +02:00
Gregory Hainaut db5468afcf glsl: fix shadow on Shin Megami Tensei Nocturne 2015-07-01 09:36:54 +02:00
Gregory Hainaut 839003467e gsdx-ogl: add support of partial frame buffer masking
It might help to fix a bit the color on a couple of games

accurate_fbmask = 1

Code uses GL4.5 extensions. So far it seems the effect is ony used a couple
of time and often in non-overlapping primitive. Speed impact will likely remain small
2015-07-01 09:36:53 +02:00
Gregory Hainaut 82818dab3c gsdx-ogl: make some room in AlphaCoefficient variable
The idea will be to use the remaining int to store the FB mask
2015-07-01 09:36:53 +02:00