Commit Graph

4450 Commits

Author SHA1 Message Date
Brett Lawson
327cbbc65e Fix GX2R VertexShaderProg bug in SetGeometryShader. 2016-08-22 02:42:41 -07:00
James Benton
447b5c658e libdecaf: Remove glbinding include from decaf.h 2016-08-22 00:34:53 +01:00
James
c3ef6801fd Merge pull request #334 from achurch/EVENT_WRITE
gpu: Remove flags from EVENT_WRITE high address word.
2016-08-21 21:22:53 +01:00
Andrew Church
4b5208898f decaf-sdl: Add joystick support.
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.
2016-08-21 21:19:49 +01:00
Andrew Church
3554721a53 gpu: Remove flags from EVENT_WRITE high address word.
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).
2016-08-22 05:01:14 +09:00
Andrew Church
9355e34208 opengl: Disable early fragment tests for shaders with discard enabled.
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.
2016-08-21 03:40:09 +09:00
Adubbz
3f89f0f62e decaf-sdl: Fix fullscreen resolution. 2016-08-20 12:35:42 +01:00
Adubbz
dae2e969f8 decaf-sdl: Add ESC key to exit decaf.
Useful for fullscreen mode!
2016-08-20 12:35:36 +01:00
Adubbz
aeaa88ff5c decaf-sdl: Added --display-stretch to disable forcing aspect ratio. 2016-08-20 12:35:27 +01:00
James Benton
4c50ed0f41 Merge branch 'newicon' 2016-08-20 12:26:39 +01:00
James Benton
a73ff7857d decaf-sdl: Exclude decafsdl_posix from all Windows build types.
Was previously only excluded for ReleaseDebug.
2016-08-20 12:26:30 +01:00
James Benton
386987a88f opengl: Check the LOAD_CONTROL register before performing register loads. 2016-08-20 11:58:50 +01:00
Brett Lawson
06085b43ba Added the new icon! Wooo! 2016-08-20 03:13:51 -07:00
Brett Lawson
278feaa231 gl: Correct handling of glsl2 loop predicate usage. 2016-08-20 02:31:24 -07:00
Brett Lawson
3d9edf6189 Added support for GX2R Uniform Buffers. 2016-08-20 02:31:23 -07:00
Brett Lawson
771aee89cb gx2: Properly fix setup-context not working. 2016-08-19 20:13:10 -07:00
James Benton
6558ce2ed5 gx2: Fix setup-context not initialising the state properly. 2016-08-20 03:25:26 +01:00
James Benton
88ee11e7b1 opengl: Implement CONTEXT_CONTROL pm4 packet.
This should have been with the last commit.
Also its fucking broken.
FUCK YOU
2016-08-20 02:37:40 +01:00
James Benton
a5cafbe077 Rewrite state shadowing and GX2 context states.
This is now wayyy more accurate and correct than the previous implementation.
2016-08-20 01:47:01 +01:00
James Benton
901b52866d opengl: Actually read the value of VGT_MULTI_PRIM_IB_RESET_EN.
derp
2016-08-19 18:11:10 +01:00
James Benton
dc73e5dffe opengl: Use VGT_MULTI_PRIM_IB_RESET_EN to turn on primitive restart. 2016-08-19 01:32:28 +01:00
James Benton
86332a0112 gx2: Implement hardware register initialisation.
I would not be surprised if there was at least 1 mistake in here,
sooooo many registersss....
2016-08-19 01:32:23 +01:00
James Benton
7e3f996d44 coreinit: Fix case where MEMAllocFromBlockHeapEx fails to allocate. 2016-08-19 01:31:55 +01:00
Brett Lawson
84949c1864 Unbound depth buffers are not invalid, they just null-write. 2016-08-19 03:06:39 -07:00
James Benton
33e4650615 snd_core: Add missing CHECK_OFFSET 2016-08-19 10:02:36 +01:00
Brett Lawson
95d198ee7c Unbound color buffers are not invalid, they just null-write. 2016-08-18 19:48:47 -07:00
Brett Lawson
df991c0c99 Fix CopySurface with CUBEMAP textures. 2016-08-18 19:48:41 -07:00
Brett Lawson
6d7a0608fc Handle FMT_24_8 textures a bit better.
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...
2016-08-18 19:48:37 -07:00
Brett Lawson
de1d65ab92 Revert: opengl: Handle VGT_MULTI_PRIM_IB_RESET_EN.
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.
2016-08-18 19:46:43 -07:00
Brett Lawson
d7653cacf6 Fix bug with stencil_enable with non-stencil formats. 2016-08-18 19:46:40 -07:00
Brett Lawson
b7c7a7e573 Fix bug in ZClip register data generation.
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.
2016-08-18 19:06:54 -07:00
James
2d99d95b4c Merge pull request #314 from achurch/gl-fixes
GL rendering fixes.
2016-08-19 00:44:26 +01:00
Andrew Church
f6dd88262e opengl: Invert handling of ZCLIP_NEAR_DISABLE in PA_CL_CLIP_CNTL.
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.
2016-08-19 08:05:55 +09:00
Andrew Church
b241f12ba1 opengl: Fix desync with cached color mask flags.
We now set color masks when setting render targets, so we don't want
to also do it when the register is written.
2016-08-19 07:55:50 +09:00
Andrew Church
2158a258e2 opengl: Fix render target binding.
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).
2016-08-19 07:55:43 +09:00
Andrew Church
9cefb15af1 opengl: Handle the DB_SHADER_CONTROL register.
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.
2016-08-19 07:55:39 +09:00
Andrew Church
81f2f51608 opengl: Verify that offset registers are zero when compiling shaders.
Also add the missing register definitions to latte_registers.h.
2016-08-19 07:54:50 +09:00
Andrew Church
c6f150b734 opengl: Invert handling of DX_CLIP_SPACE_DEF in PA_CL_CLIP_CNTL.
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.
2016-08-19 07:35:18 +09:00
James
5ee48bd712 Merge pull request #318 from achurch/VGT_MULTI_PRIM_IB_RESET_EN
opengl: Handle writes to VGT_MULTI_PRIM_IB_RESET_EN.
2016-08-18 23:18:03 +01:00
Andrew Church
58b95e5cc4 opengl: Handle writes to VGT_MULTI_PRIM_IB_RESET_EN. 2016-08-19 07:11:23 +09:00
James Benton
78daf1f1d6 Add a much more lenient cereal json input archive.
- All values are optional, value will not be touched in the missing case
- Adds rapidjson flags for kParseCommentsFlag and kParseTrailingCommasFlag
2016-08-18 23:08:44 +01:00
Andrew Church
53a5548507 opengl: Miscellaneous cleanup.
- Remove a few unneeded glTextureParameteri() calls overlooked earlier.
- Fix registers listed out of numerical order.
- Add back a blank line that was accidentally removed.
2016-08-19 04:32:02 +09:00
Andrew Church
a22856c0ad opengl: Avoid unnecessary calls to glTextureParameteri(). 2016-08-18 11:09:48 +09:00
Brett Lawson
822a83be9a Fix bug where copySurface sent the wrong pitch.
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.
2016-08-17 15:09:17 -07:00
Brett Lawson
517442041d Merge pull request #293 from achurch/setswapinterval
Pass the swap interval from GX2SetSwapInterval to the graphics driver.
2016-08-17 14:51:24 -07:00
James
b41f58890c Merge pull request #309 from achurch/shader-address-in-dump
gx2: Include the shader data address in shader dumps for easier correlation with GLSL.
2016-08-17 22:44:03 +01:00
James
22db9d4cd0 Merge pull request #310 from achurch/thread-entry-point
coreinit: Log the thread entry point when creating a new thread.
2016-08-17 22:43:47 +01:00
James
01f48aa36b Merge pull request #308 from achurch/gl-debug-filter
decaf-sdl: Allow filtering out specific OpenGL debug messages by ID.
2016-08-17 22:43:26 +01:00
James
5683b73b41 Merge pull request #305 from achurch/shadow-samplers
opengl: Properly detect shadow samplers when setting sampler state.
2016-08-17 22:42:40 +01:00
James
8ff5c7fbb7 Merge pull request #306 from achurch/gl_FragDepth
opengl: Handle writes to gl_FragDepth (pixel output 61).
2016-08-17 22:41:59 +01:00