Commit graph

156 commits

Author SHA1 Message Date
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
Unknown W. Brackets
256436b594 Support fixed/fixed blending without a blit. 2014-06-17 00:20:04 -07:00
Unknown W. Brackets
9b67594a1d Linux buildfix. 2014-06-16 01:04:53 -07:00
Unknown W. Brackets
982f0416a2 Pre-mask alphatest value as a small optimization.
Might cause small behavior difference on gles2 (without bitwise ops.)
2014-06-16 00:35:30 -07:00
Unknown W. Brackets
2038bc5527 Support alpha / color test masks on desktop/gles3.
Won't work on GLES 2, though...
2014-06-16 00:33:48 -07:00
Unknown W. Brackets
1d9f7b04fc Implement in-shader blending on gles2 / gl2.
I'm sure it'll be slow, though...
2014-06-13 23:42:59 -07:00
Henrik Rydgård
65153b55fa Never detach shaders as some drivers may have broken semantics. May help #6294
(you're supposed to be able to detach them after link)
2014-06-12 08:58:14 +02:00
Henrik Rydgard
339c4d7dc3 Fix a bunch of typos breaking various utility shaders on GLES
Fixes white shadows in FF-Type 0 on Tegra, as mentioned in #6268
2014-06-09 19:15:45 +02:00
Unknown W. Brackets
b163ab9203 Use an extra shader id bit to skip offsetting.
Since the vast majority of the time it will be 0.
2014-06-08 14:28:18 -07:00
Unknown W. Brackets
acab898be0 Keep track of x/y offset for render-to-tex.
Fixes intro in Valkyrie Profile now that we're wrapping correctly.
2014-06-08 14:27:05 -07:00
Henrik Rydgård
fe58f8daa9 Merge pull request #6254 from unknownbrackets/framebuf-clamp
Correct framebuf clamping, tex projection from framebuf
2014-06-08 11:22:38 +02:00
Henrik Rydgard
4b9823c0ea Let's see if there are any remaining fog INF/NAN issues out there 2014-06-08 11:06:34 +02:00
Unknown W. Brackets
da438b7c68 Fix clamping to the correct texel.
This fixes things when edges bleed in from a larger framebuffer.  We need
to clamp to the internal texels of the range.
2014-06-07 19:30:46 -07:00
Unknown W. Brackets
cc841bbe4c Apply tex wrap/clamp in shader for render-to-tex.
Fixes graphical artifacts in Wild Arms XF (which depends on how you get
there, because it's based on the size of the framebuffer.)
2014-06-07 13:13:58 -07:00
Unknown W. Brackets
580143e5e2 Disable vertex arrays before depal as well. 2014-05-31 22:07:42 -07:00
Unknown W. Brackets
29a9ff369e Make a note when we need to reset the shader.
Hmm, not sure this is the cleanest way.
2014-05-27 22:12:25 +02:00
Unknown W. Brackets
4b978ed6f9 Apply unsupported blending modes in the shader.
This handles unsupported fixed color combinations, alpha doubling, etc.
Where possible, tries to avoid it - it means using a blit (without the
framebuffer fetch extension), which can slow things down a lot with tons
of drawcalls.
2014-05-27 01:45:17 -07:00
Unknown W. Brackets
e80c63945a Make sure to gen the frag shader matching the id.
Otherwise, the frag shader might be generated accounting for different
vertexFullAlpha values, or otherwise won't match up with the id, since we
change flags between the two Apply calls.
2014-05-04 16:31:57 -07:00
Henrik Rydgard
16f4622ac7 Remove cached light variables to reduce work when parsing DLs.
Also removes some duplication between GL and the inactive D3D code.
2014-04-21 12:51:19 +02:00
Henrik Rydgard
f2f0355d94 Split up ApplyShader into ApplyVertexShader and ApplyFragmentShader.
Will allow the alphatest avoiding optimization later.
2014-03-24 10:55:07 +01:00