Commit Graph
145 Commits
Author SHA1 Message Date
Unknown W. Brackets 99458d7797 Avoid forcing nearest/disabling linear if possible.
If we know that the test is trivially true, we don't need to worry about
the test.  May help #4405.
2014-05-15 22:38:44 -07:00
Unknown W. Brackets f660c04983 Optimize double alpha blending for 1/0 textures.
If the blend is 2*a / 1-a, and the alpha is either 1 or 0, we can still
use color doubling instead.  Fixes #3379 (Persona 2.)
2014-05-11 14:17:19 -07:00
Henrik Rydgard cf4887ecdd Update native to detect the EXT and NV extensions separately. Only look at the NV one. 2014-04-18 19:30:10 +02:00
Henrik Rydgård 45246ad9d3 Merge pull request #5891 from raven02/kill-alpha
Remove 'DisableAlphaTest' option
2014-04-15 22:00:18 +02:00
raven02 d2ce635bbf Remove option 2014-04-16 03:57:57 +08:00
raven02 cd024e88e8 Add #extension GL_EXT_shader_framebuffer_fetch : require 2014-04-14 19:55:34 +08:00
raven02 a9d7be1eab Should be id0 2014-04-13 16:13:59 +08:00
raven02 e358a6dcbe Handle ABSDIFF blending mode using GL_EXT_shader_framebuffer_fetch 2014-04-13 16:01:55 +08:00
Unknown W. Brackets 1209bc7ba4 Optimize ComputeFragmentShaderID() a bit.
I've seen it decently high on some profiles (1-2%).  This cuts it down by
12.5% when used in a tight loop.  The temporary was 8%, the ifs were the
other 4.5%.
2014-03-29 10:21:04 -07:00
Unknown W. Brackets 2b7d2fdc4b Optimize > and != 0 alpha tests.
There's no need to do rounding in this case.  These are very common.

Also, if the test was !=, convert it to >, which may work better on
PowerVR.
2014-03-29 10:16:06 -07:00
Henrik Rydgard f99925261d Merge branch 'raven02-patch-42'
Conflicts:
	GPU/GLES/FragmentShaderGenerator.cpp
2014-03-29 17:26:33 +01:00
raven02 664efe6812 Return false when alpha blending disabled 2014-03-29 22:04:59 +08:00
raven02 2944856c42 FS : Add missing gstate.isTextureMapEnabled() 2014-03-29 21:03:28 +08:00
Henrik Rydgard 37e9fc59b3 2x alpha: Safer change than the last attempt. Still fixes P2. I think this can be simplified, anyway. 2014-03-29 12:10:44 +01:00
Henrik Rydgard 27767fa85c Revert "Rethink 2x src alpha->color doubling. Fixes #3379."
This reverts commit 47efded29f.
2014-03-29 12:01:47 +01:00
Henrik Rydgard 47efded29f Rethink 2x src alpha->color doubling. Fixes #3379. 2014-03-29 11:40:17 +01:00
Unknown W. Brackets 69c2500dc6 Make sure vai->flags are set while hashing.
Since we decode the verts in this case we have a fresh flag.  Might
be #5718?
2014-03-25 08:19:38 -07:00
Henrik Rydgard dc07d3410a More checks for alpha test elimination 2014-03-24 17:33:20 +01:00
Henrik Rydgard f33ddad364 Eliminate further alpha tests 2014-03-24 12:41:33 +01:00
Henrik Rydgard b174996c1c Add a conservative check that prevents alpha testing in a few cases.
This will become really powerful if we add some code to the vertex decoder
to check for non-full alpha in the vertices, and set gstate_c.vertexFullAlpha if none
is found (probably want to do the reverse, set it to true and clear if any non-255 alpha is found).

Alpha testing is a performance killer on many mobile GPUs so big efforts to
avoid it can be worth it.
2014-03-23 16:32:38 +01:00
Henrik Rydgard 20d480a374 Minor GPU code cleanups 2014-03-23 16:32:38 +01:00
Unknown W. Brackets b9f4cc4481 Double colors only when texturing, and after test.
Per tests.
2014-01-12 11:45:29 -08:00
Henrik Rydgård c277fe3019 Don't declare fragColor0 unless we will use it. See #4877 2013-12-29 11:26:56 +01:00
raven02 9676f6943f Restore Alpha/ColorDoubling to do before color test 2013-12-25 15:39:37 +08:00
raven02 f97aacce45 Reformat stencilToAlpha a bit 2013-12-24 22:36:57 +08:00
Henrik Rydgard 832c933cb8 Some shader fixes 2013-12-17 23:38:58 +01:00
Henrik Rydgard f8312716f3 Only use dual source when actually needed.
Does generate a few more shaders but hopefully isn't a problem, should get rid of most of the slowdown in most games.
2013-12-16 23:44:28 +01:00
Henrik Rydgard a9a15d5196 Don't use dual source when stencil disabled 2013-12-16 23:41:42 +01:00
Henrik Rydgard 0d2ec01e83 Switch CanReplaceAlphaWithStencil response to an enum 2013-12-16 23:24:32 +01:00
Henrik Rydgard a8a48013f6 Don't use gl_FragColor when deprecated 2013-12-16 23:18:13 +01:00
Henrik Rydgard 40a0705b50 Typo fix checking the alpha func for src factors 2013-12-16 23:13:33 +01:00
Henrik Rydgård b6f8038a51 Fragment shader: Remove superfluous precision specifiers.
Also make sure to strip lowp/mediump/highp on desktop even for GL3.0-3.3.
2013-12-16 11:46:59 +01:00
Unknown W. Brackets 0043950770 Use #version 130 for OpenGL 3.0+ to support out.
Otherwise it just gives errors on cards that support dual source blending.
2013-12-15 08:32:22 -08:00
Henrik Rydgard 214cc01976 Fix bugs in stencil2alpha, fix bugs in glsl 3 support, enable dual source blending where available
The stencil2alpha bug fixes fix some glows in Wipeout, dual source fixes the rest.
2013-12-15 12:49:13 +01:00
Henrik Rydgard 3cde4921ae Have the shader generators generate modern GLSL if available.
This opens up to use other modern features like dual source alpha later.
2013-12-15 11:23:27 +01:00
raven02 affc7f44a6 Add extra GE_TEXFUNC_UNKNOWN1/2/3 which handle same as GE_TEXFUNC_ADD 2013-12-14 06:47:20 +08:00
Henrik Rydgard e2080f6c65 Revert "STENCIL_VALUE_UNKNOWN for DECR/INCR/INVERT"
This reverts commit 59d3b92e71.

Revert "zero alpha if stencil op consistently says to zero for format 5551 as well"

This reverts commit ed07a7f411.
2013-12-08 17:48:22 +01:00
raven02 59d3b92e71 STENCIL_VALUE_UNKNOWN for DECR/INCR/INVERT 2013-12-08 22:19:13 +08:00
raven02 ed07a7f411 zero alpha if stencil op consistently says to zero for format 5551 as well 2013-12-08 22:05:31 +08:00
Henrik Rydgard 7b4759384f Only zero alpha if stencil op consistently says to zero.
Otherwise we may be better off keeping the alpha.
2013-12-08 13:04:54 +01:00
Unknown W. Brackets 054501c100 Replace alpha when blend mode allows it.
Some games are using fixed/fixed blending modes which work in our favor.
2013-12-07 02:54:33 -08:00
Henrik Rydgard c738364f67 Make sure to disable scissor when doing the initial clear of a new FBO.
Minor cleanups.
2013-12-06 23:08:37 +01:00
Henrik Rydgård 13cdbd5284 Mask away alpha when the stencil operation is KEEP 2013-12-06 11:15:13 +01:00
Henrik Rydgard 41209eb936 Stencil-to-alpha fragment tweak: Set alpha to 0 if we can't deduce the stencil value.
This fixes the weird glowing shadows in Wipeout.
2013-12-04 19:55:09 +01:00
Henrik Rydgard a6150db8d5 Disable frag shader stenciltoalpha in clearmode. 2013-12-03 11:10:27 +01:00
Unknown W. Brackets 4418aacbaf When writing stencil to alpha, consider fb format. 2013-12-03 00:15:08 -08:00
Henrik Rydgard 44beebf6b0 Realized it's ok to combine the stencil-to-alpha with alpha testing as it's done within the shader, before we replace alpha. 2013-12-03 00:51:25 +01:00
Henrik Rydgard 39b632b279 Copy the stencil value in REPLACE mode to fragment alpha (but only when it's safe)
This is cheap but incomplete.
To do it more "right", we need multipass when blending or alpha test is enabled, ugh. That's for later.

Anyway, this improves the glow situation in Wipeout somewhat. Still lots of stuff that glows that shouldn't, but a little less overwhelmingly bright.
2013-12-03 00:13:21 +01:00
Henrik Rydgård 4352d720d8 Let's not use #define in GLSL ES shaders.
There are rumours that Vivante chips hate these.
2013-10-29 11:37:16 +01:00
Henrik Rydgård 0471a8c886 Only set fogdepth to highp on PowerVR. May fix #4333 2013-10-28 15:38:25 +01:00