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.
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.
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.
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).
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.
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.
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.
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.