summaryrefslogtreecommitdiffstats
path: root/gfx/wr/glsl-to-cxx/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /gfx/wr/glsl-to-cxx/README.md
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/glsl-to-cxx/README.md')
-rw-r--r--gfx/wr/glsl-to-cxx/README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/gfx/wr/glsl-to-cxx/README.md b/gfx/wr/glsl-to-cxx/README.md
new file mode 100644
index 0000000000..54dcbc7d61
--- /dev/null
+++ b/gfx/wr/glsl-to-cxx/README.md
@@ -0,0 +1,21 @@
+A GLSL to C++ translator.
+
+Translates GLSL to vectorized C++. Intended for use with WebRender software backend.
+
+Architecture
+------------
+GLSL code is parsed by the glsl crate. In hir.rs we traverse the resulting AST
+and build a higher level representation by doing type checking and name
+resolution. The resulting hir tree is traversed by lib.rs to output C++ code.
+
+The generated C++ code is 4x wider then the original glsl. i.e. a glsl 'float'
+becomes a C++ 'Float' which is represented by a xmm register (a vector of 4 floats).
+Likewise, a vec4 becomes a struct of 4 'Float's for a total of 4 xmm registers and
+16 floating point values.
+
+Vector branching is flattened to non-branching code that unconditionally runs both
+sides of the branch and combines the results with a mask based on the condition.
+
+The compiler also supports scalarization. Values that are known to be the same
+across all vector lanes are translated to scalars instead of vectors. Branches on
+scalars are translated as actual branches.