summaryrefslogtreecommitdiffstats
path: root/tests/bindings/README.md
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-09 11:34:21 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-09 13:44:59 -0700
commitfcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch)
tree41047c94883b86ec085a81597391ce3ef557cd43 /tests/bindings/README.md
parent52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff)
Initial import of code.
Diffstat (limited to 'tests/bindings/README.md')
-rw-r--r--tests/bindings/README.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/bindings/README.md b/tests/bindings/README.md
new file mode 100644
index 000000000..ccc9fecb9
--- /dev/null
+++ b/tests/bindings/README.md
@@ -0,0 +1,29 @@
+Binding Generation Tests
+========================
+
+These tests ensure that the compiler can correctly add explicit binding information (e.g., HLSL `register` semantics) to code that does not originally have them.
+
+Example
+-------
+
+Given code like:
+
+ Texture2D ta;
+ Texture2D tb;
+
+We expect to produce output like:
+
+ Texture2D ta : register(t0);
+ Texture2D tb : register(t1);
+
+The resulting code guarantees that `tb` will always be assigned to the same location, regardless of how these values are (or are not) used in later shader code.
+
+Methodology
+-----------
+
+These tests currently rely on the ability to run the same HLSL code through the Spire compiler driver and execute either Spire, or HLSL. We write an example like the above by wrapping explicit `register` semantics in a macro:
+
+ Texture2D ta R(: register(t0));
+ Texture2D tb R(: register(t1));
+
+In the HLSL case, these annotations will manually place things where we want them, while in the Spire case, we define the macro to have an empty expansion, so that the annotations express our expectation for what the compiler will auto-generate. \ No newline at end of file