Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing improvements #6

Merged
merged 2 commits into from
Jun 14, 2017
Merged

Conversation

tangent-vector
Copy link
Contributor

There are two pieces here:

  • Upgrade the test runner to support multiple tests per input file

  • Use that capability to make some of the sascha-willems GLSL tests serve double duty as tests for binding generation

This covers the easy aspects of binding generation, but I'll probably need some more directed tests to cover constant buffer layout.

Now if there are multiple tests listed for an input file like `foo.slang`, they will be output as:

    passed test: 'foo.slang'
    passed test: 'foo.slang.1'
    passed test: 'foo.slang.2'

This isn't a perfect solution, but it should work well enough for now.
This change doesn't make any tests actually use the new capability.
Most of the Vulkan GLSL shaders in the `sascha-willems` corpus use completely regular parameter bindings, e.g.:

```
layout (binding = 0) uniform sampler2D samplerPositionDepth;
layout (binding = 1) uniform sampler2D samplerNormal;
layout (binding = 2) uniform sampler2D ssaoNoise;
```

With the Slang compiler, we can write this kind of stuff more compactly as:

```
uniform sampler2D samplerPositionDepth;
uniform sampler2D samplerNormal;
uniform sampler2D ssaoNoise;
```

and get the exact same result (in fact, we will generate output GLSL matching the first example).

There are a few spot tests for this in the HLSL case, but I hadn't done anything for GLSL yet.
Now that we have the ability to specify multiple tests to run on each input file, it was easy enough to go in and tweak some of these files to be usable as binding-generation tests.

I didn't ammend all of the GLSL shaders for two reasons:

1. Not all of the shaders will work with completely automatic binding generation done on a per-file basis. In some cases, the parameter layout needs to consider multiple files (and the order in which the files are supplied could matter). This is probably best handled with more directed tests.

2. There is going to be a ton of duplication if I just have 100s of tests that all confirm that, yes, the Slang compiler can count vertex inputs starting from zero. These shaders aren't really presenting a whole lot of unique cases to work with.

That said, a level of confidence greater than zero is always better than zero confidence.
@tangent-vector tangent-vector merged commit 8ddf03f into shader-slang:master Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant