Commit graph

140 commits

Author SHA1 Message Date
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
089c0d897b pica: upload shared shader code to both unit 2017-08-07 10:30:05 +03:00
Yuri Kunde Schlesner
85c524bc45 Merge pull request #2697 from wwylele/proctex
Implemented Procedural Texture (Texture Unit 3)
2017-05-24 21:37:42 -07:00
wwylele
b010ff8174 pica/swrasterizer: implement procedural texture 2017-05-20 13:50:50 +03:00
wwylele
c033f16977 pica: use correct register value for shader bool_uniforms
variable value is not masked. the masked and combined register value should be used instead
2017-05-17 22:14:09 +03:00
Jannik Vogel
f3efa5e031 Pica: Write GS registers
This adds the handlers for the geometry shader register writes which will call the functions from the previous commit to update registers for the GS.
2017-05-12 16:22:37 +02:00
Jannik Vogel
52c66441ab Pica: Write shader registers in functions
The commit after this one adds GS register writes, so this moves the VS handlers into functions so they can be re-used and extended more easily.
2017-05-12 16:22:37 +02:00
Yuri Kunde Schlesner
ddf23d4a2e VideoCore: Split regs.h inclusions 2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner
55110e9361 VideoCore: Use union to index into Regs struct
Also remove some unused members.
2017-02-08 22:13:25 -08:00
Yuri Kunde Schlesner
a0b1957425 VideoCore: Move Regs to its own file 2017-02-04 13:59:12 -08:00
Yuri Kunde Schlesner
90d220d1b3 VideoCore: Split geometry pipeline regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner
1242f42a09 VideoCore: Split texturing regs from Regs struct 2017-02-04 13:59:09 -08:00
Yuri Kunde Schlesner
d3928b7f9a VideoCore: Split rasterizer regs from Regs struct 2017-02-04 13:08:47 -08:00
Yuri Kunde Schlesner
dcdaff5ecc VideoCore: Split shader output writing from semantic loading 2017-01-29 21:31:37 -08:00
Yuri Kunde Schlesner
067b9b54bd VideoCore: Consistently use shader configuration to load attributes 2017-01-29 21:31:37 -08:00
Yuri Kunde Schlesner
e05770fec4 VideoCore: Use correct register for immediate mode attribute count 2017-01-29 21:31:36 -08:00
Yuri Kunde Schlesner
a4a4b6408c VideoCore: Rename some types to more accurate names 2017-01-29 21:31:36 -08:00
Yuri Kunde Schlesner
07b51a7da0 VideoCore: Change misleading register names
A few registers had names such as "count" or "number" when they actually
contained the maximum (that is, count - 1). This can easily lead to hard
to notice off by one errors.
2017-01-29 21:31:36 -08:00
Yuri Kunde Schlesner
ab0b74b0f3 VideoCore/Shader: Move entry_point to SetupBatch 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner
1994f1a6f2 VideoCore/Shader: Move per-batch ShaderEngine state into ShaderSetup 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner
c863fc36ce Shader: Remove OutputRegisters struct 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner
73e7bc2592 VideoCore/Shader: Split shader uniform state and shader engine
Currently there's only a single dummy implementation, which will be
split in a following commit.
2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner
03d2b6aa89 VideoCore/Shader: Use only entry_point as ShaderSetup param
This removes all implicit dependency of ShaderState on global PICA
state.
2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner
2771bde17a VideoCore/Shader: Extract input vertex loading code into function 2017-01-25 18:53:20 -08:00
bunnei
79b3a1a1e7 Merge pull request #2319 from yuriks/profile-scopes
VideoCore: Make profiling scope more representative
2016-12-21 13:33:49 -05:00
bunnei
a50f5b4746 Merge pull request #2318 from yuriks/trace-opt
VideoCore: Inline IsPicaTracing
2016-12-18 21:15:24 -05:00
Yuri Kunde Schlesner
7d4827f520 VideoCore/Shader: Extract DebugData out from UnitState 2016-12-16 00:16:25 -08:00
Yuri Kunde Schlesner
66efdff1a7 VideoCore: Make profiling scope more representative 2016-12-14 22:52:09 -08:00
Yuri Kunde Schlesner
eb75205231 VideoCore: Inline IsPicaTracing
Speeds up ALBW main menu slightly (~3%)
2016-12-14 22:06:40 -08:00
Yuri Kunde Schlesner
d8fc6ee91b VideoCore: Eliminate an unnecessary copy in the drawcall loop 2016-12-14 21:00:29 -08:00
Lioncash
b0ebdfae34 Add all services to the Service namespace
Previously there was a split where some of the services were in the
Service namespace and others were not.
2016-12-11 00:07:27 +00:00
Emmanuel Gil Peyrot
87d3afe635 GPU: Remove the broken frame_skip option.
Fixes #1960.
2016-11-27 21:19:56 +00:00
jphalimi
5a580171b6 Cache Vertices instead of Output registers (#2165)
This patch brings +3% performance improvement on average. It removes
ToVertex() as an important hotspot of the emulator.
2016-11-23 23:10:34 -05:00
wwylele
1db648c247 Fix format error from #2195 2016-11-22 20:17:28 +02:00
Subv
9ee95ffbec GPU/CiTrace: Avoid calling GetTextures() when not necessary. 2016-11-19 19:27:00 -05:00
Ricardo de Almeida Gonzaga
07fdcf150d Fix typos 2016-10-20 12:26:59 -02:00
Yuri Kunde Schlesner
fa5d9d8266 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
1138ec0d49 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Yuri Kunde Schlesner
1e4a5da9f4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot
628ed4376a Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Jannik Vogel
0d7d513c54 Pica: Add fog state 2016-06-07 00:06:28 +02:00
bunnei
e88a0206f1 Merge pull request #1812 from JayFoxRox/refactor-shader
Retrieve shader result from new OutputRegisters-type
2016-05-31 18:12:56 -04:00
bunnei
cf069f5234 Merge pull request #1733 from lioncash/vert_loader
VertexLoader: Minor changes
2016-05-23 21:13:34 -04:00
Jannik Vogel
df3eeea302 Retrieve shader result from new OutputRegisters-type 2016-05-16 18:55:51 +02:00
Jannik Vogel
101eb11369 Move default_attributes into Pica state 2016-05-12 19:05:41 +02:00
Jannik Vogel
acfb5257dd Turn ShaderSetup into struct 2016-05-11 23:48:24 +02:00
Lioncash
561157d259 vertex_loader: Add constructors to facilitate immediate and two-step initialization 2016-05-08 23:03:32 -04:00
Jannik Vogel
db061e0568 Pica: Rename VertexLoaded breakpoint to VertexShaderInvocation 2016-05-04 10:21:51 +02:00
Emmanuel Gil Peyrot
c39a267974 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
bunnei
df1d6ff8a1 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