summaryrefslogtreecommitdiffstats
path: root/tests/reflection
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-07-31 11:03:53 -0400
committerGitHub <noreply@github.com>2018-07-31 11:03:53 -0400
commit9914ca800c92e9b3fe768dec4e913a302f3d678d (patch)
tree49544fb2c0387f39876fd99e112cfc32ed05302d /tests/reflection
parent171f524d7ca2922084a33f50c77a1e8797e80949 (diff)
Feature/attributed binding (#621)
* Typo fix, and added dxc to command line documentation. * Fix small typos. Added support for Scope to lexer. Fix bug in Token ctor. * Add support for attribute names that are scoped. * Added GLSLBindingAttribute. Make binding work through core.met.slang. * Allow [[gl::binding(binding, set)]] [[vk::binding(binding,set)]]
Diffstat (limited to 'tests/reflection')
-rw-r--r--tests/reflection/binding-gl.hlsl27
-rw-r--r--tests/reflection/binding-gl.hlsl.expected112
2 files changed, 139 insertions, 0 deletions
diff --git a/tests/reflection/binding-gl.hlsl b/tests/reflection/binding-gl.hlsl
new file mode 100644
index 000000000..cd2ab666a
--- /dev/null
+++ b/tests/reflection/binding-gl.hlsl
@@ -0,0 +1,27 @@
+//TEST:REFLECTION:-profile ps_4_0 -target spirv
+
+// Confirm that we can generate reflection info for arrays
+//
+// Note: just working with fixed-size arrays for now.
+// Unbounded arrays may require more work.
+
+layout(binding=0, set = 1) cbuffer MyConstantBuffer
+{
+ float x;
+
+ float a[10];
+
+ float y;
+}
+
+[[vk::binding(1,2)]] Texture2D tx;
+[gl::binding(2,3)] Texture2D ta;
+Texture2D ty;
+SamplerState sx;
+SamplerState sa[4];
+SamplerState sy;
+
+float4 main() : SV_Target
+{
+ return 0.0;
+} \ No newline at end of file
diff --git a/tests/reflection/binding-gl.hlsl.expected b/tests/reflection/binding-gl.hlsl.expected
new file mode 100644
index 000000000..5ace782cc
--- /dev/null
+++ b/tests/reflection/binding-gl.hlsl.expected
@@ -0,0 +1,112 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "MyConstantBuffer",
+ "binding": {"kind": "descriptorTableSlot", "space": 1, "index": 0},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "x",
+ "type": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 4}
+ },
+ {
+ "name": "a",
+ "type": {
+ "kind": "array",
+ "elementCount": 10,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ },
+ "uniformStride": 16
+ },
+ "binding": {"kind": "uniform", "offset": 16, "size": 160}
+ },
+ {
+ "name": "y",
+ "type": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ },
+ "binding": {"kind": "uniform", "offset": 176, "size": 4}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "tx",
+ "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 1},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "ta",
+ "binding": {"kind": "descriptorTableSlot", "space": 3, "index": 2},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "ty",
+ "binding": {"kind": "descriptorTableSlot", "index": 0},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "sx",
+ "binding": {"kind": "descriptorTableSlot", "index": 1},
+ "type": {
+ "kind": "samplerState"
+ }
+ },
+ {
+ "name": "sa",
+ "binding": {"kind": "descriptorTableSlot", "index": 2},
+ "type": {
+ "kind": "array",
+ "elementCount": 4,
+ "elementType": {
+ "kind": "samplerState"
+ }
+ }
+ },
+ {
+ "name": "sy",
+ "binding": {"kind": "descriptorTableSlot", "index": 3},
+ "type": {
+ "kind": "samplerState"
+ }
+ },
+ {
+ "name": "SLANG_hack_samplerForTexelFetch",
+ "binding": {"kind": "descriptorTableSlot", "index": 4},
+ "type": {
+ "kind": "samplerState"
+ }
+ }
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
+ ]
+}
+}