Commit Graph

202 Commits

Author SHA1 Message Date
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
Unknown W. Brackets
12c5f5e1e6 Use constants for other uv gen mode usages.
And also change them to treat 3 as coords as well.
2013-08-19 00:43:54 -07:00
Unknown W. Brackets
46805b37cb Use the texture-related GE accessors. 2013-07-21 19:45:04 -07:00
Unknown W. Brackets
988614f6d0 Use lightning GE state accessors where appropriate. 2013-07-21 19:44:30 -07:00
Unknown W. Brackets
c0da6b97c5 Add and use some color/alpha test accessors. 2013-07-21 19:44:30 -07:00
raven02
7ac496529b Vendor Based Alpha and Color Testing 2013-07-21 01:14:36 +08:00
raven02
44fe09f03e Fix black box in Dainiji_Super_Robot_Taisen_Z_Hakaihen 2013-07-20 01:55:12 +08:00
Henrik Rydgard
1abd9ff2d3 Change the alpha test rounding offset to be just under half. Fixes some disappearing things.. 2013-07-18 19:19:52 +02:00
Henrik Rydgard
d76c45411d alpha test: fix typo, add back rounding offset 2013-07-18 01:02:21 +02:00
Henrik Rydgard
3e24949f8a Try different approach to rounding the inputs to the alpha test. Appears to fix some problems on PowerVR. 2013-07-17 23:03:21 +02:00
Henrik Rydgard
79110638c9 Unbreak things (silly mistake in last commit, remove *2.0 factor which just can't be right) 2013-07-06 22:50:06 +02:00
Henrik Rydgard
9928bd762c Specify alphacolorref as highp 2013-07-06 22:44:18 +02:00
raven02
64de3c428e Minor cleanup 2013-06-28 21:43:12 +08:00
Unknown W. Brackets
cd213e655b Add some debug code for finding textures. 2013-06-22 10:35:34 -07:00
Henrik Rydgard
cdef31f9fc Turn off the use of uniform arrays in shaders as some devices don't like them, and the speedup seems to be very small if any. 2013-05-26 14:03:02 +02:00
Henrik Rydgard
199907b9ed Shader simplification - well, more of it. Hopefully this helps the mali problems a bit more. 2013-05-22 15:52:10 +02:00
Unknown W. Brackets
03f3f99e39 Don't use ivec in the fragment shader.
Attempt at #1777.  Needs the + 0.5 to round properly on mobile.
2013-05-12 13:09:02 -07:00
Unknown W. Brackets
5ecacd6bc8 Don't double alpha when alphablend is disabled.
Probably doesn't affect much.
2013-05-12 09:31:23 -07:00
Unknown W. Brackets
c937a22f26 Only double the color with color doubling.
Not the alpha.
2013-05-09 23:31:53 -07:00
Unknown W. Brackets
47c404b925 Clean up some comments. 2013-05-09 01:19:55 -07:00
Unknown W. Brackets
4a30221c95 Ignore texfunc RGBA when texture is full alpha.
This allows us to skip some work in the fragment shader.
2013-05-08 23:14:20 -07:00
Unknown W. Brackets
ebf1b57834 Rename round255f to roundAndScale255f.
Seems to verbose to me, but no one can think it doesn't scale or round
this way.
2013-05-07 08:02:27 -07:00
Unknown W. Brackets
f2b4c4a0bc Pre-round the colortest/alphatest reference val. 2013-05-07 07:52:49 -07:00
raven02
eba452f1ba Add back round255f and round255v to u_alphacolorref 2013-05-07 21:52:40 +08:00
raven02
3744f6ee28 Fix colortest rounding using vec3 2013-05-07 19:53:48 +08:00
raven02
274b9c712c Add rounding to equality check for ColorTest 2013-05-07 16:47:53 +08:00
Unknown W. Brackets
9537be9ebb Don't double src alpha when it's not safe to do so.
Fixes LittleBigPlanet vignette.
2013-05-03 01:10:59 -07:00
Unknown W. Brackets
8f27d03af3 Double alpha at least for a known case.
Makes Popolocrois look much better now.
2013-04-30 00:04:20 -07:00
Unknown W. Brackets
3a769bb047 Do alpha test equal compares using rounding.
Fixes accuracy problems, Popolocrois shows things now.
2013-04-29 01:19:23 -07:00
Henrik Rydgard
e3f183bc28 ColorDouble needs to be in the fragment shader ID 2013-04-27 18:33:56 +02:00
Henrik Rydgard
c04ce5a64e Implement projective texture mapping. It's not used a great deal but good to have. 2013-04-17 21:41:47 +02:00
Henrik Rydgard
ea11c36091 Fix a vshader id bit collision, avoid color test when set to 'ALWAYS', zeroinitialize dls. 2013-04-15 22:57:54 +02:00
raven02
3252eb6554 Fragment Shader : use mix() for decal/blend 2013-04-08 22:48:40 +08:00
Henrik Rydgard
e246ffe20c fragment shader: RGBA DECAL does make more sense this way 2013-04-07 20:37:19 +02:00
raven02
b03dfeb8a6 Clean up if-else 2013-04-06 22:28:38 +08:00
raven02
34f6a7512f Miss parenthesis in GE_TEXFUNC_BLEND 2013-04-06 22:24:04 +08:00
BeaR
da1b345cd4 HW T&L: Change unlitcolor initialization and cleanup fragmentshader formatting 2013-04-02 12:24:22 +02:00
raven02
6396324f57 Add few isEnabled() in GPUState for Alpha/Color/Lighting/Texture Test 2013-03-27 18:35:54 +08:00
raven02
68faecd87c minor cleanup only 2013-03-25 22:57:40 +08:00
raven02
51fdd2a665 Enable ColorTest 2013-03-25 22:36:56 +08:00
Henrik Rydgard
724a7c8c93 Revert latest fliptexture hack. This seems to work better. 2013-03-11 20:26:47 +01:00
Henrik Rydgard
de469e77a4 Fix silly typo breaking alpha test in many cases. Make some log VERBOSE. 2013-03-11 19:40:47 +01:00
Henrik Rydgard
14b35c8d2d Turning off alpha test on GREATER than 0 and LESS than 255 wasn't safe. Only GEQUAL and LEQUAL, duh! 2013-03-11 19:29:13 +01:00
Henrik Rydgard
ac47d74d7b Remove obviously useless alpha tests. May help speed on mobile GPUs a little. 2013-03-11 18:43:36 +01:00
Henrik Rydgard
654620cb66 Adreno doesn't like negations when using discard, apparently.. 2013-03-10 16:01:00 +01:00
Henrik Rydgard
bc15617392 Make un-buffered rendering much smarter, removing flicker.
This turns it into a very viable option for many games. You do lose some FX
but it can as a result even be used as a workaround for the massive glow
in Wipeout...
2013-03-03 13:00:21 +01:00
raven02
b862841dd4 Put PPGeDraw into CalculateFPS() and add enableColorDoubling alias 2013-03-03 15:33:03 +08:00
raven02
d99ca71a47 Add u_colormask and use it in enableColorTest 2013-02-25 05:45:35 +08:00
raven02
26f37277f4 Use enableColorTest for colortest 2013-02-13 07:57:15 +08:00
Henrik Rydgard
bdc467769e Some shader and vertex format optimizations 2013-02-05 01:37:00 +01:00
raven02
104dfcb6e4 Fix too dark issue in-game 2013-01-25 21:15:56 +08:00
Henrik Rydgard
dbdd461a53 Fix issue with vertex shader IDs. Write the 4th component of packed vectors.
The latter makes sure we leave no holes in the CPU writebuffer.
2013-01-22 22:27:03 +01:00
Henrik Rydgard
e04f5156ee Fix a few graphics issues, optimize shader ID generation (fewer shaders) 2013-01-22 22:03:41 +01:00
Henrik Rydgard
784c191caf Fix bugs with fog bit in shader IDs 2013-01-21 00:34:37 +01:00
Henrik Rydgard
7271e3fcd5 Fix fog and stencil buffer clearing. The latter fixes the sky in MotoGP. 2013-01-14 20:44:11 +01:00
Henrik Rydgard
03eacd1af3 Save 16K. 2013-01-07 13:00:28 +01:00
Henrik Rydgard
62cc953bad Specify an older GLSL version for compat, we don't use new features anyway because of ES 2.0. 2013-01-07 10:07:00 +01:00
raven02
55f986428d Use 2.0 alpha value to match real PSP 2013-01-01 22:00:20 +08:00
Henrik Rydgard
4f376a2c34 Hardware vertex transform, preliminary and optional. No lighting yet. Disabled until it works right... 2012-12-20 15:07:58 +01:00
Henrik Rydgard
b8d596cbec Add some infrastructure for flexible vertex formats 2012-12-19 18:35:37 +01:00
Henrik Rydgard
4046146164 Add experimental wireframe mode for debugging. Fix texenv color. Code cleanup. 2012-12-19 15:14:41 +01:00
Henrik Rydgård
36943db4ec Merge branch 'master' of github.com:hrydgard/ppsspp
Conflicts:
	Core/Config.h
2012-12-05 10:57:30 +07:00
Henrik Rydgård
700921deb3 Fix rendering on MacOSX (shader compiler very fussy...). Minor prep for hw transform. 2012-12-05 10:55:06 +07:00
Sacha
5316f856d1 Blackberry 10 Port
* Replace SDL with asound backend (removes the only dependency)
* Remove all references to SDL in bar-descriptor.xml, blackberry_build.sh
* Greatly simplify blackberry_build.sh
* Modify CMakeLists.txt to account for removal of SDL
* Remove redundancy in CMakeLists.txt (EGLv2)
* Refactor nativeExtra's and setting targets
* Remove android/CMakeLists.txt (unrelated file)
* Update for latest Blackberry NDK (1088)
* Handle bug with VSync in latest NDK
* Update bar-descriptor.xml to version 0.4
* Fix define on iOS in FragmentShaderGenerator.cpp
* Specify NDK used in Credits by target platform, add contributor, remove redundancy
2012-12-02 14:48:00 +10:00
Henrik Rydgard
980d13fe50 Assorted GPU fixes: Advance vertex pointer, fixes missing triangles in SPT. More logging. Separate proj matrices for through and normal mode (through matrix don't need to get updated as often). Some cleanup. 2012-11-28 13:45:22 +01:00
Henrik Rydgard
870ea6628b Reasonably correct viewport handling. Optional debug stats overlay (not always 100% working). 2012-11-26 17:35:08 +01:00
Sacha
3c903dda24 Improve portability to future platforms. Make use of new USING_GLES2 define throughout PPSSPP. Also use ARM definition where suitable. Remove some redundancy with includes. 2012-11-26 13:25:14 +10:00
Henrik Rydgard
b964516669 Fix clear mode, turn Alpha Test back on 2012-11-23 12:43:31 +01:00
Henrik Rydgard
e92e919926 Fix problems with additive blending, fix color doubling.
Greatly improves MotoGP among others.
2012-11-23 01:26:12 +01:00
Henrik Rydgard
e5c6cf965b Fixes and optimizations to vertex decoding and lighting.
Motorcycles are now visible in MotoGP.
2012-11-16 15:16:14 +01:00
Henrik Rydgard
b43dfebb10 Fixes to lighting, display list base pointer, misc 2012-11-09 17:51:45 +01:00
Sacha
41f5abab31 PPSSPP ported to Blackberry10
Now builds on Playbook and Dev Alpha
Make emulator more compatible with other OS (case sensitivity, defines, includes)
Uses Android's code paths and backend
2012-11-05 23:09:49 +10:00
Henrik Rydgard
64cc573703 Switch to "GPL 2.0 or later" for various reasons. I wrote most of the code I imported from Dolphin (which is GPL2-but-not-later), so it should be OK. 2012-11-04 23:24:00 +01:00
MrOrdinaire
1ab9943643 fix missing #include's and missing CMake linking directives 2012-11-03 10:33:24 +08:00
Henrik Rydgard
4f7ad15758 Add snapshot of the whole source code. 2012-11-01 16:19:01 +01:00