Commit graph

397 commits

Author SHA1 Message Date
bunnei dcbc653b90 rasterizer: Remove unnecessary 'using' for BlendEquation. 2015-05-31 01:52:42 -04:00
bunnei e6ace38815 Pica: Implement LogicOp function. 2015-05-31 01:52:41 -04:00
bunnei 3b5ff61201 rasterizer: Implement AddSigned combiner function for alpha channel. 2015-05-31 01:52:40 -04:00
bunnei 1574c44586 vertex_shader: Use address offset on src2 in inverted mode. 2015-05-31 01:52:40 -04:00
bunnei 02c9fe202c Pica: Implement command buffer execution registers. 2015-05-31 01:52:39 -04:00
bunnei 4ac6c1a3b5 vertex_shader: Implement SLT/SLTI instructions. 2015-05-31 01:27:50 -04:00
bunnei 875bd29766 vertex_shader: Implement MIN instruction. 2015-05-31 01:27:49 -04:00
archshift 76690392bf Move video_core/color.h to common/color.h 2015-05-30 11:17:37 -07:00
archshift 5df2d1b5f7 Move video_core/math.h to common/vector_math.h
The file only contained vector manipulation code, and such widely-useable code doesn't belong in video_core.
2015-05-30 11:17:36 -07:00
Emmanuel Gil Peyrot b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
Lioncash 951353558e gl_state: Remove unnecessary const specifier on Apply 2015-05-23 00:58:32 -04:00
Lioncash dc587fa295 video_core/utils: Remove unused variables in GetMortonOffset 2015-05-23 00:38:37 -04:00
bunnei 1b42d55a9d Pica: Create 'State' structure and move state memory there. 2015-05-22 22:59:42 -04:00
Lioncash 23d5df9d9c gl_state: Fix a condition typo in Apply 2015-05-22 19:49:12 -04:00
tfarley 05dc633a8c OpenGL renderer 2015-05-22 15:51:18 -07:00
bunnei f0365f28c2 Merge pull request #772 from lioncash/warn
core/video_core: Fix a few warnings when compiling on MSVC.
2015-05-18 08:08:49 -04:00
Subv 24d9416930 GPU/DefaultAttributes: Clear up a comment in command_processor 2015-05-17 14:13:11 -05:00
Subv 658c44af5c GPU/DefaultAttributes: Let the attribute data from the loaders overwrite the default attributes, if set.
closes #735
2015-05-17 11:52:17 -05:00
Yuri Kunde Schlesner 7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
Lioncash 497f4bee0c pica: Add the ULL specifier in IsDefaultAttribute
This is necessary otherwise there are warnings about a 32-bit result being casted to a 64-bit value.
2015-05-14 14:23:23 -04:00
Yuri Kunde Schlesner def5913d19 GPU: Add more fine grained profiling for vertex shader and rasterization 2015-05-12 15:59:52 -03:00
archshift 40310e2132 Implement I4 texture format
@neobrain, could you confirm that this is correct?

It's been tested with various different games and fixes different textures, including in Animal Crossing, Kirby Triple Deluxe, and SMB3D.
2015-05-10 18:59:22 -07:00
bunnei 23e8be573e rasterizer: Implemented combiner output scaling. 2015-05-09 22:26:17 -04:00
bunnei ff767eeb40 rasterizer: Implemented AddSigned combiner op. 2015-05-09 22:12:39 -04:00
bunnei 547da374b8 rasterizer: Fixed a depth testing bug. 2015-05-09 22:12:38 -04:00
bunnei a806b420a6 rasterizer: Implement combiner buffer input. 2015-05-09 22:12:36 -04:00
bunnei 44927f0306 rasterizer: Return zero'd vectors on error conditions. 2015-05-09 22:12:35 -04:00
bunnei 692a74c09e vertex_shader: Implement FLR instruction. 2015-05-09 22:12:34 -04:00
bunnei f935130a0f vertex_shader: Implement MADI instruction.
nihstro: Update submodule to latest upstream/master to support MADI instruction decoding.
2015-05-09 22:12:34 -04:00
Yuri Kunde Schlesner 17a8cae003 Memory: Add GetPhysicalPointer helper function 2015-05-09 04:02:32 -03:00
Yuri Kunde Schlesner 28a9e4c1d5 Memory: Support more regions in the VAddr-PAddr translation functions
Also adds better documentation and removes the one-off reimplementation
of the function in pica.h.
2015-05-09 03:08:11 -03:00
Yuri Kunde Schlesner 1c0b87edc2 Memory: Re-organize and rename memory area address constants 2015-05-09 01:29:52 -03:00
Yuri Kunde Schlesner 4f4d230dac Merge pull request #721 from yuriks/more-cleanups
More cleanups
2015-05-07 11:45:45 -07:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
bunnei 337f1e1b96 Merge pull request #695 from Subv/crash_f
GPU: Implemented default vertex shader attributes.
2015-05-06 19:33:03 -04:00
Subv 0e5ca080a8 GPU: Implemented default vertex shader attributes.
Fixes some games crashing.
2015-05-06 18:11:46 -05:00
Emmanuel Gil Peyrot 36b48082d5 VideoCore: Remove a superfluous auto variable declaration in debug_utils. 2015-04-29 13:37:12 +02:00
Rohit Nirmal f15c142c5e Silence some -Wsign-compare warnings. 2015-04-09 18:55:01 -05:00
Gareth Higgins 8060c519a6 Changed occurences of colour to color for consistency 2015-04-05 02:36:43 -04:00
archshift cae89fb315 Allow the user to set the background clear color during emulation
The background color can be seen at the sides of the bottom screen or when the window is wider than normal.
2015-04-03 15:35:51 -07:00
bunnei c1f5cb7dd5 Merge pull request #652 from neobrain/shader_output_fix
Pica/VertexShader: Fix a bug caused due to incorrect assumptions of consecutive output register tables.
2015-03-16 18:35:34 -04:00
Emmanuel Gil Peyrot 92fd2a1ee3 VideoCore: Add static_cast around expressions where the compiler doesn’t deduce the right type. 2015-03-16 15:14:04 +01:00
Tony Wasserka e4f5ec6272 Pica/VertexShader: Fix a bug caused due to incorrect assumptions of consecutive output register tables.
We now write create a temporary buffer for output registers and copy all of them to the actual output vertex structure after the shader has run. This is technically not necessary, but it's easier to vectorize in the future.
2015-03-12 14:18:46 +01:00
bunnei b56829df02 Merge pull request #629 from archshift/lcdfb
Implement SetLcdForceBlack and add implementation for color filling in the GPU code
2015-03-10 18:08:55 -04:00
bunnei ec5bc54575 Merge pull request #643 from Subv/dem_feels
GPU: Implemented more depth buffer formats.
2015-03-09 22:06:30 -04:00
Subv 1248e291f0 GPU: Added the stencil test structure to the Pica Regs struct. 2015-03-09 20:13:21 -05:00
Subv 414b0741c4 GPU: Implemented more depth buffer formats.
This fixes the horizontal lines in Picross E, Cubic Ninja, Cave Story 3D and possibly others
2015-03-09 20:12:39 -05:00
archshift 041e99b613 Added LCD registers, and implementation for color filling in OGL code. 2015-03-09 15:51:41 -07:00
Tony Wasserka 5742367341 Pica/PrimitiveAssembly: Fix triangle strips and fans being generated with incorrect winding order. 2015-03-09 21:49:49 +01:00
archshift 7d43aef4d0 Update nihstro submodule to the initial release version.
Includes more opcodes to implement in the future.
2015-03-08 13:52:38 -07:00
bunnei 06bf471581 Merge pull request #636 from bunnei/refactor-screen-win
Set framebuffer layout from EmuWindow.
2015-03-07 18:18:40 -05:00
bunnei 9960c49c21 Set framebuffer layout from EmuWindow. 2015-03-07 17:21:19 -05:00
Subv 4b8d4d0ed5 GPU/Textures: Fixed ETC texture decoding. 2015-03-07 16:21:54 -05:00
Tony Wasserka 93e32bce72 Merge pull request #538 from yuriks/perf-stat
Add profiling infrastructure and widget
2015-03-07 15:30:40 +01:00
bunnei 34c31db14a GPU: Added RGB565/RGB8 framebuffer support and various cleanups.
- Centralizes color format encode/decode functions.
- Fixes endianness issues.
- Implements remaining framebuffer formats in the debugger.
2015-03-03 18:26:03 -05:00
Yuri Kunde Schlesner cd1fbfcf1b Add profiling infrastructure and widget 2015-03-01 21:47:13 -03:00
archshift 7f9ee69a2b Added RGBA5551 compatibility in the rasterizer
This allows Virtual Console games to display properly.
2015-02-27 19:15:08 -08:00
Subv c564c21668 GPU: Implemented bits 3 and 1 from the display transfer flags.
Bit 3 is used to specify a raw copy, where no processing is done to the data, seems to behave exactly as a DMA.
Bit 1 is used to specify whether to convert from a tiled format to a linear format or viceversa.
2015-02-26 21:17:14 -05:00
Yuri Kunde Schlesner ea3c99f3a2 Video core: Fix A4 texture decoding
It was trying to take the LSB from `coarse_x`, which would always be 0
and thus would always return the same texel from each byte. To add
insult to the injury, the conditional was actually the wrong way around
too.

Fixes blocky text in OoT.
2015-02-25 23:05:14 -03:00
Yuri Kunde Schlesner 3c50da6fc0 Video core: Fix pixelation/blockiness in textures.
This was caused during morton decoding by me not masking the bits of
each coordinate before merging them, so the bits from x could set bits
in y if it was >255.
2015-02-25 22:16:01 -03:00
bunnei ed255ebaec Rasterizer: Add support for RGBA4 framebuffer format. 2015-02-24 19:58:33 -05:00
bunnei 733c19ddd3 Rasterize with the correct color component order.
- Fixes a regression with #594.
2015-02-22 13:57:24 -05:00
Tony Wasserka 34f21334ad Merge pull request #593 from Subv/search_problem
Pica/VertexShader: Fixed LOOP with more than one iteration.
2015-02-22 15:51:12 +01:00
Subv 9a03e9c61d Pica/VertexShader: Fixed LOOP with more than one iteration.
Previously it wouldn't jump back to the start of the loop code once it reached the end of the block.
Fixes the texture problems in a lot of games.
2015-02-21 12:52:21 -05:00
bunnei 5f9939070e Merge pull request #588 from archshift/somebranch
Sweeping cleanup of Common
2015-02-20 11:41:30 -05:00
archshift 302f0b32f5 Remove duplication of INSERT_PADDING_WORDS between pica.h and gpu.h 2015-02-19 22:26:25 -08:00
Subv 5410367ebf Rasterizer: Fixed a warning in GetWrappedTexCoord.
Redeclaring the variable inside the switch was causing weird behavior.
2015-02-18 23:52:47 -05:00
bunnei ec8f2210e3 Merge pull request #580 from lioncash/emplace
core/video_core: Use in-place construction where possible
2015-02-18 17:36:34 -05:00
Tony Wasserka 2eee3a87f9 Pica/Rasterizer: Replace exit() calls with UNIMPLEMENTED(). 2015-02-18 14:52:27 +01:00
Tony Wasserka 6e5a903286 Pica/Rasterizer: Make some local lambdas static. 2015-02-18 14:50:28 +01:00
Tony Wasserka 1561204342 Pica/BlendUnit: Implement separate color/alpha blend equations. 2015-02-18 14:50:28 +01:00
Tony Wasserka 81ebb4d682 Pica/TextureEnvironment: Add a note. 2015-02-18 14:50:28 +01:00
Tony Wasserka e11fb96408 Pica/TextureEnvironment: Treat texture combiner source 1 as the PrimaryColor.
Not really sure where the difference is, but some applications seem to use this 1:1 the same way...
2015-02-18 14:50:28 +01:00
Tony Wasserka 04cd06d5c2 Pica/TextureEnvironment: Add support for the MAD-like texture combiners and clean up texture environment logic. 2015-02-18 14:50:28 +01:00
Tony Wasserka 087edcfbec Pica/OutputMerger: Fix flipped framebuffers. 2015-02-18 14:50:28 +01:00
Tony Wasserka 6ca752ccbc Pica/TextureUnit: Implement mirrored repeating texture wrapping. 2015-02-18 14:50:28 +01:00
Tony Wasserka 8bd7a896ea Pica: Fix a bug in the register definitions, relating to texture wrapping. 2015-02-18 14:50:28 +01:00
Tony Wasserka aaf30ca4ee Pica/OutputMerger: Implement color format checking. 2015-02-18 14:50:28 +01:00
Tony Wasserka 3b5710bae6 Pica/Rasterizer: Rasterize actual pixel centers instead of pixel corners. 2015-02-18 14:50:28 +01:00
Tony Wasserka 3cb22d31a7 Pica/Rasterizer: Fix garbage pixels at triangle borders. 2015-02-18 14:50:28 +01:00
Tony Wasserka 638b370fb5 Pica/Rasterizer: Clean up and fix backface culling. 2015-02-18 14:50:28 +01:00
Tony Wasserka 365236fa4c Pica: Cleanup clipping code and change screenspace z to range from -1..0.
The change in depth range seems to reflect better to what applications are expecting, and makes for cleaner code overall (hence is more likely to reflect hardware behavior).
2015-02-18 14:50:03 +01:00
Tony Wasserka 70a764d992 Pica/VertexShader: Implement the LOOP instruction. 2015-02-18 14:02:59 +01:00
Tony Wasserka 6c26ec72a5 Pica/CommandProcessor: Properly implement shader load destination offset registers. 2015-02-18 14:02:59 +01:00
Tony Wasserka 67120270f2 Pica/CommandProcessor: Work around initialized vertex attributes some more. 2015-02-18 14:02:59 +01:00
Lioncash 5d2366e1e9 core/video_core: Use in-place construction where possible 2015-02-17 17:57:23 -05:00
Emmanuel Gil Peyrot 8a1c08a0af VideoCore: Fix a typo in Vec4 MakeVec(T, Vec3<T>), where the second argument was Vec2<T> instead. 2015-02-16 21:51:37 +00:00
Emmanuel Gil Peyrot c439b3074d video_core: Implement the remaining framebuffer formats in the OpenGL renderer. 2015-02-15 14:08:12 +00:00
bunnei 12181c8a64 Merge pull request #529 from Subv/master
Build: Fixed some warnings
2015-02-14 15:50:26 -05:00
Subv 8e2b248e05 Build: Fixed some warnings 2015-02-12 09:25:35 -05:00
Darius Goad 5db62cc758 Fix Min and Max blend equations 2015-02-11 15:33:44 -06:00
archshift ef24e72b26 Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00
Darius Goad 536958fb29 Add more blend equations from 3dbrew 2015-02-09 20:41:06 -06:00
bunnei 1eb591d6fd Rasterizer: Implement the other color and alpha modifiers. 2015-02-04 22:15:51 -05:00
bunnei 8c93a28fed VideoCore: Added same-component swizzlers to math utility functions. 2015-02-04 22:15:44 -05:00
bunnei 72cc512b1e Pica: Implement blend factors. 2015-01-31 01:40:05 -05:00
bunnei b522cf4e6a Pica: Implement color/alpha channel enable. 2015-01-27 22:03:34 -05:00
bunnei b2c55bf772 Rasterizer: Implemented alpha testing. 2015-01-27 14:39:17 -05:00
bunnei ff83d23ed5 GPU: Implement the remaining depth testing functions. 2015-01-25 23:34:14 -05:00
Yuri Kunde Schlesner 5961a2852d GSP: Update framebuffer info on all interrupts
Hardware testing determined that the GSP processes shared memory
framebuffer update info even when no memory transfer or filling GX
commands are used. They are now updated on every interrupt, which isn't
confirmed correct but matches hardware behaviour more closely.

This also reverts the hack introduced in #404. It made a few games
behave better, but I believe it's incorrect and also breaks other games.
2015-01-14 05:20:12 -02:00
bunnei 93f36c49f7 Merge pull request #473 from archshift/pp3ports
Pica/Rasterizer: Add ETC1 texture decompression support.
2015-01-13 18:11:18 -05:00
Tony Wasserka f2b74b4fb3 Pica/Rasterizer: Add ETC1 texture decompression support. 2015-01-13 14:42:40 -08:00
bunnei 99c0716d4d Merge pull request #478 from archshift/pp3ports4
Pica/VertexShader: Implement the MAD instruction.
2015-01-12 21:55:35 -05:00
Tony Wasserka 2b9a9a45b7 Pica/VertexShader: Implement JMPC/JMPU/CALLC/CALLU. 2015-01-12 15:47:21 -08:00
Tony Wasserka e02db3904b Pica/VertexShader: Implement the MAD instruction. 2015-01-12 15:34:36 -08:00
bunnei f7a3f45f1e GSP: Toggle active framebuffer each frame 2015-01-07 18:06:00 -05:00
Tony Wasserka bc187be0c1 Pica/Rasterizer: Remove some redundant casts. 2014-12-31 16:32:56 +01:00
Tony Wasserka 9675d19b47 Pica/Rasterizer: Make orient2d a free function and rename it to SignedArea. 2014-12-31 16:32:56 +01:00
Tony Wasserka 47543d62cf Pica: Cleanup color conversion. 2014-12-31 16:32:55 +01:00
Tony Wasserka 614baa39d1 VideoCore: Remove some unused functions. 2014-12-31 16:32:55 +01:00
Tony Wasserka d13bd327ba Pica/Rasterizer: Fix a bug related to multitexturing and texture wrapping. 2014-12-31 16:32:55 +01:00
Tony Wasserka 195d73a385 Pica/Rasterizer: Clean up long code lines. 2014-12-31 16:32:55 +01:00
Tony Wasserka 40c7200841 Pica/VertexShader: Coding style fixes. 2014-12-31 16:32:55 +01:00
Tony Wasserka 323a56f898 Pica/CommandProcessor: Cleanups. 2014-12-31 16:32:55 +01:00
Tony Wasserka b2d461020d Pica/CommandProcessor: Workaround games not setting the input position's w component. 2014-12-31 16:32:55 +01:00
Tony Wasserka 0f49424022 Pica/Rasterizer: Implement backface culling. 2014-12-31 16:32:55 +01:00
Tony Wasserka 3b78af904e Pica/Rasterizer: Textures seem to be laid out flipped vertically.
Not sure if this is a correct fix. Probably should instead change the decoding logic itself.
2014-12-31 16:32:55 +01:00
Tony Wasserka 3da52ead9b Pica/DebugUtils: Fix a bug in RGBA4 texture decoding. 2014-12-31 16:32:55 +01:00
Tony Wasserka a7ae0330b1 Pica/Rasterizer: Implement alpha blending. 2014-12-31 16:32:55 +01:00
Tony Wasserka e229ff8c83 Pica/Rasterizer: Implement depth testing. 2014-12-31 16:32:55 +01:00
Tony Wasserka 77bb58afeb Pica/Rasterizer: Further enhance Tev support. 2014-12-31 15:35:54 +01:00
Tony Wasserka 36291bc3f6 Pica: Add output merger definitions. 2014-12-31 15:35:54 +01:00
Tony Wasserka 632655e292 Pica: Fix A4, IA4 and IA8 texture formats.
Both IA4 and IA8 had their component order mixed up. Additionally, IA4 used the wrong number of nibbles per texel. A4 skipped every second texel.
2014-12-31 15:35:24 +01:00
Tony Wasserka b7a48c422a Pica/CommandProcessor: Add support for integer uniforms. 2014-12-31 15:33:09 +01:00
Yuri Kunde Schlesner 8369ee5803 Rasterizer: Pre-divide vertex attributes by W
Execute the division-by-W for perspective-correct interpolation of
values in the clipper, moving them out of the rasterization inner loop.
2014-12-29 02:08:11 -02:00
Yuri Kunde Schlesner fe186d3a59 GPU: Bitwise texture swizzling
Replace the loop-based texture address swizzling code by a bit-twiddling
implementation, providing a very small speed up. Also simplify
addressing code.
2014-12-29 02:08:11 -02:00
Yuri Kunde Schlesner 2012e1420f Rasterizer: Common sub-expression elimination
Move the computation of some values out of loops so that they're not
constantly recalculated even when they don't change.
2014-12-29 02:08:10 -02:00
Yuri Kunde Schlesner 7e9bc85cc8 Clipper: Compact buffers on each clipping pass
Use a new buffer management scheme in the clipper that allows using a
bounded minimal amount of buffer space. Even though it copies more data
it is still slightly faster likely due to using less cache.
2014-12-29 02:08:10 -02:00
Yuri Kunde Schlesner a320d1a5b4 Clipper: Avoid dynamic allocations
The triangle clipper was allocating its temporary input, output and work
buffers using a std::vector. Since this is a hot path, it's desirable to
use stack allocation instead.
2014-12-29 02:08:09 -02:00
Yuri Kunde Schlesner d151d797b1 Vertex Shader: Zero OutputVertex to avoid denormals
Unused OutputVertex attributes were being left un-initialized. The
leftover garbage sometimes decoded as floating-point denormalized
values, causing fallbacks to microcode and massive slowdowns in the rest
of the rasterization pipeline even though the results were unused. By
zeroing the structure we ensure these attributes only contain harmless
zeros.
2014-12-29 02:08:09 -02:00
bunnei 3b9d181b8e GPU: Implement frameskip and remove forced framebuffer swap hack. 2014-12-28 22:14:05 -05:00
bunnei 01c675685e Merge pull request #327 from Apology11/master
Fix visual studio ambiguous symbol error
2014-12-26 21:43:59 -05:00
bunnei 2188af4a65 Merge pull request #322 from chinhodado/master
More warning cleanups
2014-12-22 00:12:43 -05:00
bunnei 0de6a08d75 Merge pull request #291 from purpasmart96/license
License change
2014-12-21 16:05:44 -05:00
Apology11 8d81e23d6e Fix visual studio ambiguous symbol error 2014-12-21 18:34:20 +01:00
Chin 0199a7d9ef More warning cleanups 2014-12-21 10:58:55 -05:00
purpasmart96 ebfd831ccb License change 2014-12-20 21:20:24 -08:00
Tony Wasserka 08f42c2b8c Pica/VertexShader: Promote a log message to critical status. 2014-12-20 18:06:56 +01:00
Tony Wasserka 17f31de364 Pica/VertexShader: Small optimization. 2014-12-20 18:06:56 +01:00
Tony Wasserka a664574ecb Pica/VertexShader: Be robust against invalid inputs.
More specifically, this also fixes crashes by Citra trying to load a src2 register even if the current instruction does not use that.
2014-12-20 18:06:56 +01:00
Tony Wasserka ad5db467d7 Pica/VertexShader: Clarify a comment. 2014-12-20 18:06:56 +01:00
Tony Wasserka 871418e62b Pica/DebugUtils: Further cleanups to LookupTexture. 2014-12-20 18:06:56 +01:00
Tony Wasserka 88e9efe4b8 Pica/DebugUtils: Fix two warnings. 2014-12-20 18:06:56 +01:00
Tony Wasserka 6e275778c9 Pica/DebugUtils: Better document LookupTexture. 2014-12-20 18:06:55 +01:00
Tony Wasserka e4e9710d18 Pica/Rasterizer: Get rid of C-style casts. 2014-12-20 18:06:55 +01:00
Tony Wasserka d81370682f Pica/DebugUtils: Make a number of variables static.
Makes for cleaner and faster code.
2014-12-20 18:06:55 +01:00
Tony Wasserka 6bd41de276 Pica/VertexShader: Cleanup flow control logic and implement CMP/IFU instructions. 2014-12-20 18:06:55 +01:00
Tony Wasserka 22afb9d830 Pica/VertexShader: Run instruction handlers according to the effective opcode.
This allows for proper emulation of the different CMP/LRP/MAD instructions.
2014-12-20 18:06:55 +01:00
Tony Wasserka cd163fb59a Pica/VertexShader: Implement MAX instructions. 2014-12-20 18:06:55 +01:00
Tony Wasserka aff808b2fd Pica: Add support for boolean uniforms. 2014-12-20 18:06:55 +01:00