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

Add support for callable shaders in gfx #3460

Merged
merged 3 commits into from
May 28, 2024

Conversation

skallweitNV
Copy link
Collaborator

@skallweitNV skallweitNV commented Jan 18, 2024

Breaking change:

The ABI around gfx shader table creation is changed. Users of gfx will need to rebuild from source after upgrading.

There are no breaking changes in Slang.

@skallweitNV
Copy link
Collaborator Author

Falcor tests are failing because this change breaks binary compatibility. @csyonghe what is the best way to deal with this? Ignore the failing test and update Falcor ASAP?

@csyonghe
Copy link
Collaborator

Yeah, looks like we have to ignore this and update Falcor on the CO servers later.

The alternative is to add a Desc2 and createSjaderTable2 function.

@skallweitNV
Copy link
Collaborator Author

yeah, I don't think that change is worth splitting the struct/function

@skallweitNV
Copy link
Collaborator Author

skallweitNV commented Jan 19, 2024

One thing that might be worth considering is adding a Desc2 that uses a separate list of names and then just uses indices into that list for referencing them. This would allow for more performant creation of the shader binding table, because with the current version every entry needs to do a hash table lookup with a string key. I'm imagining something like this:

struct Desc2
{
    // List of entry point and hit group names referenced in the program.
    GfxCount nameCount;
    const char** names;

    GfxCount rayGenShaderCount;
    const GfxIndex* rayGenShaderEntryPointNames;
    const ShaderRecordOverwrite* rayGenShaderRecordOverwrites;

    GfxCount missShaderCount;
    const GfxIndex* missShaderEntryPointNames;
    const ShaderRecordOverwrite* missShaderRecordOverwrites;

    GfxCount hitGroupCount;
    const GfxIndex* hitGroupsNames;
    const ShaderRecordOverwrite* hitGroupRecordOverwrites;

    GfxCount callableShaderCount;
    const GfxIndex* callableShaderEntryPointNames;
    const ShaderRecordOverwrite* callableShaderRecordOverwrites;

    IShaderProgram* program;
};

This would allow to lookup the names once, and then just use indices, making construction of large tables more performant.

@csyonghe
Copy link
Collaborator

That sounds like a good idea. Would you implement this in this PR so we keep binary compabitity and also provide a more efficient interface?

@skallweitNV
Copy link
Collaborator Author

I think I would add the changes to Desc as is in this PR. And then add Desc2 in a separate PR, this way both APIs have the ability to add callable shaders.

@csyonghe
Copy link
Collaborator

If we can just do that in Desc2 and keep Desc unchanged for now, that will avoid breaking Falcor test, and once Desc2 is there we can update Falcor on our CI servers. There are a lot of work going on here that require a functional Falcor test, and I am little worried that things will slip through if we are not having Falcor test for a while.

@skallweitNV
Copy link
Collaborator Author

@csyonghe can we merge this now that falcor tests are decoupled from gfx changes?

@csyonghe
Copy link
Collaborator

Yes, let's do it.

@csyonghe csyonghe added the pr: breaking change PRs with breaking changes label May 23, 2024
@csyonghe csyonghe merged commit eefdd4a into shader-slang:master May 28, 2024
16 checks passed
@skallweitNV skallweitNV deleted the gfx-callable-shader branch June 6, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: breaking change PRs with breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants