diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-06-12 14:33:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-12 14:33:31 -0700 |
| commit | ce90fec1c795eaafbd91d7b8a83501a57eeb1946 (patch) | |
| tree | 2e939a9ef7b972944b71ea3f7d11a17af844c3fe /tests/front-end/struct.slang | |
| parent | d1f11a29f8a48eecd47ac64c8635ed062cba982d (diff) | |
| parent | 5b49974bd6ddd248b5ee1b1e29c0acfc3c422a3a (diff) | |
Merge pull request #3 from tfoleyNV/rename-tests
Rename tests from `*.spire` to `*.slang`
Diffstat (limited to 'tests/front-end/struct.slang')
| -rw-r--r-- | tests/front-end/struct.slang | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/front-end/struct.slang b/tests/front-end/struct.slang new file mode 100644 index 000000000..16b1bebc7 --- /dev/null +++ b/tests/front-end/struct.slang @@ -0,0 +1,49 @@ +//TEST:SIMPLE: +// test that `struct` decls work + +// Note(tfoley): disabled during syntax transition +// #include "pipeline-simple.slang.h" + +// struct declaration +struct Foo +{ + float3 a; + float3 b; +}; + +// function on a struct +Foo makeFoo(float x, float y) +{ + // local of struct type + Foo foo; + foo.a = float3(x); + foo.b = float3(y); + return foo; +} + +/* Note(tfoley): disabled during syntax transition + +template shader Test() +// targets StandardPipeline +{ + // Uniform of struct type + param Foo foo1; + + @MeshVertex float3 position; + @MeshVertex float3 color; + + param mat4 modelViewProjection; + + public vec4 projCoord = modelViewProjection * vec4(position, 1.0); + + // Component of struct type + // Note(tfoley): use of `public` here required to work around parser limitations + public Foo foo2 = makeFoo(color.x, color.y); + + // + float3 result = foo1.a + foo2.b; + + out @Fragment vec4 colorTarget = vec4(result,1); +} + +*/
\ No newline at end of file |
