Commit graph

175 commits

Author SHA1 Message Date
Henrik Rydgard
b246442374 Hook up GL shader cache. Cache linked shader programs. 2016-01-17 20:44:51 +01:00
Henrik Rydgard
790210f6ef Minor fixes 2016-01-17 20:33:22 +01:00
Henrik Rydgard
36e1840ea0 More parameter removal 2016-01-17 20:33:22 +01:00
Henrik Rydgard
c8b1064d20 GL Cleanup: No longer redundantly store the shader ID inside the shader objects 2016-01-17 20:33:14 +01:00
Unknown W. Brackets
00b57f6a16 Correct clamped depth offset.
Oops, forgot to fix this when I fixed the scale.  It's already for a
[-1, 1] range, and needs to be corrected for accordingly.

Fixes #8425, other depth issues in Phantasy Star Portable 2.
2016-01-16 00:18:25 -08:00
Unknown W. Brackets
7e54368998 Correct depth offset when clamped.
Of course, the scale is already half, so we just need to double for d3d9,
and not double for OpenGL of course.

Our offset is already in [0, 1] so we keep it.
2016-01-03 19:59:35 -08:00
Unknown W. Brackets
529abd7db4 Correct clamped depth range from [0, 65535].
This changes a few things:
 * All backends clamp the depth range and keep it positive.
 * The depth rounding uniform is now properly dirtied.
 * Projection is updated to translate and scale appropriately.
 * Depth rounding is halved on OpenGL to account for [-1, 1] range.

Fixes Phantasy Star Portable 2 without the need for a game-specific hack.
2016-01-03 12:29:43 -08:00
Unknown W. Brackets
18cdf9f352 Remove the depth range hack.
Ths removes the game-specific hack to workaround depth issues.
2016-01-03 12:05:59 -08:00
Unknown W. Brackets
941988cde4 Correct prescale issues with render-to-texture.
Still need to apply the scaling of the texture coordinates here (or
somewhere, maybe we prescale that as well?  Except it's figured later on
in the process...)
2015-12-20 21:13:43 -08:00
Unknown W. Brackets
1fb271a607 Enable EXT_blend_func_extended.
Not really tested.
2015-11-27 16:01:25 -08:00
Henrik Rydgard
4b360a571c Remove the depth range hack option, turning it into an ugly game specific compatibility hack.
I hate doing this, but it's not really better off as an option.

See #8171
2015-11-15 23:00:25 +01:00
Henrik Rydgard
45da00d381 Fix viewport offset in gl non-buffered 2015-11-12 15:22:20 +01:00
Henrik Rydgard
aac0cd3227 Minor consistency improvement between d3d and opengl code 2015-11-05 00:08:48 +01:00
Henrik Rydgård
452ed71e68 Couple of LLVM compiler warnings 2015-11-04 12:46:38 +01:00
Henrik Rydgard
1ce6801d42 Shifted projection matrices need a few more parts flipped. This could fix bugs in games, too.
Fixes the strange camera issues in FF:CC.
2015-11-02 20:08:21 +01:00
Henrik Rydgard
c1db771056 Fix non-through rectangles 2015-11-02 20:08:11 +01:00
Henrik Rydgard
e9770b3679 Fix non-buffered rendering 2015-11-02 20:07:50 +01:00
Henrik Rydgard
f4248cb550 Remove a whole lot of flipping special cases 2015-11-02 20:07:30 +01:00
Henrik Rydgard
7f4e473e8c Add new shader viewing tool 2015-10-14 18:10:21 +02:00
Henrik Rydgård
d12f74d49b Slightly more elegant error handling 2015-10-14 17:44:50 +02:00
Henrik Rydgård
6bd1a43e20 Minor cleanups 2015-10-14 11:18:45 +02:00
Henrik Rydgård
87f45ed307 OpenGL: Generate vertex shaders directly from the shader ID. 2015-10-14 10:50:29 +02:00
Henrik Rydgård
39f04ab5d6 OpenGL: Generate fragment shaders directly from the ID. 2015-10-14 10:50:08 +02:00
Henrik Rydgard
4d18d478a0 Sample renderWidth/pixelWidth/height once per frame for the framebuffer manager. 2015-09-19 16:19:03 +02:00
Unknown W. Brackets
c7e6f051e4 Split the texture application into two stages.
The latter simply applies the texture.

This makes our IsAlphaTestTriviallyTrue() check correct.
2015-09-13 09:30:39 -07:00
Henrik Rydgard
ab3468ea02 Move native/gfx_es2/gl_state.cpp/h into GPU/GLES/GLStateCache.cpp/h 2015-09-06 13:45:17 +02:00
Henrik Rydgard
a71be3f75f Start moving GPU feature compatibility decisions to startup
(and a single, cache-friendly flag field)
2015-09-05 19:58:47 +02:00
Henrik Rydgard
7b0a31ade5 Adjust D3D depth calculations to get them to match OpenGL as close as I can get it. 2015-08-29 17:43:09 +02:00
Henrik Rydgard
76eacf32f4 Change the offset to 0.0 2015-08-27 18:02:45 +02:00
Henrik Rydgard
fd18f14508 Fix GT and hopefully other games that got a black screen 2015-08-27 17:58:41 +02:00
Henrik Rydgard
d89da71057 Get rid of a division in the vertex shader by precomputing the inverse. 2015-08-26 17:40:06 +02:00
Henrik Rydgard
fee776b6e0 Correct scale factors for through mode depth rounding. 2015-08-26 15:55:58 +02:00
Henrik Rydgard
9e18fb7e90 Round Z in the vertex shader to match a 16-bit Z buffer.
However this inexplicably does still not solve the Phantasy Star issue!
2015-08-26 15:25:21 +02:00
Henrik Rydgard
1e8a1b801f Rename viewportX1/X2 etc to scale + center, which is what they actually are. 2015-08-26 15:24:35 +02:00
Henrik Rydgard
29fc9e81a4 Use the gstate.getViewport* accessors. 2015-08-26 15:24:35 +02:00
Henrik Rydgard
2430c283a5 More GPU cleaning, removing uses of GPUState.h where not needed.
Want to get rid of direct accesses to GPUState in modules that may be reused in
my future next-gen backends, that will reformat display lists into command lists that will
then be optimized and executed, out of sync with the real GPUState.

Candidate modules that may be reused in full are Framebuffer and Depal, possibly TextureCache to some degree.
2015-07-29 12:37:49 +02:00
vnctdj
e791bea8a9 Consistently use *gr for the Graphics i18n category 2015-07-01 23:50:16 +02:00
Henrik Rydgard
0b2a1dfe53 Profile a few more scopes 2015-05-26 00:39:27 +02:00
Unknown W. Brackets
5fa3bf0eb9 Move the viewport transform to the proj matrix.
The viewport has an implementation defined maximum size.  On some devices,
it's as low as 2048 or 4096.

Tales of Destiny 2, for example, uses a large viewport, which may be
outside this range at 1x or 2x on such devices.  This makes it work much
better.  It may also have better subpixel precision.
2015-03-22 23:35:24 -07:00
Henrik Rydgard
f18f54fa5a Don't prepare to fetch translations unless we actually are going to use them.. In a couple of places in the code. 2015-02-04 13:41:21 +01:00
sum2012
cb039081ac Add "hardware transform error" translate 2015-01-29 07:20:14 +08:00
Henrik Rydgard
e2d2950865 Add a sanity check for shader linking, active in debug mode 2014-12-14 20:17:29 +01:00
Henrik Rydgard
b4b7cd0722 GLES: Merge the two ShaderID classes as they are identical.
I don't expect the number of bits required to grow or shrink massively for either type of shader in this backend.
2014-12-14 19:24:11 +01:00
level99procrastinator
52d6f40ec8 Make sure no NaN goes into projection matrix. 2014-11-09 20:34:23 +08:00
level99procrastinator
6fa0fe48a4 Move the hack from GPU/GLES/StateMapping.cpp to GPU/GLES/ShaderManager.cpp 2014-11-09 01:26:24 +08:00
Unknown W. Brackets
ebb9f68c3e u_lightpos is always set when lights are available.
Tiny optimization.
2014-11-05 00:57:22 -08:00
Unknown W. Brackets
e3d6f19a2e d3d9: Update some not-yet-used ps uniforms. 2014-09-21 10:41:44 -07:00
Unknown W. Brackets
94c1271761 Add an experiment with using a texture for tests.
Using an option for now so it's easy to test, if it works well we can
maybe remove the option.
2014-09-07 10:04:57 -07:00
Unknown W. Brackets
147eb92c95 Fix USE_BONE_ARRAY (currently disabled.) 2014-08-17 10:56:30 -07:00
Unknown W. Brackets
6d104edb5d Make sure not to leak any enabled vertex arrays.
When returning to EmuScreen, we need to reset any enabled vertex arrays or
we could crash in EmuScreen.  Also, when starting a frame / dirting the
shader, make sure also to toggle the vertex arrays.
2014-06-22 21:42:29 -07:00