Commit Graph

155 Commits

Author SHA1 Message Date
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 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 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 e245b27c97 gsdx-ogl-debug: allow to dump various ps shader
Nvidia allows to get the ASM of the shader of the compiled shader. It is useful
to check the performance.

It also allow me to compile most of shader code path for QA

Dump is enabled in linux replayer + debug_glsl_shader = 2
2015-07-17 21:08:48 +02:00
Gregory Hainaut 2ccf108534 gsdx-ogl: add back a selector for the Geometry Shader 2015-07-11 14:35:34 +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 d29e375f72 gsdx-tc: GPU accelerate 8 bits texture conversion
Only native is supported currently
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 42e911c78f gsdx-ogl: mask alpha channel in depth conversion
Might not work if depth is recasted as a rt (we lost the alpha channel)
2015-07-01 09:30:20 +02:00
Gregory Hainaut 58ce7d4bb8 gsdx-ogl: emulate texture shuffle
GS doesn't supports texture shuffle/swizzle so it is emulated in a
complex way.

The idea is to read/write the 32 bits color format as a 16 bit format.
This way, RG (16 lsb bits) or BA (16 msb bits) can be read or written with
square texture that targets pixels 1-8 or pixels 8-16.
However shuffle is limited. For example you can copy the green channel
to either the alpha channel or another green channel.

Note: Partial masking of channel is not yet implemented

V2: improve logging
V3: better support of green channel in shader
V4: improve detection of destination (issue due to rounding)
2015-07-01 09:30:20 +02:00
Gregory Hainaut 237ffcf796 gsdx-ogl: Make GL_ARB_draw_buffers_blend optinal for limited DX10 drivers 2015-06-10 22:55:27 +02:00
Gregory Hainaut 5bf5b5bca4 gsdx-ogl: extend StretchRect to write in depth texture
It will allow to convert color texture to depth texture
2015-06-07 12:39:23 +02:00
Gregory Hainaut 23f8203a22 gsdx-ogl: add some shaders to convert depth <-> color
I'm afraid of rounding error
2015-06-07 12:39:00 +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 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 7609fdc576 gsdx: rename too much sr to sRect 2015-05-21 09:48:15 +02:00
Gregory Hainaut d3d5a436ea gsdx-ogl: add code to read back depth texture 2015-05-20 08:07:40 +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 358e0d445b gsdx-ogl: add a shader to convert depth texture into uint 2015-05-19 18:56:32 +02:00
Gregory Hainaut 1837001e75 gsdx: extend CopyOffscreen with a new shader parameter
Currently we're trying to infer the conversion shader based on the output format

It only works if the input data is RGBA8. It might not be true in the future
2015-05-19 13:14:18 +02:00
Gregory Hainaut 5cfb496700 gsdx-ogl: only open debug file once 2015-05-17 14:43:56 +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 62e0e6a067 gsdx: remove deprecated code
Core was fixed to call GSFifo in the good thread
2015-05-16 13:52:16 +02:00
Gregory Hainaut 28bb64aae8 gsdx: sed/dr/dRect/ 2015-05-15 20:49:32 +02:00
Gregory Hainaut 445c28fe97 gsdx: sed/sr/sRect/ 2015-05-15 20:47:14 +02:00
Gregory Hainaut d566bb2a23 gsdx: sed /st/sTex/ 2015-05-15 20:45:31 +02:00
Gregory Hainaut 6a9e425308 gsdx: sed /dt/dTex/ 2015-05-15 20:44:15 +02:00
Gregory Hainaut 08291aed0c gsdx-ogl: color state impact the clean command 2015-05-15 15:25:45 +02:00
Gregory Hainaut b7a9465963 gsdx-ogl: update the device to use the new texture flags
Hopefully it will increase a bit the speed
2015-05-12 18:18:20 +02:00
Gregory Hainaut f37f3cb3cf gsdx-ogl: improve texture uploading
Initially we copy pitch by line in the PBO and tell the dma to only
use the first valid byte.

Now, we only copy useful data to the PBO. It reduce the copy and PBO memory requirement.

It seems a bit faster on native resolution
2015-05-11 16:32:13 +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 30e3956ea7 gsdx-ogl: avoid issue with apitrace
The tool doesn't support NaN value so be sure the buffer is correctly initialized
2015-05-11 11:19:18 +02:00
Gregory Hainaut 1523b9534f gsdx-debug: compact the code 2015-05-11 11:19:00 +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 625d65d4b4 gsdx-ogl: encode the bogus id as shader parameter 2015-05-09 14:55:44 +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 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 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 51a67029cf gsdx-ogl: add an option to print gl error messages 2015-05-07 23:54:22 +02:00
Gregory Hainaut 6095f40baf gsdx-ogl: add the number of free bit in selector structs 2015-05-07 18:41:10 +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 5f5b901bca gsdx-ogl: alpha bending equation/function are constant
Drop useless variables/state checking
2015-05-05 11:20:25 +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 14a1925de0 gsdx ogl: date texture is signed to use i variant 2015-05-02 16:53:34 +02:00