Commit Graph

4450 Commits

Author SHA1 Message Date
Andrew Church
c7f614f030 coreinit: Log the thread entry point when creating a new thread. 2016-08-18 06:40:02 +09:00
James
80c0364028 Merge pull request #294 from achurch/tex-cb
opengl: Configure color/depth buffers after textures.
2016-08-17 22:38:20 +01:00
Andrew Church
b80bba44b1 gx2: Include the shader data address in shader dumps for easier correlation with GLSL. 2016-08-18 06:33:14 +09:00
Andrew Church
1b1b2f9b55 decaf-sdl: Allow filtering out specific OpenGL debug messages by ID. 2016-08-18 06:30:40 +09:00
Andrew Church
d980423cb6 opengl: Handle writes to gl_FragDepth (pixel output 61). 2016-08-18 06:21:27 +09:00
Andrew Church
16ade22dc6 opengl: Properly detect shadow samplers when setting sampler state.
Also use sampler state Invalid instead of all-zero registers as the
signal for disabling a sampler.
2016-08-18 06:12:03 +09:00
Andrew Church
c7f4aa01ed opengl: Cache render targets by GL object rather than register state. 2016-08-18 05:49:08 +09:00
Andrew Church
0f4ee93fa6 opengl: Avoid a host surface copy when overwriting an entire surface. 2016-08-18 05:49:08 +09:00
Andrew Church
4ffbe84481 opengl: Update GL_DRAW_BUFFERn properly and handle color masks. 2016-08-18 05:49:08 +09:00
Andrew Church
ccf652bc27 opengl: Don't attempt to bind textures which aren't used by the shader. 2016-08-18 05:49:08 +09:00
achurch
403aa0a0e2 opengl: Reduce apitrace clutter by unbinding unused textures. (#302)
glBindTextureUnit() on a valid (nonzero) texture ID does not unbind any
textures already bound to the same unit but with a different type,
such as TEXTURE_3D vs. TEXTURE_2D.  This can result in analysis tools
like apitrace showing numerous bound textures for each unit, even though
only one is valid for any given draw call.  By explicitly unbinding the
texture unit with glBindTextureUnit(..., 0), we can clear the bindings
for all texture types at once, avoiding this clutter.

This slightly changes the GL call sequence in debug mode, but it has
no effect on the end result.
2016-08-17 13:48:28 -07:00
Brett Lawson
dbda376635 Merge pull request #303 from achurch/gl-labels
opengl: Use OpenGL object labels to link GL objects with PPC addresses.
2016-08-17 13:46:40 -07:00
Andrew Church
a8bed42353 opengl: Use OpenGL object labels to link GL objects with PPC addresses. 2016-08-18 05:04:11 +09:00
Brett Lawson
c9e53bee62 Drop the LINEAR_SPECIAL tileMode from latte and AddrLib.
This tiling mode doesn't actually exist on the GPU and only
sticks around on GX2 side.
2016-08-17 11:39:41 -07:00
Brett Lawson
3e9bb975a8 Include isDepth in host surface selection.
I'm not actually sure if this is neccessary, and we should
remove the isDepthBuffer stuff from everwhere it is currently
if we are able to.  I've heard that you can read
GL_DEPTH_COMPONENT32F as a normal texture without needing to
do a conversion from various sources, but I have not yet
confirmed if this is the case.  For now lets work
(potentially) suboptimally by doing the copy so we at least
know it will behave properly.
2016-08-17 11:17:38 -07:00
Brett Lawson
3f8af0a123 Make unique degamma surfaces. 2016-08-17 11:17:38 -07:00
James Benton
51a5e96d76 opengl: Fix tileMode base address swizzle not accounting for linear special. 2016-08-17 18:45:38 +01:00
Andrew Church
b2863ba474 opengl: Exclude degamma from surface key.
Some games (such as Xenoblade) write to a surface in RGB mode, then
read back from it in SRGB mode.
2016-08-18 01:56:23 +09:00
James
2cb3bfd0ab Merge pull request #300 from achurch/exp2
opengl: Fix wrong exponent function for EXP instruction.
2016-08-17 14:43:59 +01:00
Andrew Church
b71acbdb8e opengl: Fix wrong exponent function for EXP instruction. 2016-08-17 22:20:12 +09:00
Andrew Church
1d1c325647 opengl: Add workaround for NVIDIA GLSL compiler bug.
The NVIDIA GLSL compiler (as of driver version 367.35) incorrectly
reports a "stride mismatch" error on a shader declaring multiple
transform feedback buffers with different strides if the xfb_buffer
layout qualifier is specified in the definition of the buffer itself.
The compiler works correctly if we first change the default buffer
index and then define the buffer without the xfb_buffer qualifier.

The bug has been reported to NVIDIA as bug #160816-000177.
2016-08-17 13:25:51 +01:00
James
c34dbf8696 Merge pull request #297 from achurch/fetchshader-invalidate
gx2: Add missing GX2Invalidate() on newly created fetch shaders.
2016-08-17 12:30:17 +01:00
Andrew Church
46060cd11d opengl: Fix the order of applying OMOD and CLAMP. 2016-08-17 20:25:08 +09:00
Brett Lawson
5642f5b25c Make OpenGL surface uploads generic.
This fixes an issue where copySurface was copying surfaces
that had never been seen before, and thus weren't available
in GPU memory yet.  This half-fixes HKK (it still won't
render for whatever reason, and it also invalidates the
surfaces it copies after the copy, making us re-upload).
2016-08-16 20:46:12 -07:00
Andrew Church
801570b6b9 gx2: Add missing GX2Invalidate() on newly created fetch shaders. 2016-08-17 01:43:36 +09:00
Andrew Church
362128a838 opengl: Give transform feedback blocks unique names.
GLSL requires a block identifier, not just the keyword "block".
2016-08-16 23:45:18 +09:00
Andrew Church
7ff9ed609e opengl: Configure color/depth buffers after textures.
If a surface is used as both source and target of a draw operation and a
size difference causes the surface to be reallocated, this ensures that
the render target is the current surface when the draw occurs.
2016-08-16 22:53:10 +09:00
Andrew Church
8e454c7874 Pass the swap interval from GX2SetSwapInterval to the graphics driver. 2016-08-16 22:39:59 +09:00
James
4d99af5061 Merge pull request #292 from achurch/getsymname-fix
coreinit: Fix OSGetSymbolName() behavior.
2016-08-16 13:28:42 +01:00
Andrew Church
ebeaf43d17 coreinit: Fix OSGetSymbolName() behavior. 2016-08-16 21:17:28 +09:00
Brett Lawson
77c6cec9fe Fix bug causing incorrect mip level count to be generated.
Our calculation of the number of mip levels for a surface
incorrectly used Log2, which returned one less level than
was intended.  Additionally, the specific logic between
how Log2 works and cntlzw might be relevant, so I fixed it
to use exactly the same logic as GX2.
2016-08-15 22:23:52 -07:00
Brett Lawson
d3ba4f3c49 Fix bug causing JIT to incorrectly generate bclrl.
This bug cause bclrl to update LR before it recorded its
jump target address.  This meant that our jump returned
directly to the source rather than going to the target.
2016-08-15 20:06:28 -07:00
Andrew Church
53984e6244 jit: Tweak prologue/epilogue.
Suppress the Visual Studio hack (12x NOP) on other compilers, and fix
a couple of comments.
2016-08-16 17:59:37 +09:00
Andrew Church
a314800690 common: Add POSIX support for illegal instruction exceptions. 2016-08-16 17:59:37 +09:00
Andrew Church
bc1e5cb5a7 jit: Implement JIT verifier.
We bracket each translated instruction with calls to pre- and
post-verify routines.  The pre-verify routine makes a copy of the
current core state and the contents of any affected memory, and the
post-verify routine runs the associated interpreter function on the
initial core state (and memory contents), then compares the result to
the state produced by the JIT code and reports any differences.
(FPSCR is ignored since the JIT translators don't update it yet.)

To avoid false failures caused by other cores storing to the same
memory region referenced by an instruction while the instruction is
being verified, we force all load and store instructions subject to
verification to go through a mutex, ensuring that only one core can
access memory at any time.

The kc, lwarx, and stwcx instructions are not verified since they are
not repeatable.  (lwarx and stwcx do not obey the memory access mutex
since they do not go through the verifier, but simultaneous access to
memory with lwarx/stwcx and other load/store instructions is
unreliable anyway and real-world code should never do it, so we don't
worry about that case.)

Also rename the related configuration option from "debug" to "verify"
to better reflect its purpose.
2016-08-16 00:40:28 -07:00
Brett Lawson
53ae9b8884 Fix bug causing teenyheap to give overlapping allocations. 2016-08-15 19:07:27 -07:00
Brett Lawson
46207a51ce Allow copySurface to copy between differently sized surfaces. 2016-08-15 19:02:53 -07:00
Brett Lawson
b72cdf8aef Fix dst instead of src for source buffer in copySurface. 2016-08-15 19:02:58 -07:00
James Benton
1eacdd351c ppcutils: Fix float / double return value type conversion. 2016-08-15 23:23:19 +01:00
James Benton
d8fcb1a380 vpad: Stub VPADIsEnableGyro{AccRevise,ZeroPlay,ZeroDrift,DirRevise}.
Bayonetta spams these.
2016-08-15 23:13:34 +01:00
James Benton
f4abbc9136 coreinit: Implement OSDynLoad_GetModuleName. 2016-08-15 23:13:28 +01:00
James Benton
f135ed1341 coreinit: Do not require an event to be initialised before waiting on it.
Similar with OSMutex, people are using OSEvent without initialising it...
2016-08-15 23:13:23 +01:00
James Benton
b38dcc3e22 Implement support for TLS import / exports. 2016-08-15 23:13:17 +01:00
James Benton
c3f33be8d4 coreinit: Fix expanded heap not enforcing a minimum of 4 byte alignment. 2016-08-15 23:13:11 +01:00
James Benton
65ea696735 Remove unused code line. 2016-08-15 23:13:03 +01:00
Brett Lawson
48b06d2fb0 Properly handle the creation of PPC stack frames.
Some games generate stack traces and need this!
2016-08-15 01:05:11 -07:00
Brett Lawson
4deaf6272d Added some useful initialization log messages. 2016-08-15 00:07:47 -07:00
Brett Lawson
b18246151b Fix bug causing crash in in-emu debugger. 2016-08-15 00:07:41 -07:00
Brett Lawson
41f4d18795 Handle illegal instructions through in-emu debugger. 2016-08-15 00:07:22 -07:00
Brett Lawson
d2876d3bba Add windows support for illegal instruction exceptions. 2016-08-15 00:07:06 -07:00