Also add support for keyboard axis input, assign keypad 8462 to the left
stick, and move the default stick button keys from C/D to keypad 0/Enter
so they're in the same place.
At minimum, the word does not have a DATA_SEL field, since GX2 query
functions pass zero (DISCARD) in those bits and expect the result to
not be discarded. Removed INT_SEL from that word as well since there
is no evidence for its existence (and it's not handled anyway).
Early fragment tests are mostly an optimization, but they do change
behavior with respect to pixels which are discarded by the fragment
shader. The DB_SHADER_CONTROL EARLY_Z flag simply means "use early
fragment tests when possible", so we shouldn't enable them when they
would change shader behavior.
It seems most likely that the hardware uses the KILL_ENABLE flag to
decide whether to suppress EARLY_Z for this reason, so do the same
here, but warn if a shader uses KILL instructions and fails to set
KILL_ENABLE.
Also lower the level of the "early-z disabled" log message from
warning to debug, since it seems to be common to leave the EARLY_Z
flag enabled regardless of whether it has an effect.
I still don't know if handling them this way is 'correct',
but it certainly is a lot better. We will need to write
some test applications to determine if we are doing this
right or not...
This breaks quite a bit of things, I think there is more to
this than that. On GX2, primitive restart appears to always
be enabled, with the specific reset value being controlled
rather than the feature being turned on/off entirely. Note
that the register you are checking is actually never touched
by gx2.rpl.
The assembly for this particular method is really strange in
that it DOES specify both near and far, but near comes from the
input parameter, while far comes by pulling the near part out
of the register value, and placing it back in 1 bit over.
In OpenGL, depth "clamping" is the opposite of clipping: when depth
clamping is enabled, the near and far clip planes are _dis_abled,
allowing all depth values to pass through to the final depth buffer
store; at that point, the depth value is clamped to the range [0,1].
This behavior corresponds to disabling Z-clipping with the
ZCLIP_NEAR_DISABLE bit.
Also add an assertion that the near and far clipping flags have the
same state, since OpenGL does not allow clamping on one side only.
Look at the CB_SHADER_CONTROL and DB_DEPTH_CONTROL registers rather
than the address and mask registers to determine which render targets
are active, both to avoid leaving unused targets bound (which can
affect the draw bounds due to OpenGL rules on differently-sized
framebuffer attachments) and to ensure that buffers are bound even
when masked for operations that have no outputs (such as transform
feedback).
This is mostly an optimization in that it allows us to explicitly
request early fragment tests, but we also suppress writes to
gl_FragDepth if Z_EXPORT_ENABLE is false, and we abort entirely on
STENCIL_REF_EXPORT_ENABLE since we don't support that at all.
The OpenGL API docs for glClipControl explicitly give the example of
DirectX as a use case for GL_ZERO_TO_ONE, and Mesa includes the
expression S_028810_DX_CLIP_SPACE_DEF(state->clip_halfz) when computing
the PA_CL_CLIP_CNTL register value (note the "halfz"), so I suspect the
current logic is backwards.
- Remove a few unneeded glTextureParameteri() calls overlooked earlier.
- Fix registers listed out of numerical order.
- Add back a blank line that was accidentally removed.
It was sending surf->pitch rather than surf->pitch*4 in
the case of BCx surfaces. This both broke the data
upload, as well as the selection of the appropriate
buffer.