summaryrefslogtreecommitdiffstats
path: root/tests/render/render0.hlsl
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-10-06 14:31:42 -0700
committerGitHub <noreply@github.com>2017-10-06 14:31:42 -0700
commitfaf26afdcfd343c79517f56f215bf8dcd5e0b992 (patch)
tree070bbc0acb2ed5c9a5e522ea522fbcfdc77af78c /tests/render/render0.hlsl
parent3693bff4a2b822a2b29ac563d464d1012a3a3eda (diff)
Perform some transformations on IR to legalize for GLSL (#200)
When outputting GLSL from a Slang or HLSL entry point, we need to translate any parameters or results of an entry-point function into global declarations of `in` or `out` parameters, as needed by GLSL. This change adds these transformations at the IR level, so that they don't need to complicate the emit logic. More detailed changes: - Make `render0` test use IR. It passes out of the box. - Fix test runner to not always dump diffs on failures I accidentally initialized an option to `true` instead of `false` when working on debugging the Travis CI failures. - Special-case output for component-wise multiplication to handle GLSL `matrixCompMul()` - Handle GLSL vs. HLSL output for calls to `mul()` - Output proper `layout(std140)` on GLSL constant buffer declarations - Require appropriate GLSL extension when emitting explicit `layout(offset = ...)` on constant buffer members - TODO: Need to avoid requiring this extension in cases where the offsets are what would be computed anyway. Realistically, should probably be emitting code with explicit padding, etc. to guarantee layouts. - Add an IR-based pass to translate entry point functions by eliminating their input/output parameters and replacing them with global variables. - Demangle names when calling target intrinsics The lowering to the IR will turn a call like `sin(foo)` into a call to a function declaration with a mangled name like `_S3sin...`. This works fine when the user is calling their own functions, since the name mangling will apply to both the definition and use sites, but for builtin functions it obviously isn't what we want. This change makes it so that we demangle the name of an instrinsic function just enough so that we can extract the original simple name, and make a call using that. These changes do nor provide 100% of what we need when translating to GLSL, so the `cross-compile-entry-point` test *still* hasn't been flipped over to use the IR (even though that is the test case I've been using to develop these changes).
Diffstat (limited to 'tests/render/render0.hlsl')
-rw-r--r--tests/render/render0.hlsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/render/render0.hlsl b/tests/render/render0.hlsl
index e6849fe60..833788ad1 100644
--- a/tests/render/render0.hlsl
+++ b/tests/render/render0.hlsl
@@ -1,4 +1,4 @@
-//TEST(smoke):COMPARE_HLSL_RENDER:
+//TEST(smoke):COMPARE_HLSL_RENDER:-xslang -use-ir
// Starting with a basic test for the ability to render stuff...
cbuffer Uniforms