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

Error while specializing generic functions with more than 1 type #3896

Closed
il1aster opened this issue Apr 4, 2024 · 0 comments · Fixed by #3916
Closed

Error while specializing generic functions with more than 1 type #3896

il1aster opened this issue Apr 4, 2024 · 0 comments · Fixed by #3916
Assignees
Labels
goal:client support Feature or fix needed for a current slang user.

Comments

@il1aster
Copy link

il1aster commented Apr 4, 2024

Hi,

Attempting to use generic functions with more than 1 type causes errors when compiling a slang module with runtime specialization of the component types. I reproduced this with the shader-toy sample by adding unused type parameters to the generic fragment shader function:

[shader("fragment")]
float4 fragmentMain<T : IShaderToyImageShader, U : IShaderToyImageShader, V: IShaderToyImageShader>(
    float4 sv_position : SV_Position)
    : SV_Target

and duplicating the specialization in the argument list passed to specialize():

    Slang::List<slang::SpecializationArg> specializationArgs;
    {
        slang::SpecializationArg effectTypeArg;
        effectTypeArg.kind = slang::SpecializationArg::Kind::Type;
        effectTypeArg.type = effectType;
        specializationArgs.add(effectTypeArg);
        specializationArgs.add(effectTypeArg);
        specializationArgs.add(effectTypeArg);
    }

The above modifications compile and run in debug mode with v2023.1.1 (similar to #3759), but produces the following error in master.

[GraphicsLayer]: INFO: CreateDevice: Debug layer is enabled.
shader-toy.slang(109): error 38005: expected a type as argument for specialization parameter '4'
float4 fragmentMain<T : IShaderToyImageShader, U : IShaderToyImageShader, V: IShaderToyImageShader>(

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:client support Feature or fix needed for a current slang user.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants