Docs! More docs!

This commit is contained in:
DrChat 2016-11-18 22:01:45 -06:00
parent e3ac7bdae8
commit ef93161114
2 changed files with 70 additions and 4 deletions

View File

@ -1,17 +1,37 @@
# GPU Documentation # GPU Documentation
## The Xenos Chip
The [Xenos](https://en.wikipedia.org/wiki/Xenos_\(graphics_chip\)) is a graphics
chip designed by AMD based off of the R5xx architecture.
### Command Processing
The Xenos runs commands supplied to it directly by the DirectX bare-bones driver
via a ringbuffer located in system memory.
The bulk of the command processing code is located at
[src/xenia/gpu/command_processor.cc](../src/xenia/gpu/command_processor.cc)
### EDRAM
The Xenos uses special high-speed memory located on the same die as the chip to
store framebuffers/render targets.
TODO: More documentation
## Options ## Options
### General ### General
See the top of [src/xenia/gpu/gpu.cc](https://github.com/benvanik/xenia/blob/master/src/xenia/gpu/gpu.cc). See the top of [src/xenia/gpu/gpu.cc](../src/xenia/gpu/gpu.cc).
`--vsync=false` will attempt to render the game as fast as possible instead of `--vsync=false` will attempt to render the game as fast as possible instead of
waiting for a fixed 60hz timer. waiting for a fixed 60hz timer.
### OpenGL ### OpenGL
See the top of [src/xenia/gpu/gl4/gl4_gpu.cc](https://github.com/benvanik/xenia/blob/master/src/xenia/gpu/gl4/gl4_gpu.cc). See the top of [src/xenia/gpu/gl4/gl4_gpu.cc](../src/xenia/gpu/gl4/gl4_gpu.cc).
Buggy GL implementations can benefit from `--thread_safe_gl`. Buggy GL implementations can benefit from `--thread_safe_gl`.
@ -42,7 +62,7 @@ Playground tool.
#### Shader Playground #### Shader Playground
Built separately (for now) under [tools/shader-playground/](https://github.com/benvanik/xenia/blob/master/tools/shader-playground/) Built separately (for now) under [tools/shader-playground/](../tools/shader-playground/)
is a GUI for interactive shader assembly, disassembly, validation, and is a GUI for interactive shader assembly, disassembly, validation, and
translation. translation.
@ -59,7 +79,7 @@ disassembly is broken. Finally, the right most box will show the
translated shader in the desired format. translated shader in the desired format.
For more information and setup instructions see For more information and setup instructions see
[tools/shader-playground/README.md](https://github.com/benvanik/xenia/blob/master/tools/shader-playground/README.md). [tools/shader-playground/README.md](../tools/shader-playground/README.md).
### xe-gpu-trace-viewer ### xe-gpu-trace-viewer
@ -95,6 +115,10 @@ you to seek through them in the trace viewer. These files will get large.
### Command Buffer/Registers ### Command Buffer/Registers
Registers documented at [src/xenia/gpu/register_table.inc](../src/xenia/gpu/register_table.inc).
PM4 commands documented at [src/xenia/gpu/xenos.h](../src/xenia/gpu/xenos.h#L521).
### Shaders ### Shaders
* [LLVM R600 Tables](https://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/R600Instructions.td) * [LLVM R600 Tables](https://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/R600Instructions.td)

42
docs/kernel.md Normal file
View File

@ -0,0 +1,42 @@
# Kernel Documentation
## Kernel shims
Xenia implements all kernel APIs as native functions under the host.
When a module is loaded, the loader will find all kernel imports, put a syscall in
their place, then lookup a kernel export and link it to each import. The JIT will
generate a sequence of instructions to call into Xenia's export if it encounters a syscall.
Currently, there are two ways an export can be defined -
[for example](../src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc):
* `SHIM_CALL XAudioGetSpeakerConfig_shim(PPCContext* ppc_context, KernelState* kernel_state)`
* `dword_result_t XAudioGetSpeakerConfig(lpdword_t config_ptr)`
The `SHIM_CALL` convention is deprecated, but allows a closer look at the internals of how
calls are done. `ppc_context` is the guest PowerPC context, which holds all guest
registers. Function parameters are fetched from r3...r10 (`SHIM_GET_ARG_32`), and
additional parameters are loaded from the stack. The return value (if there is one)
is stored in r3 (`SHIM_SET_RETURN_32`).
Details on how calls transition from guest -> host can be found in the [cpu documentation](cpu.md).
The newer convention does the same, but uses templates to automate the process
of loading arguments and setting a return value.
## Kernel Modules
Xenia has an implementation of two xbox kernel modules, xboxkrnl.exe and xam.xex
### xboxkrnl.exe - Xbox kernel
Defined under src/xenia/kernel/xboxkrnl.
This is a slightly modified version of the NT kernel. Most of the APIs
are equivalent to ones you'd find on MSDN or other online sources.
Source files are organized into groups of APIs.
### xam.xex - Xbox Auxiliary Methods
Defined under src/xenia/kernel/xam.
This module implements functionality specific to the Xbox.