Commit Graph

108 Commits

Author SHA1 Message Date
Gregory Hainaut c1d39a5f57 gsdx-ogl: drop UserHacks_DateGL4
Initial goal was to avoid slowdown in buggy driver
2015-06-16 09:57:45 +02:00
Gregory Hainaut 4e82073bfc gsdx-ogl: improve setting bilinear of palette
Instead to disable it, uses GS settings
2015-06-09 09:53:50 +02:00
Gregory Hainaut 2503d9698c gsdx-ogl: re enable bilinear fitlering on palette for paltex mode
However keep it disabled for StarOcean 3 use cases
2015-06-08 21:01:18 +02:00
Gregory Hainaut c3c29945b2 gsdx-ogl: only set a cst blend factor when Ad is used
Fix GT4 and potentially FFX
2015-06-07 16:10:59 +02:00
Gregory Hainaut 0518aaedc9 gsdx-ogl: unattach palette to avoid noise in debug 2015-06-07 12:39:15 +02:00
Gregory Hainaut c2e851b3a5 gsdx-ogl: don't use slow SW blend for nothing
When A == B, coeff is 0 so <= 1
When C == 2, just check the value of coeff

Barely faster in accurate_blend = 2
2015-06-04 18:18:47 +02:00
Gregory Hainaut 3dd3bf6e2b gsdx-ogl: new hidden option accurate_blend = 2
Debug option to emulate all blending draw call in the shader

Of course it is slow but it is very accurate
2015-06-03 09:56:07 +02:00
Gregory Hainaut 995ae51bf4 gsdx-ogl: disable a log message
Too verbose and code was fixed anyway
2015-06-02 09:28:35 +02:00
Gregory Hainaut 2cbde89084 Merge pull request #555 from PCSX2/real-fb-format
GSdx: better framebuffer format
2015-06-01 11:48:07 +02:00
Gregory Hainaut d301848848 gsdx-ogl: fix paltex on opengl
RT uses as palette must use the alpha channel

Palette texture uses the red channel
2015-05-30 19:01:09 +02:00
Gregory Hainaut 419dfe0544 glsl: redo color/alpha management correction
Please test it!

GS supports 3 formats for the output:

32 bits: normal case
=> no change

24 bits: like 32 bits but without alpha channel
=> mask alpha channel (ie don't write it anymore)
=> Always uses 1.0f as blending coefficient

16 bits: RGB5A1, emulated by a 32 bits openGL texture. I think it will be more correct to use
a real 16 bits GL texture. Unfortunately it would cost several (slow) target conversions.
Anyway as a current solution
=>  apply a mask of 0xF8 on color when SW blending is used (improve Castlevania shadow)
unfortunately normal blending mode still uses the full range of colors!

This commit also corrects a couple of blending factor. 128/255 is equivalent to 1.0f in PS2, whereas GPU uses 1.0f. So the blending factor must be 255/128 instead of 2

Note: disable CRC hack and enable accurate_colclip to see Castlevania shadow ^^
(issue #380).
Note2: SW renderer is darker on Castlevania. I don't know why maybe linked to the 16 bits format poorly emulated
2015-05-26 16:49:43 +02:00
Gregory Hainaut 9ee3a173d0 gsdx-ogl: use a local ALPHA register
It would allow to easy tune the parameter to support 24 bits format
2015-05-26 15:36:48 +02:00
Gregory Hainaut d31bd97d59 gsdx-ogl: add a variable to select FB output
Either 32bits/24bits/16bits
2015-05-26 14:59:07 +02:00
Gregory Hainaut 3be5a6036b gsdx-ogl: remove assertion + debug message
opengl use a different object to compute the vertex count
2015-05-26 11:03:59 +02:00
Gregory Hainaut 580d177951 gsdx: improve commit 11708486d8
This time linear filtering is disabled only for the bad draw call
(RT used as a palette texture).
2015-05-25 09:46:51 +02:00
Gregory Hainaut b0af54d33e gsdx-ogl: better support of palette
The purpose of the code is to support alpha channel
of RT uses as an index for a palette texure.

I'm afraid that code will likely break pure palette texture. Only used
if paltex is enabled

It fixes missing shadow in Star Ocean 3 (issue #374) in Native resolution
with filter = 0  (no filtering) or = 2 (normal fitering)

Rendering explanation:
The game emulates a stencil buffer with the alpha channel

The alpha channel of the RT can contains a palette texture index (format 4HH)
The idea is to have a gradient of value in the palette (16/32/48/...).
This way you can implement a +16/-16 and even wrap the alpha value every time
you hit the pixel.

Bilinear filtering breaks the rendering because it interpolates between counts
so you doesn't have the exact count

Upscaling breaks the rendering because the RT is reused as an input texture. It means
that we need to scale it down which again create some interpolations.
2015-05-24 18:07:16 +02:00
Gregory Hainaut 7f614401a6 gsdx-ogl: set accurate_blend as default
Rendering is better and I think speed impact remains small.
2015-05-23 15:10:04 +02:00
Gregory Hainaut b884e0c0c0 gsdx-debug: improve debug experience
* Dump context before the increase of s_n
  => aligned with the global call number
* Don't print colclip not supported when it is optimized away
* dettach the input texture when it is useless
  => avoid to show a wrong texture in the debugger
2015-05-23 12:23:05 +02:00
Gregory Hainaut 183af4ece6 gsdx-ogl: don't enable SW blending when there is no blending
Mostly to avoid useless message
2015-05-20 09:36:01 +02:00
Gregory Hainaut 8d3e3e6c5b gsdx-ogl: more blend rework to support accurate_colclip
So far few blending equations are implemented in PS. It is only
for test the behavior on GoW
2015-05-20 08:00:40 +02:00
Gregory Hainaut c5341a2711 gsdx-ogl: update blending management
This way it will allow to implement all blendings operartion in FS.

Of course it will be slow, but it would be nice for debug and quickly check
game error rendering.
2015-05-20 00:12:52 +02:00
Gregory Hainaut 7979dec5b0 gsdx-ogl: optimize colclip 0
Currently colclip uses 2 passes to wrap the output of blending unit

However some blending mode are only a plain copy (of 0 or Cs or Cd).
So no overflow of [0:255], no need to wrap it

Note: I saw those cases in GoW.
2015-05-17 13:05:08 +02:00
Gregory Hainaut 6ced837360 gsdx-debug: add some PERF info in trace
The idea is to detect easily effect that are known to be slow on opengl
2015-05-17 13:05:08 +02:00
Gregory Hainaut b1ea081fc3 gsdx-debug: improve tracing interface
Basically move the format and c_str() in the macro
2015-05-17 13:05:08 +02:00
Gregory Hainaut c567198967 gsdx-ogl: replaced draw_count by s_n
This way error message is aligned with everything else :)

It is not perfect (normally it must be done in start of main draw)
2015-05-16 13:59:13 +02:00
Gregory Hainaut d870188d21 gsdx: sed/o/off/ 2015-05-15 20:40:09 +02:00
Gregory Hainaut 2e34d48e97 gsdx-ogl: add a virtual GetID method for texture
Much more readable
2015-05-12 17:41:41 +02:00
Gregory Hainaut e0012811ae gsdx-debug: more debug info in gl trace 2015-05-12 12:36:34 +02:00
Gregory Hainaut 921fa3bab8 gsdx-ogl/linux: drop fba option
It is useless as DX11
2015-05-11 13:57:26 +02:00
Gregory Hainaut 1523b9534f gsdx-debug: compact the code 2015-05-11 11:19:00 +02:00
Gregory Hainaut 5565544ba6 gsdx-ogl: DATE with texture barrier
Much faster for small batch that write the alpha value. Code can
be enabled with accurate_date option.

Here a summary of all DATE possibilities:
1/ no overlap of primitive
    => texture barrier (pro no setup of stencil and single draw)

2/ alpha written
    => small batch => texture barrier (primitive by primitive). Done in N-primitive draw calls.
    (based on GL_ARB_texture_barrier)

    => bigger batch => compute the first good primitive, slow but only 2 draw calls.
    (based on GL_ARB_shader_image_load_store)

    => Otherwise there is the UserHacks_AlphaStencil but it is a hack!

3/ alpha written
    => full setup of stencil ( 2 draw calls)
2015-05-09 19:54:01 +02:00
Gregory Hainaut f029e4763f gsdx-ogl: add the alpha value in a constant buffer 2015-05-09 15:02:34 +02:00
Gregory Hainaut 472608b879 gsdx-ogl: add accurate blending implementation 2015-05-09 15:02:13 +02:00
Gregory Hainaut 1e8aea033c gsdx-ogl: add a wrapper to control the drawing of primitives
No barrier => draw all primitives
Barrier but without overlap => draw all primitives
Barrier with overlap => draw primitive by primitve

It will ease the implementation of accurate blending and why not date too
2015-05-09 15:01:39 +02:00
Gregory Hainaut 380e420cdd gsdx-ogl: add a blend parameter to shader 2015-05-08 20:28:50 +02:00
Gregory Hainaut 8e1db43431 gsdx-debug: debug stuff 2015-05-08 19:28:17 +02:00
Gregory Hainaut 3c66da4d82 gsdx: remove old code 2015-05-08 19:28:16 +02:00
Gregory Hainaut 1addae1993 gsdx-ogl: don't use extra shader for sprite hack
Atst == 2 && sprite_hack is equivalent to Atst == 1

It frees a bit in the shader selector, and reduces shader combinations.
2015-05-08 19:28:16 +02:00
Gregory Hainaut b490085214 gsdx-ogl: add 2 options in the GUI to ease testing
accurate_date => use an emulated stencil to compute destination alpha
    test (could be slow)

accurate_blend => do nothing (future)
2015-05-08 19:28:16 +02:00
Gregory Hainaut d6448183d7 gsdx-ogl-debug: insert error message in GL stream
This way, you can see your message in the GL debugger
2015-05-08 00:16:31 +02:00
Gregory Hainaut cc4713d379 gsdx-debug: extend ogl debug capabilities
Group opengl calls into a nice name.

Apitrace shows them in a tree format that support folding. Previously it
was a long flat list (10K-40K of lines by frame)

I align the call number with the internal s_n variable. This way it is
easy to map GSdx dump output with the GL debugger :)
2015-05-06 19:09:13 +02:00
Gregory Hainaut 530e4ce776 gsdx-ogl: drop hack that rescale primitive (to avoid upscale glitch)
Rendering is bad. It renders sprites at native resolution.
2015-05-06 19:09:13 +02:00
Gregory Hainaut 6d65867b26 gsdx-ogl: comment point_sampler
It is not enabled on the shader so I will reuse the bit
2015-05-06 19:09:12 +02:00
Gregory Hainaut 3fcac07120 gsdx-ogl: print some message when blending is not properly supported 2015-05-06 19:09:12 +02:00
Gregory Hainaut 8032e2c369 gsdx-ogl: separate color mask state from the blending state
Unlike DX they're uncorrelated.
2015-05-05 10:26:01 +02:00
Gregory Hainaut 73d04e33e9 gsdx ogl: clean various comment and old code 2015-05-01 20:04:23 +02:00
Gregory Hainaut 335695bd0e purge GLES from GSdx !
mobile will use vulkan (or any new API) anyway
2015-05-01 20:02:17 +02:00
Gregory Hainaut 7367b22e03 gsdx-ogl: reduce toggling of scissor state for DATE 2015-05-01 00:59:49 +02:00
Gregory Hainaut baf84b98c4 gsdx-ogl: add override_GL_ARB_texture_barrier option
To ease regression test.
2015-04-25 09:59:25 +02:00
Gregory Hainaut c207632e49 gsdx-ogl: improve date performance for GL45
If there is no overlap, it is allowed to directly read from the render target.

On SotC testcase with 6x scaling: 30fps -> 40fps

Note: it requires GL_ARB_texture_barrier extension so be sure to have a recent driver

Note2: it requires a lots of testing too

Open question: in case of complex date (written alpha)
Will it be faster to split the draw call into multiple call with no
primitive overlap
2015-04-24 21:12:33 +02:00