Commit Graph
62 Commits
Author SHA1 Message Date
Henrik RydgardandUnknown W. Brackets d67b148712 Add math dataconv funcs for packed values. 2016-03-06 11:33:53 -08:00
Unknown W. Brackets 79792a3c38 d3d9: Account for half-pixel z offset. 2016-01-20 22:53:47 -08:00
Unknown W. Brackets b80c02c272 Simulate depth clamping.
We'll allow extra space in both directions.  It's not exactly right, but
it's a fast approximation.
2016-01-19 07:12:58 -08:00
Unknown W. Brackets 0920f6c6eb Use minz/maxz as the depth range.
This allows values that fall outside the viewport, but still within the
depth range, to be drawn.
2016-01-19 07:12:57 -08:00
Henrik Rydgard 332310c2d6 Remove redundant parameters 2016-01-17 20:33:21 +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
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 5667f34805 Invert proj matrix offset properly in D3D. 2015-11-09 21:21:55 +01:00
Henrik Rydgard 8b3ff8a5b6 Correctly flip matrices in DX9 as well. 2015-11-04 22:37:42 +01:00
Henrik Rydgard 85229efef4 D3D9: Generate shaders directly from shader IDs, just like we do in GL. 2015-10-25 00:34:23 +02:00
Henrik Rydgard 92389a4966 Use a common ShaderId class. Start moving shader ID code to GPU/Common 2015-10-24 23:24:06 +02:00
Henrik Rydgard 08b340f423 More D3D hackery: Take inverted Z in proj matrix into account.
Also, *2 breaks it for no good reason so don't do that.
2015-08-30 22:45:24 +02:00
Henrik Rydgard 488c62e534 This makes slightly more sense than the last commit. 2015-08-29 20:38:19 +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 2b7d08e3af Also apply the GT fix in D3D, doh 2015-08-27 18:01:00 +02:00
Henrik Rydgard bf6aef44cd Oops, didn't finish the D3D code 2015-08-26 17:45: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
The Dax 7104629b24 Add the Phantasy Star Portable 2 depth range hack to Direct3D9 as well.
It seems to work fine for me..
2015-02-23 04:42:04 -05:00
Henrik Rydgard eaa1f0c23d Port over the fog NaN/inf fixes from OpenGL to Direct3D. Fixes skies in Outrun and probably a few other things 2014-12-22 00:48:16 +01:00
Unknown W. Brackets 8900f17f99 dx9: Correct half-pixel offset.
This fixes the pixel of blank space at the top, and the gpu/commands/basic
test.
2014-12-21 10:37:35 -08:00
Unknown W. Brackets b9e78dab9c dx9: Small optimization to viewport scaling. 2014-12-21 10:35:04 -08:00
Unknown W. Brackets 0fc311a319 dx9: Compensate for viewport w/h adjustments.
Fixes text in Final Fantasy 4, world map in Star Ocean, etc.
2014-12-18 22:24:47 -08:00
Henrik Rydgard e2d2950865 Add a sanity check for shader linking, active in debug mode 2014-12-14 20:17:29 +01:00
Unknown W. Brackets d1e992736b Simplify the viewport code a bit. 2014-09-24 23:09:09 -07:00
Unknown W. Brackets e3d6f19a2e d3d9: Update some not-yet-used ps uniforms. 2014-09-21 10:41:44 -07:00
Henrik Rydgard 9bb5bd6fb3 Of course have to update these as well. 2014-09-19 00:39:34 +02:00
Henrik Rydgard 9c625a79a1 DX9: Use 4x3 matrices for bones too. Compact shader constants. 2014-09-18 23:14:53 +02:00
Henrik Rydgard 6304d60b40 Convert 4x4 to 4x3 matrices where possible (except bones) 2014-09-18 23:08:46 +02:00
Unknown W. Brackets ff3c5075fa d3d: Apply a half pixel offset when rendering.
Makes things a lot sharper, although there still seem to be problems.
This makes it so the viewport aligns with pixel edges rather than centers
at whole integers.
2014-09-13 22:08:43 -07:00
Henrik Rydgard 7b66059ae0 D3D: Assorted cleanup. Add a missing register specification. 2014-09-10 15:20:57 +02:00
Henrik Rydgard 163f81e5be DX9: "Linked" shaders are now pointless, so remove them. 2014-09-10 14:07:30 +02:00
Henrik Rydgard 0dc6150a2e DX9: Not much point in tracking dirtiness per shader now that all constants are shared. 2014-09-10 13:57:19 +02:00
Henrik Rydgard 8bca420c0a Some renaming 2014-09-10 13:48:55 +02:00
Henrik Rydgard bf7a4f9097 D3D: Use fixed constant registers for vertex shaders too. 2014-09-10 13:43:35 +02:00
Henrik Rydgard d2d563cd2c D3D: Use fixed constant registers for pixel shader constants 2014-09-10 12:59:33 +02:00
Henrik Rydgard 14c8733def Uniforms/constants aren't shared in D3D, let's not pretend they are. 2014-09-10 12:40:15 +02:00
Henrik Rydgard 8ef326e531 D3D: Remove now-redundant texture coord scaling now that we decode the 8-bit and 16-bit formats in the vertex decoder 2014-09-09 22:32:59 +02:00
Unknown W. Brackets 030a9d55e7 d3d: Use unnormalized values for alpha testing.
Fixes Tales of Eternia's world map, Popolocrois everwhere, etc.

If PowerVR is using this method on GLES, it may be broken for the same
reasons.
2014-09-08 21:37:25 -07:00
Henrik Rydgard ef0ae77e98 D3D: some cleanup and a crashfix on shutdown 2014-09-09 00:29:01 +02:00
Unknown W. Brackets 923c535deb Merge pull request #6861 from hrydgard/depth-d3d
Improve depth buffering in D3D by computing a depth-flipped proj matrix but only when needed.
2014-09-08 14:17:19 -07:00
Henrik Rydgard 01a1438dce Improve depth buffering in D3D by computing a depth-flipped proj matrix but only when needed. 2014-09-08 23:10:23 +02:00
Unknown W. Brackets 564ae9f184 d3d: Report shader compilation failures. 2014-09-07 11:01:19 -07:00
Unknown W. Brackets 4d54cad9bd d3d: Reduce D3DX leaks. 2014-09-07 10:38:49 -07:00