Commit Graph

124 Commits

Author SHA1 Message Date
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
Unknown W. Brackets 2c56ccef18 Make sure frag shader ID matches generated code.
Before, we would use an id with alphatest on, but not actually compile in
alphatest.  Or, we would use a shader with alphatest, when we actually
could compile it out.
2013-10-26 02:19:02 -07:00
Henrik Rydgard 5d47aabb08 Seems we need high precision for fog on PowerVR. #4287 might be fixed by this. 2013-10-22 19:56:06 +02:00
Henrik Rydgard 2292531dd6 Small optimization for Disable Alpha Test - makes sure we don't generate the same shader twice. 2013-10-22 15:15:13 +02:00
Henrik Rydgard bf59f3db73 Add ugly hack setting for PowerVR to disable alpha test
Causes glitches but the speedup is truly massive in some games so I relent :/

Please do not report graphics bugs when this is enabled...

Future: Maybe remove this setting except on PowerVR?
2013-10-22 13:00:19 +02:00
Henrik Rydgard 80702109f5 Move gpu vendor detection to native with the rest of the gl init.
Also disable vertical layout for mainscreen entirely.
2013-10-16 00:48:44 +02:00
Henrik Rydgard f645988b8f More precision annotations in shader generators, other microoptimizations 2013-10-07 20:15:00 +02:00
Henrik Rydgard 99a7ff0973 Fix shader generation issue for desktop PowerVR chips - are there still such things???
Seen in our automatic reports.
2013-09-29 11:17:12 +02:00
raven02 8564d146c8 Rename roundTo255th to roundTo255thf 2013-09-28 00:06:18 +08:00
raven02 50edfb75d0 Add reporting for color test function 2013-09-10 09:20:50 +08:00
Unknown W. Brackets 655a7b4973 Check for a stencil test when ignoring alphatest. 2013-08-29 22:14:51 -07:00
Henrik Rydgard 766731db8e Add back the default case to the triviallytrue functions. 2013-08-29 20:39:23 +02:00
raven02 65d836c5dd Fix FF2 issue #2857 2013-08-29 22:50:31 +08:00
raven02 0b98f1f71b Should keep default case 2013-08-28 15:10:40 +08:00
raven02 0f55a6e042 Add GE_COMP_NEVER for alpha/color test to return false. 2013-08-28 14:33:15 +08:00
Henrik Rydgard dcc63fd716 PowerVR: work around what appears to be a driver bug with equality test + discard, but not completely sure that discard isn't just broken.
If this change breaks something, it was probably already broken, and it's PVR-only.
2013-08-28 00:12:49 +02:00
Henrik Rydgard dd667156f5 Oops 2013-08-27 22:14:13 +02:00
Henrik Rydgard 711d3ff52c Speedup a few 2D games on mobile by eliminating the alpha test in some conditions
That is, if there's no depth testing/writing, and the alpha equation will produce the same result as the alpha test (when the alpha test is >= 0 or != 0 and the blend func is safe), we turn off the alpha test.
2013-08-27 21:48:03 +02:00
Henrik Rydgard 6360fcb0ae Add some stats to get some idea of much alpha tested drawing we do.
Turns out it's one hell of a lot and we really should fix this by
checking both vertices and textures to deduce when we can just skip
alpha testing safely, probably quite often.

I care about this because alpha testing drawing is very expensive
on some mobile chips.
2013-08-27 21:01:17 +02:00
Henrik Rydgard edb6e5a54c Fix fallthough bugs in isAlphaTestTriviallyTrue 2013-08-24 11:56:39 +02:00
Henrik Rydgard 416f0c56e8 Experiment: Use glBlendFuncSeparate to not change dest alpha when blending.
Fixes Persona blending issues.
2013-08-22 19:14:04 +02:00
raven02 9931e5c5cc Fragment : Set doTextureAlpha = gstate.isTextureAlphaUsed(); 2013-08-20 21:32:07 +08:00