shader-slang / slang

Making it easier to work with shaders
MIT License
2.07k stars 178 forks source link

Metal compute tests #4292

Closed skallweitNV closed 4 months ago

skallweitNV commented 4 months ago

This PR adds support for running compute tests with the new metal backend.

The current state is:

All tests that fail to compile are disabled using

//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl

See #4291 for more details.

skallweitNV commented 4 months ago

I don't quite understand why this change leads to the following failing tests:

Also there is one COMPARE_HLSL_RENDER test that fails on metal:

@csyonghe ?

csyonghe commented 4 months ago

The texture2d test may be using a vertex-fragment shader and we seem to be generating invalid vertex shader code for metal, causing the test to fail.

csyonghe commented 4 months ago

Not sure about the matrix layout tests. None of the changes here seemed to be relevant. I can take a look into this.

skallweitNV commented 4 months ago

I "fixed" the tests by specifying the actual APIs they should run on instead of disabling for metal.

csyonghe commented 4 months ago

Looks good! We can clean up the test discovery logic later to make this more elegant, but we don't have to do that now.