Add architecture documentation.
Change-Id: Ie28d3e61fda6fa01f5dc669a4ef3f4c0b09743d0
Reviewed-on: https://swiftshader-review.googlesource.com/5430
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/README.md b/README.md
index 71c4b4e..be93bca 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,11 @@
git push origin HEAD:refs/for/master
+Documentation
+-------------
+
+See (docs/Index.md)[docs/Index.md].
+
Contact
-----------
diff --git a/docs/Index.md b/docs/Index.md
new file mode 100644
index 0000000..26cde04
--- /dev/null
+++ b/docs/Index.md
@@ -0,0 +1,24 @@
+SwiftShader Documentation
+=========================
+
+SwiftShader provides high-performance graphics rendering on the CPU. It eliminates the dependency on graphics hardware or its capabilities.
+
+Architecture
+------------
+
+SwiftShader provides shared libraries (DLLs) which implement standardized graphics APIs. Applications already using these APIs thus don't require any changes to use SwiftShader. It can run entirely in user space, or as a driver (for Android), and output to either a frame buffer, window, or an offscreen buffer.
+
+There are four major layers:
+
+* API
+* Renderer
+* Reactor
+* JIT
+
+The API layer is an implementation of a graphics API, such as OpenGL (ES) or Direct3D, on top of the Renderer interface. It is responsible for managing API-level resources and rendering state, as well as compiling high-level shaders to bytecode form.
+
+The Renderer layer generates specialized processing routines for draw calls and coordinates the execution of rendering tasks. It defines the data structures used and how the processing is performed.
+
+Reactor is an embedded language for C++ to dynamically generate code in a WYSIWYG fashion. It allows to specialize the processing routines for the state and shaders used by each draw call. Its syntax closely resembles C and shading languages, to make the code generation easily readable.
+
+The JIT layer is a run-time compiler, such as LLVM. Reactor records its operations in an in-memory intermediate form which can be materialized by the JIT into a function which can be called directly.
\ No newline at end of file