Skip to content

Support for Ray Tracing shaders (.rgen, .rchit, etc.) in ShaderCompiler.Build #2

@fidarit

Description

@fidarit

Hello!

I'm trying to use XenoAtom.ShaderCompiler.Build to compile ray tracing shaders, but the compiler doesn't seem to recognize or process files with ray tracing extensions:

  • Ray-Generation (.rgen)
  • Ray-Closest-Hit (.rchit)
  • Ray-Any-Hit (.rahit)
  • Ray-Miss (.rmiss)
  • Ray-Intersection (.rint)

Attempted Workaround

I tried to force compilation by adding a custom ItemGroup in my .csproj file:

<ItemGroup>
  <ShaderCompile Include="assets\shaders\RayTracing*.*">
    <ShaderCompilerOption_source_language>glsl</ShaderCompilerOption_source_language>
    <ShaderCompilerOption_target_env>vulkan1.2</ShaderCompilerOption_target_env>
  </ShaderCompile>
</ItemGroup>

This correctly sets the source language and target environment, but compilation fails with the following error:

error: Stage not specified by #pragma or not inferred from file extension

Expected Behavior

  • Automatic recognition of RT stages.
  • Or a way to specify the stage via MSBuild properties.

Actual Behavior

Files are either ignored or fail with the stage inference error.

Additional Context

Is there a way to configure the compiler to support these? For example, custom MSBuild props/targets or additional flags? If not supported yet, could this be added as a feature?

Thanks in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions