Commit Graph

140 Commits

Author SHA1 Message Date
Yuri Kunde Schlesner
a3afeb4687 VideoCore: Fix dangling lambda context in shader interpreter
The static meant that after the first execution, these lambda context
would be pointing to a random location on the stack. Fixes a random
crash when using the interpreter.
2016-09-15 22:15:11 -07:00
Jannik Vogel
ff0fa86b17 Retrieve shader result from new OutputRegisters-type 2016-05-16 18:55:51 +02:00
Jannik Vogel
1308afe2c2 Use new shader-jit signature for interpreter 2016-05-13 09:41:55 +02:00
Jannik Vogel
4e01e9ffc5 Refactor access to state in shader-jit 2016-05-13 09:20:14 +02:00
Jannik Vogel
7e756faaba Move program_counter and call_stack from UnitState to interpreter 2016-05-12 19:05:42 +02:00
Jannik Vogel
6c6d99ca51 Move default_attributes into Pica state 2016-05-12 19:05:41 +02:00
bunnei
f6eb62d062 Merge pull request #1690 from JayFoxRox/tex-type-3
Pica: Implement texture type 3 (Projection2D)
2016-05-11 21:47:08 -04:00
Jannik Vogel
ae7a82fa1c Turn ShaderSetup into struct 2016-05-11 23:48:24 +02:00
Jannik Vogel
2f8e8e1455 Pica: Add tc0.w to OutputVertex 2016-05-11 08:07:36 +02:00
Jannik Vogel
696cb197a5 Pica: Replace logic in shader.cpp with loop 2016-05-03 01:40:47 +02:00
Emmanuel Gil Peyrot
691a42fe98 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
bunnei
90243c56fb Merge pull request #1730 from hrydgard/vertex-loader
* Remove late accesses to attribute_config

* Refactor: Extract VertexLoader from command_processor.cpp.

Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.

* Move "&" to their proper place, add missing includes and make some properly relative.

* Don't keep base_address in the loader, it doesn't belong there (with it, the loader can't be cached).

* Optimize the vertex loader, nearly doubling its speed.

* Debugger fix

* Move and rename the MemoryAccesses class to MemoryAccessTracker.
2016-04-29 09:42:47 -04:00
Yuri Kunde Schlesner
e3a8292495 Common: Remove section measurement from profiler (#1731)
This has been entirely superseded by MicroProfile. The rest of the code
can go when a simpler frametime/FPS meter is added to the GUI.
2016-04-29 00:07:10 -07:00
Henrik Rydgard
47ff008817 Refactor: Extract VertexLoader from command_processor.cpp.
Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.
2016-04-28 19:05:55 +02:00
Sam Spilsbury
656a442433 shader: Shader size is long uint, not uint. 2016-04-25 00:40:03 +08:00
Sam Spilsbury
c6709d97bc shader: Handle non-CALL opcodes with a break 2016-04-25 00:39:54 +08:00
Sam Spilsbury
bbffa6ad69 shader: Format string must be provided inline and not as a variable 2016-04-24 23:40:52 +08:00
bunnei
d7fe2784cc shader_jit_x64: Rename RuntimeAssert to Compile_Assert. 2016-04-13 23:04:53 -04:00
bunnei
3f623b2561 shader_jit_x64.cpp: Rename JitCompiler to JitShader. 2016-04-13 23:04:53 -04:00
bunnei
847fb951e2 shader_jit_x64: Free memory that's no longer needed after compilation. 2016-04-13 23:04:52 -04:00
bunnei
60aa72e117 shader_jit_x64: Use a sorted vector instead of a set for keeping track of return addresses. 2016-04-13 23:04:52 -04:00
bunnei
60749f2cda shader_jit_x64: Use CALL/RET instead of JMP for subroutines. 2016-04-13 23:04:52 -04:00
bunnei
1d45b57939 shader_jit_x64: Separate initialization and code generation for readability. 2016-04-13 23:04:50 -04:00
bunnei
6e0319eec9 shader_jit_x64: Get rid of unnecessary last_program_counter variable. 2016-04-13 23:04:49 -04:00
bunnei
f3afe24594 shader_jit_x64: Execute certain asserts at runtime.
- This is because we compile the full shader code space, and therefore its common to compile malformed instructions.
2016-04-13 23:04:49 -04:00
bunnei
ffcf7ecee9 shader: Remove unused 'state' argument from 'Setup' function. 2016-04-13 23:04:48 -04:00
bunnei
a5a74eb121 shader_jit_x64: Specify shader main offset at runtime. 2016-04-13 23:04:47 -04:00
bunnei
c9d10de644 shader_jit_x64: Allocate each program independently and persist for emu session. 2016-04-13 23:04:47 -04:00
bunnei
4632791a40 shader_jit_x64: Rewrite flow control to support arbitrary CALL and JMP instructions. 2016-04-13 23:04:44 -04:00
bunnei
135aec7bea shader_jit_x64: Fix strict memory aliasing issues. 2016-04-13 23:04:43 -04:00
Mathew Maidment
aa6380e5bc Merge pull request #1643 from MerryMage/make_unique
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 20:10:11 -04:00
MerryMage
a06dcfeb61 Common: Remove Common::make_unique, use std::make_unique 2016-04-05 13:31:17 +01:00
bunnei
ebbba0d381 Merge pull request #1508 from JayFoxRox/vs-output-map
Respect vs output map
2016-03-22 11:59:12 -04:00
bunnei
784c5539ea Merge pull request #1538 from lioncash/dot
shader_interpreter: use std::inner_product for the dot product
2016-03-20 00:35:06 -04:00
Lioncash
63e956cc7a video_core: Don't cast away const 2016-03-17 02:01:38 -04:00
Lioncash
4d89df8df2 shader_interpreter: use std::inner_product for the dot product
Same thing, less code.
2016-03-17 01:00:30 -04:00
bunnei
96cafbe4cc Merge pull request #1503 from bunnei/clear-jit-cache
Clear JIT cache
2016-03-16 13:18:51 -04:00
Jannik Vogel
9aad2f29bb PICA: Fix MAD/MADI encoding 2016-03-15 20:01:25 +01:00
Jannik Vogel
f746a00964 Respect vs output map 2016-03-14 13:03:34 +01:00
bunnei
6efb710b28 shader_jit_x64: Clear cache after code space fills up. 2016-03-12 12:15:49 -05:00
bunnei
c103759cdc shader_jit_x64: Make assert outputs more useful & cleanup formatting. 2016-03-12 12:06:28 -05:00
bunnei
46f78b7f19 shader: Update log message to use proper log class. 2016-03-12 12:03:32 -05:00
Lioncash
88d604383e Common: Get rid of alignment macros
The gl rasterizer already uses alignas,
so we may as well move everything over.
2016-03-09 01:31:14 -05:00
Dwayne Slater
6b775034dd Add immediate mode vertex submission 2016-03-02 22:16:38 -05:00
bunnei
b003075570 pica: Implement decoding of basic fragment lighting components.
- Diffuse
- Distance attenuation
- float16/float20 types
- Vertex Shader 'view' output
2016-02-05 17:17:28 -05:00
bunnei
a43f8d2fb7 Merge pull request #1367 from yuriks/jit-jmp
Shader JIT: Fix off-by-one error when compiling JMPs
2016-01-27 09:19:28 -05:00
Yuri Kunde Schlesner
083d2d89a5 Shader: Implement "invert condition" feature of IFU instruction
If the bit 0 of the JMPU instruction is set, then the jump condition
will be inverted. That is, a jump will happen when the boolean is false
instead of when it is true.
2016-01-24 20:29:06 -08:00
Yuri Kunde Schlesner
c1071c1ff7 Shader JIT: Fix off-by-one error when compiling JMPs
There was a mistake in the JMP code which meant that one instruction at
the destination would be skipped when the jump was taken. This commit
also changes the meaning of the culprit parameter to make it less
confusing and avoid similar mistakes in the future.
2016-01-24 02:15:56 -08:00
Lioncash
aec28ed91e video_core: Reorganize headers 2015-09-11 07:31:15 -04:00
Lioncash
1fa772393b video_core: Remove unnecessary includes from headers 2015-09-11 00:10:03 -04:00
Lioncash
526eb33d1e video_core: Remove unused variables 2015-09-10 10:26:21 -04:00
aroulin
1484a23530 Shader JIT: Use SCALE constant from emitter 2015-09-07 16:50:28 +02:00
aroulin
87e3b9ffc0 Shader: Fix size_t to int casts of register offsets 2015-09-07 16:50:28 +02:00
bunnei
918ca40c68 Merge pull request #1088 from aroulin/x64-emitter-abi-call
x64: Proper stack alignment in shader JIT function calls
2015-09-02 08:46:58 -04:00
aroulin
ba998b85a1 video_core: Fix format specifiers warnings 2015-09-02 08:20:00 +02:00
aroulin
179ad35c2e x64: Proper stack alignment in shader JIT function calls
Import Dolphin stack handling and register saving routines
Also removes the x86 parts from abi files
2015-09-01 23:39:52 +02:00
aroulin
84959be150 Shader JIT: Fix SGE/SGEI NaN behavior
SGE was incorrectly emulated w.r.t. NaN behavior as the CMPSS SSE
instruction was used with NLT
2015-08-31 08:16:15 +02:00
Yuri Kunde Schlesner
c5a4025b65 Merge pull request #1065 from yuriks/shader-fp
Shader FP compliance fixes
2015-08-27 16:34:13 -07:00
aroulin
f52d8c1a9b Shader JIT: Fix float to integer rounding in MOVA
MOVA converts new address register values from floats to integers using truncation
2015-08-27 15:26:41 +02:00
archshift
dd0e1061ef Shader JIT: ifdef out reference to ifdef'd out shader_map
shader_map was only defined on x86 architectures, but was cleared on shutdown
with no ifdef protection. Ifdef this out so non-x86 architectures can be built.
2015-08-26 22:28:19 +00:00
Yuri Kunde Schlesner
0fcabd2b11 Integrate the MicroProfile profiling library
This brings goodies such as a configurable user interface and
multi-threaded timeline view.
2015-08-24 22:16:28 -03:00
Yuri Kunde Schlesner
d8ef20c856 Shader JIT: Tiny micro-optimization in DPH 2015-08-24 01:48:37 -03:00
Yuri Kunde Schlesner
630a850d4d Shaders: Fix multiplications between 0.0 and inf
The PICA200 semantics for multiplication are so that when multiplying
inf by exactly 0.0, the result is 0.0, instead of NaN, as defined by
IEEE. This is relied upon by games.

Fixes #1024 (missing OoT interface items)
2015-08-24 01:48:15 -03:00
Yuri Kunde Schlesner
082b74fa24 Shaders: Explicitly conform to PICA semantics in MAX/MIN 2015-08-24 01:46:58 -03:00
Yuri Kunde Schlesner
76247170df Shader JIT: Add name to second scratch register (XMM4) 2015-08-24 01:46:10 -03:00
Lioncash
fa5076eb9b shader_jit: Replace two MDisp usages with MatR 2015-08-24 00:39:50 -04:00
Yuri Kunde Schlesner
455147ee95 Shader JIT: Fix CMP NaN behavior to match hardware 2015-08-24 01:29:40 -03:00
bunnei
83c214f6d8 Merge pull request #1062 from aroulin/shader-rcp-rsq
Shader: RCP and RSQ computes only the 1st component
2015-08-23 17:56:35 -04:00
aroulin
03c5cfead4 Shader: Use std::sqrt for float instead of sqrt 2015-08-23 22:03:07 +02:00
aroulin
fa552f11ef Shader: RCP and RSQ computes only the 1st component 2015-08-23 22:01:17 +02:00
aroulin
2f1514b904 Shader: implement DPH/DPHI in JIT 2015-08-22 11:09:53 +02:00
aroulin
2e7cf2f6cf Shader: implement DPH/DPHI in interpreter
Tests revealed that the component with w=1 is
SRC1 and not SRC2, it is now fixed on 3dbrew.
2015-08-22 11:09:53 +02:00
aroulin
f3e8f42718 Shader: implement SGE, SGEI and SLT in JIT 2015-08-19 14:29:39 +02:00
aroulin
863730f6a7 Shader: implement SGE, SGEI in interpreter 2015-08-19 14:29:39 +02:00
aroulin
2f9eb98f03 Shader: Save caller-saved registers in JIT before a CALL 2015-08-19 03:40:07 +02:00
aroulin
7d3a6016d6 Shader: implement EX2 and LG2 in JIT 2015-08-17 01:12:34 +02:00
aroulin
638e47c04d Shader: implement EX2 and LG2 in interpreter 2015-08-16 15:54:30 +02:00
Tony Wasserka
96820ae42a Build fix for Debug configurations. 2015-08-16 15:14:54 +02:00
Tony Wasserka
33ba604fd9 Introduce a shader tracer to allow inspection of input/output values for each processed instruction. 2015-08-16 14:12:11 +02:00
Tony Wasserka
4cb302c8ae citra-qt: Improve shader debugger.
Now supports dumping the current shader and recognizes a larger number of output semantics.
2015-08-16 13:22:00 +02:00
bunnei
db97090cad Shader: Use a POD struct for registers. 2015-08-15 18:03:27 -04:00
bunnei
b39c053785 Rename ARCHITECTURE_X64 definition to ARCHITECTURE_x86_64. 2015-08-15 18:03:27 -04:00
bunnei
0ee00861f6 Common: Cleanup CPU capability detection code. 2015-08-15 18:03:26 -04:00
bunnei
a1942238f5 Common: Move cpu_detect to x64 directory. 2015-08-15 18:03:26 -04:00
bunnei
bd7e691f78 x64: Refactor to remove fake interfaces and general cleanups. 2015-08-15 18:03:25 -04:00
bunnei
cfb354f11f JIT: Support negative address offsets. 2015-08-15 18:01:22 -04:00
bunnei
094ae6fadb Shader: Initial implementation of x86_x64 JIT compiler for Pica vertex shaders.
- Config: Add an option for selecting to use shader JIT or interpreter.
- Qt: Add a menu option for enabling/disabling the shader JIT.
2015-08-15 18:01:07 -04:00
bunnei
d67e2f78b7 Common: Added MurmurHash3 hash function for general-purpose use. 2015-08-15 17:33:46 -04:00
bunnei
3f69c2039d Shader: Define a common interface for running vertex shader programs. 2015-08-15 17:33:44 -04:00
bunnei
18527b9e21 Shader: Move shader code to its own subdirectory, "shader". 2015-08-15 17:33:42 -04:00