summaryrefslogtreecommitdiffstats
path: root/tests/reflection/parameter-block-explicit-space.slang.expected
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-01-08 14:45:06 -0800
committerGitHub <noreply@github.com>2020-01-08 14:45:06 -0800
commit0a856f458ff9f17d76bc646d008602713c6c66d1 (patch)
tree8b4642a374fb5b4d06411f2a9c383a6079a7426e /tests/reflection/parameter-block-explicit-space.slang.expected
parentcae5ddd4a2c9343ec7367c9049c5cc0c8628a9c4 (diff)
Cover a few corner cases in reflection API (#1163)
This change adds some new entry points to the reflection API to cover corner cases that a majority of applications won't care about. These are most likely to come up for users who want to make a complete copy of the Slang reflection information into a data format of their own design. All of the information is stuff that we already computed as part of layout, and just hadn't exposed: * Alignment information for type layouts. This is only useful for ordinary/uniform data; in all other cases alignment is always one. Even for uniform/ordinary data, it is unlikely that any application would actually make use of it. * Layout information for the result of an entry point function. This would be useful for applications that need to enumerate the varying outputs (user- or system-defined) of a shader. Having information available for `out` parameters but not the function result was inconsistent. * The "element type" of a parameter block type (e.g., going from `ParameterBlock<X>` to `X`). This seems to have been an oversight since `ConstantBuffer<X>` appears to have been implemented, and the case for a type *layout* was handled. * The "container" variable layout for a parameter block or constant buffer. It took a while for us to arrive at the current representation of layout for parameter groups, and most client code continues to use the original API that requires us to generated kludged "do what I mean" data. However, if we don't expose the more useful new representation fully, there is no way for users to take advantage of it! The reflection test tool has been updated to print the new information where it makes sense, which provides us some level of coverage for the new code. Unfortunately, this led to some cascading changes: * First, a bunch of the tests had their output changed since they include new information. That's the easy bit. * Next, the "container" and "element" var layouts don't actually have names (because there is no actual variable underlying them), which means that the code to emit variable names in the JSON dump needed to be condition. * Making the `"name"` output conditional messed up a lot of the delicate logic that had been dealing with when to emit commas for the output JSON (JSON uses commas as separators, and doesn't allow trailing commas). I added a bit of new infrastructure to make it simple(-ish) to track when a comma actually needs to be output.
Diffstat (limited to 'tests/reflection/parameter-block-explicit-space.slang.expected')
-rw-r--r--tests/reflection/parameter-block-explicit-space.slang.expected115
1 files changed, 114 insertions, 1 deletions
diff --git a/tests/reflection/parameter-block-explicit-space.slang.expected b/tests/reflection/parameter-block-explicit-space.slang.expected
index f7944c644..a96f95961 100644
--- a/tests/reflection/parameter-block-explicit-space.slang.expected
+++ b/tests/reflection/parameter-block-explicit-space.slang.expected
@@ -52,6 +52,60 @@ standard output = {
"binding": {"kind": "samplerState", "index": 0}
}
]
+ },
+ "containerVarLayout": {
+ "bindings": [
+ {"kind": "constantBuffer", "index": 0},
+ {"kind": "registerSpace", "index": 0}
+ ]
+ },
+ "elementVarLayout": {
+ "type": {
+ "kind": "struct",
+ "name": "A",
+ "fields": [
+ {
+ "name": "au",
+ "type": {
+ "kind": "vector",
+ "elementCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 16}
+ },
+ {
+ "name": "at1",
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ },
+ "binding": {"kind": "shaderResource", "index": 0}
+ },
+ {
+ "name": "at2",
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ },
+ "binding": {"kind": "shaderResource", "index": 1}
+ },
+ {
+ "name": "as",
+ "type": {
+ "kind": "samplerState"
+ },
+ "binding": {"kind": "samplerState", "index": 0}
+ }
+ ]
+ },
+ "bindings": [
+ {"kind": "shaderResource", "index": 0, "count": 2},
+ {"kind": "samplerState", "index": 0},
+ {"kind": "uniform", "offset": 0, "size": 16}
+ ]
}
}
},
@@ -95,6 +149,52 @@ standard output = {
"binding": {"kind": "samplerState", "index": 0}
}
]
+ },
+ "containerVarLayout": {
+ "bindings": [
+ {"kind": "constantBuffer", "index": 0},
+ {"kind": "registerSpace", "index": 0}
+ ]
+ },
+ "elementVarLayout": {
+ "type": {
+ "kind": "struct",
+ "name": "B",
+ "fields": [
+ {
+ "name": "bu",
+ "type": {
+ "kind": "vector",
+ "elementCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 16}
+ },
+ {
+ "name": "bt",
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ },
+ "binding": {"kind": "shaderResource", "index": 0}
+ },
+ {
+ "name": "bs",
+ "type": {
+ "kind": "samplerState"
+ },
+ "binding": {"kind": "samplerState", "index": 0}
+ }
+ ]
+ },
+ "bindings": [
+ {"kind": "shaderResource", "index": 0},
+ {"kind": "samplerState", "index": 0},
+ {"kind": "uniform", "offset": 0, "size": 16}
+ ]
}
}
}
@@ -102,7 +202,20 @@ standard output = {
"entryPoints": [
{
"name": "main",
- "stage:": "fragment"
+ "stage:": "fragment",
+ "result:": {
+ "stage": "fragment",
+ "binding": {"kind": "varyingOutput", "index": 0},
+ "semanticName": "SV_TARGET",
+ "type": {
+ "kind": "vector",
+ "elementCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ }
+ }
}
]
}