Commit Graph
100 Commits
Author SHA1 Message Date
Weiyi Wang 9a19c4bbd5 fix clang-format and lambda capture 2019-11-23 01:30:06 +01:00
Weiyi Wang e20e161c5c unfold UNREACHABLE implementation for dumb compilers
We relies on UNREACHABLE's noreturn attribute to eliminate parent's "no return value" warning. However, this was wrapped in a `if(!false)` block, which compilers may not unfold to recognize the noreturn nature.
2019-11-23 01:30:06 +01:00
Weiyi Wang 6bb28315fd Guard unistd.h with MacOS only macro
Fix compile error on Windows caused by #4877
Weird, I thought I saw this guard during the code review...
2019-08-22 15:58:39 +02:00
Weiyi Wang 9d47890fce HLE/IPC: HLEContext can memorize the client thread and use it for SleepClientThread
This reduces the boilerplate that services have to write out the current thread explicitly. Using current thread instead of client thread is also semantically incorrect, and will be a problem when we implement multicore (at which time there will be multiple current threads)
2019-05-18 19:53:39 +02:00
Weiyi Wang 618e092e42 input/sdl: lock map mutex after SDL call
Any SDL invocation can call the even callback on the same thread, which can call GetSDLJoystickBySDLID and eventually cause double lock on joystick_map_mutex. To avoid this, lock guard should be placed as closer as possible to the object accessing code, so that any SDL invocation is with the mutex unlocked
2019-03-02 19:09:58 +01:00
Weiyi Wang 99e52e6331 Memory: don't lock hle mutex in memory read/write
The comment already invalidates itself: neither MMIO nor rasterizer cache belongsHLE kernel state. This mutex has a too large scope if MMIO or cache is included, which is prone to dead lock when multiple thread acquires these resource at the same time. If necessary, each MMIO component or rasterizer should have their own lock.
2019-03-02 15:20:05 +01:00
Weiyi Wang b10f12b462 remove all occurance of specifying endianness inside BitField
This commit it automatically generated by command in zsh:
sed -i -- 's/BitField<\(.*\)_le>/BitField<\1>/g' **/*(D.)

BitField is now aware to endianness and default to little endian. It expects a value representation type without storage specification for its template parameter.
2019-02-06 18:13:45 +01:00
Weiyi Wang a2fa901591 common/bitfield: make it endianness-aware 2019-02-06 17:29:39 +01:00
Weiyi Wang bed349ba51 common/swap: remove default value for swap type internal storage
This is compromise for swap type being used in union. A union has deleted default constructor if it has at least one variant member with non-trivial default constructor, and no variant member of T has a default member initializer. In the use case of Bitfield, all variant members will be the swap type on endianness mismatch, which would all have non-trivial default constructor if default value is specified, and non of them can have member initializer
2019-02-06 17:24:27 +01:00
Weiyi Wang c3d5b4496b common/swap: use template and tag for LE/BE specification
The tag can be useful for other type-generic templates like BitFields to forward the endianness specification
2019-02-06 17:24:13 +01:00
Weiyi Wang 3ab6c97fc7 common/swap: add swap template for enum 2019-02-06 17:21:15 +01:00
Weiyi Wang aff2753df8 Common/Bitfield: store value as unsigned type
Storing signed type causes the following behaviour: extractValue can do overflow/negative left shift. Now it only relies on two implementation-defined behaviours (which are almost always defined as we want): unsigned->signed conversion and signed right shift
2018-11-16 15:49:57 +01:00
Weiyi Wang 8c7a40434a cubeb_sink: ignore null-name device when selecting
We already ignore them on listing devices. We should do the same when selecting devices. This fix a crash when opening a specific device while there is a null device in the list
2018-10-27 00:43:04 +02:00
Weiyi Wang 307fb1cd3f cmake: mingw also needs _FILE_OFFSET_BITS=64 2018-10-23 15:11:25 +02:00
Weiyi Wang bbd5e63bdf only redefine 64 bit file operation for MSVC
MinGW provides POSIX functions
2018-10-23 15:11:18 +02:00
Weiyi Wang 4d81fda23b Update fmt to 5.2.1
It seems to fix msvc warnings
2018-10-06 15:39:31 +02:00
Weiyi Wang 365e6fdefd string_util: unify UTF8<->UTF16 conversion to codecvt 2018-10-02 16:10:34 +02:00
Weiyi Wang 82389b903b string_util: remove TString conversion for windows
First of all they are foundamentally broken. As our convention is that std::string is always UTF-8, these functions assume that the multi-byte character version of TString (std::string) from windows is also in UTF-8, which is almost always wrong. We are not going to build multi-byte character build, and even if we do, this dirty work should be handled by frontend framework early.
2018-10-02 16:10:20 +02:00
Weiyi Wang f876f9b85c string_util: remove ShiftJIS/CP1252 conversion function
We always use unicode internally. Any dirty work of conversion with other codec should be handled by frontend framework (Qt). Further more, ShiftJIS/CP1252 are not special (they are not code set used by 3ds, or any guest/host dependencies we have), so there is no reason to specifically include them
2018-10-02 16:10:01 +02:00
Weiyi Wang 2b4cefc8f9 web_backend: protect jwt cache with a mutex 2018-10-02 15:30:48 +02:00
Weiyi Wang dd7df52d63 common/thread: remove YieldCPU()
simply use the standard library yield()
2018-09-22 23:27:42 +02:00
Weiyi Wang 9d3038611d Merge pull request #2944 from huwpascoe/perf-3
Optimized Float<M,E> multiplication
2017-09-25 03:37:14 +03:00
wwylele 9c4b6162af citra-qt: fix some untranslated strings 2017-09-24 17:53:35 +03:00
Weiyi Wang 683fdb17bf Merge pull request #2936 from B3n30/system_curl_linux
WebService: Set USE_SYSTEM_CURL for travis linux builds
2017-09-19 12:26:53 +03:00
Weiyi Wang 312e762696 Merge pull request #2831 from Subv/uds_auth
Services/UDS: Handle beacon frames and the basic AP connection sequence frames.
2017-09-05 15:03:56 +03:00
Weiyi Wang 5b411c000c Merge pull request #2876 from mailwl/mii-stru
Mii Selector Applet: update Mii structures
2017-09-05 14:23:07 +03:00
Weiyi Wang ed62c8382f Merge pull request #2917 from jroweboy/icon_fix
Fix icon for citra qt
2017-09-04 03:42:58 +03:00
wwylele 7bf08b4f6e APT: load different shared font depending on the region 2017-09-03 12:34:11 +03:00
wwylele 3b210dd006 pica/lighting: only apply Fresnel factor for the last light 2017-09-03 08:22:03 +03:00
wwylele c58f627516 video_core: report telemetry for gas mode 2017-08-31 12:54:17 +03:00
Weiyi Wang db386d3d08 Merge pull request #2901 from stone3311/master
Fix info about TODO list
2017-08-28 03:23:59 -05:00
Weiyi Wang d74c3415fb Merge pull request #2892 from Subv/warnings2
Warnings: Fixed a few missing-return warnings in video_core.
2017-08-28 03:21:51 -05:00
wwylele b67850c882 SwRasterizer/Clipper: flip the sign convention to match PICA and OpenGL 2017-08-25 07:26:45 +03:00
wwylele 55eaecad8f gl_rasterizer: implement custom clip plane 2017-08-25 07:26:45 +03:00
wwylele 5893bb84af SwRasterizer: implement custom clip plane 2017-08-24 15:34:27 +03:00
wwylele 2814d0fba2 EmuWindow: refactor touch input into a TouchDevice 2017-08-24 15:00:56 +03:00
wwylele 5ec879dfaa HID: use TouchDevice for touch pad 2017-08-24 13:56:43 +03:00
wwylele 56684ad10b motion_emu: fix initialization order 2017-08-22 11:43:44 +03:00
wwylele 709d362609 gl_rasterizer/lighting: more accurate CP formula 2017-08-22 09:34:44 +03:00
wwylele 6813c61423 SwRasterizer/Lighting: implement LUT input CP 2017-08-22 09:34:44 +03:00
wwylele f75c6b4d36 SwRasterizer/Lighting: implement bump mapping 2017-08-22 09:34:44 +03:00
wwylele c0bc013929 swrasterizer: remove invalid TODO
This function is called in clipping, before the pespective divide, and is not used in later rasterization. Thus it doesn't need perspective correction.
2017-08-21 08:03:07 +03:00
wwylele a931e4974e swrasterizer/clipper: remove tested TODO
hwtested. Current implementation is the correct behavior
2017-08-21 08:03:07 +03:00
wwylele a8499f3adb gl_shader_gen: simplify and clarify the depth transformation between vertex shader and fragment shader 2017-08-21 08:03:07 +03:00
wwylele d332ede188 gl_rasterizer: add clipping plane z<=0 defined in PICA 2017-08-21 08:03:07 +03:00
wwylele 13014535c1 HID: fix a comment and a warning 2017-08-20 08:37:48 +03:00
wwylele 35b3fef422 pica/command_processor: build geometry pipeline and run geometry shader
The geometry pipeline manages data transfer between VS, GS and primitive assembler. It has known four modes:
 - no GS mode: sends VS output directly to the primitive assembler (what citra currently does)
 - GS mode 0: sends VS output to GS input registers, and sends GS output to primitive assembler
 - GS mode 1: sends VS output to GS uniform registers, and sends GS output to primitive assembler. It also takes an index from the index buffer at the beginning of each primitive for determine the primitive size.
 - GS mode 2: similar to mode 1, but doesn't take the index and uses a fixed primitive size.
hwtest shows that immediate mode also supports GS (at least for mode 0), so the geometry pipeline gets refactored into its own class for supporting both drawing mode.
In the immediate mode, some games don't set the pipeline registers to a valid value until the first attribute input, so a geometry pipeline reset flag is set in `pipeline.vs_default_attributes_setup.index` trigger, and the actual pipeline reconfigure is triggered in the first attribute input.
In the normal drawing mode with index buffer, the vertex cache is a little bit modified to support the geometry pipeline. Instead of OutputVertex, it now holds AttributeBuffer, which is the input to the geometry pipeline. The AttributeBuffer->OutputVertex conversion is done inside the pipeline vertex handler. The actual hardware vertex cache is believed to be implemented in a similar way (because this is the only way that makes sense).
Both geometry pipeline and GS unit rely on states preservation across drawing call, so they are put into the global state. In the future, the other three vertex shader units should be also placed in the global state, and a scheduler should be implemented on top of the four units. Note that the current gs_unit already allows running VS on it in the future.
2017-08-19 10:13:20 +03:00
wwylele 6d51febdc4 pica/shader/jit: implement SETEMIT and EMIT 2017-08-19 10:13:20 +03:00
wwylele ab3e6dba1f pica/primitive_assembly: Handle winding for GS primitive
hwtest shows that, although GS always emit a group of three vertices as one primitive, it still respects to the topology type, as if the three vertices are input into the primitive assembler independently and sequentially. It is also shown that the winding flag in SETEMIT only takes effect for Shader topology type, which is believed to be the actual difference between List and Shader (hence removed the TODO). However, only Shader topology type is observed in official games when GS is in use, so the other mode seems to be just unintended usage.
2017-08-19 10:13:20 +03:00
wwylele 4283f4b244 correct constness 2017-08-19 10:13:20 +03:00
wwylele 4d4dbc83a7 pica/shader/interpreter: implement SETEMIT and EMIT 2017-08-19 10:13:20 +03:00
wwylele 2599928707 pica/shader: extend UnitState for GS
Among four shader units in pica, a special unit can be configured to run both VS and GS program. GSUnitState represents this unit, which extends UnitState (which represents the other three normal units) with extra state for primitive emitting. It uses lots of raw pointers to represent internal structure in order to keep it standard layout type for JIT to access.
This unit doesn't handle triangle winding (inverting) itself; instead, it calls a WindingSetter handler. This will be explained in the following commits
2017-08-19 10:13:20 +03:00
wwylele 6e56beafbf motion_emu: no need to include thread in header 2017-08-19 07:21:02 +03:00
Weiyi Wang b5493813d7 Merge pull request #2875 from wwylele/bump-skip
gl_shader_gen: don't call SampleTexture when bump map is not used
2017-08-12 01:23:45 +03:00
wwylele a26768503a gl_shader_gen: don't call SampleTexture when bump map is not used 2017-08-11 18:35:00 +03:00
wwylele d500f79b8e move MotionEmu from core/frontend to input_common as a InputDevice 2017-08-11 11:05:08 +03:00
wwylele 31da8b8353 HID: use MotionDevice for Accelerometer and Gyroscope 2017-08-11 11:03:18 +03:00
Weiyi Wang 4f6f33f155 Merge pull request #2874 from danzel/spelling-1
Fix some spelling mistakes
2017-08-11 11:02:14 +03:00
wwylele 1904567e36 SwRasterizer/Lighting: implement spot light 2017-08-11 01:19:10 +03:00
wwylele b7e4eb7d90 SwRasterizer/Lighting: implement geometric factor 2017-08-11 01:18:43 +03:00
Weiyi Wang ed7b0bfad0 Merge pull request #2863 from wwylele/pad-state-zero
HID: zero unused PadState bits
2017-08-10 17:50:18 +03:00
wwylele b05c60172b HID: zero unused PadState bits 2017-08-10 17:01:03 +03:00
Weiyi Wang 8b5cd2c7aa Merge pull request #2868 from wwylele/swr-tuple
SwRasterizer/Lighting: use make_tuple instead of constructor
2017-08-10 12:44:23 +03:00
wwylele 72905b0389 SwRasterizer/Lighting: use make_tuple instead of constructor
implicit tuple constructor is a c++17 thing, which is not supported by some not-so-old libraries. Play safe for now
2017-08-10 12:19:58 +03:00
wwylele edc3516958 pica/regs: layout geometry shader configuration regs
All the register meanings are derived from ctrulib (3dbrew is outdated for most of them)
2017-08-10 01:53:08 +03:00
Weiyi Wang ae040b4f3b Merge pull request #2822 from wwylele/sw_lighting-2
Implement fragment lighting in the sw renderer (take 2)
2017-08-09 18:54:29 +03:00
Weiyi Wang 16020d23ac Merge pull request #2856 from wwylele/shader-share
pica: upload shared shader code & swizzle to both unit
2017-08-09 18:52:30 +03:00
wwylele 089c0d897b pica: upload shared shader code to both unit 2017-08-07 10:30:05 +03:00
wwylele fe4c91ae4c SwRasterizer/Lighting: shorten file name 2017-08-03 13:51:22 +03:00
wwylele 0af90eabd8 SwRasterizer/Lighting: move to its own file 2017-08-02 22:20:40 +03:00
wwylele a402f75cf4 SwRasterizer/Lighting: reduce confusion 2017-08-02 22:07:15 +03:00
wwylele cfd3edb942 SwRasterizer/Lighting: move quaternion normalization to the caller 2017-08-02 22:05:53 +03:00
Weiyi Wang 05e0bef66d Merge pull request #2848 from wwylele/shader-loop-fix
pica/shader_interpreter: fix off-by-one in LOOP
2017-07-29 12:34:28 +03:00
wwylele dc6f41bcc5 pica/shader_interpreter: fix off-by-one in LOOP 2017-07-27 13:48:27 +03:00
Weiyi Wang 1f0eca1aa7 Merge pull request #2844 from jroweboy/nightlyfix
Use WinSSPI instead of OpenSSL
2017-07-24 19:23:07 +03:00
Weiyi Wang c40c9bf285 Merge pull request #2799 from yuriks/virtual-cached-range-flush
Add address conversion functions returning optional, Add function to flush virtual region from rasterizer cache
2017-07-22 10:15:52 +03:00
wwylele d9a05eec0b debugger/shader: display LOOP 2017-07-20 23:30:34 +03:00
wwylele b5711f9f54 debugger/shader: print the invert flag for JMPU 2017-07-20 23:18:07 +03:00
wwylele 2fcfd76fb2 debugger/shader: fix address register for reverted arithmetic op 2017-07-20 23:12:08 +03:00
wwylele 69b544d73a debugger/shader: fix inverted uniform flow control 2017-07-20 22:47:53 +03:00
Weiyi Wang 9eb8dd311c Merge pull request #2818 from B3n30/network
Enable data transfer over ENet
2017-07-17 17:08:02 +03:00
Weiyi Wang b5e42d338d Merge pull request #2784 from wwylele/font-archive
load shared font from system archive
2017-07-16 20:12:55 +03:00
Weiyi Wang b6727d9527 Merge pull request #2824 from jroweboy/mingw_compile_test
Update enet submodule
2017-07-13 09:57:35 +03:00
wwylele 9f7ba9c282 SwRasterizer/Lighting: dist atten lut input need to be clamp 2017-07-11 22:19:00 +03:00
wwylele 4fe16d80bd SwRasterizer/Lighting: unify float suffix 2017-07-11 22:15:35 +03:00
wwylele 35bbf67e6e SwRasterizer/Lighting: get rid of nested return 2017-07-11 22:15:35 +03:00
wwylele a98f20df55 SwRasterizer/Lighting: refactor GetLutValue into a function.
merging similar pattern. Also makes the code more similar to the gl one
2017-07-11 22:15:35 +03:00
wwylele e34dc666cf SwRasterizer: only interpolate quat and view when lighting is enabled 2017-07-11 21:35:57 +03:00
wwylele acdf5035be vector_math: remove dead template parameter 2017-07-11 20:08:56 +03:00
wwylele 837642011d SwRasterizer/Lighting: pass lighting state as parameter 2017-07-11 20:06:26 +03:00
wwylele 48058f31b1 vector_math: remove broken SFINAE stuff
this was originally added to eliminate warnings on MSVC, but it doesn't work for custom types.
2017-07-11 19:51:29 +03:00
wwylele 54eafa42ce gl_rasterizer: use texture buffer for proctex LUT 2017-07-01 11:02:48 +03:00
wwylele 60f6d78648 gpu: add comments for TextureCopy 2017-06-29 13:09:23 +03:00
wwylele 36a523b7cf gpu: fix edge cases for TextureCopy 2017-06-27 23:20:23 +03:00
wwylele e93f183170 apt: load shared font from system archive 2017-06-26 01:38:12 +03:00
wwylele e770625812 apt/shared_font: don't relocate zero offset 2017-06-26 00:43:23 +03:00
wwylele f1afe2baa8 gl_rasterizer: use texture buffer for fog LUT 2017-06-22 20:41:00 +03:00
wwylele b3f9d734f0 gl_rasterizer: create the texture before applying the state
this is a rebasing error from #2792. It doesn't affect much though, because the later more Apply() call fixes/hides it
2017-06-22 17:47:46 +03:00
wwylele 3e20762caa gl_state: reset 1d textures 2017-06-21 23:13:06 +03:00
wwylele 49cf57c079 gl_rasterizer: fix glGetUniformLocation type 2017-06-21 23:13:06 +03:00