diff options
| -rw-r--r-- | source/slang/compiler.cpp | 41 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 11 |
2 files changed, 33 insertions, 19 deletions
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp index ea1b650a8..ed222d181 100644 --- a/source/slang/compiler.cpp +++ b/source/slang/compiler.cpp @@ -301,9 +301,26 @@ namespace Slang char const* stagePrefix = nullptr; switch( profile.GetStage() ) { + // Note: All of the raytracing-related stages require + // compiling for a `lib_*` profile, even when only a + // single entry point is present. + // + // We also go ahead and use this target in any case + // where we don't know the actual stage to compiel for, + // as a fallback option. + // + // TODO: We also want to use this option when compiling + // multiple entry points to a DXIL library. + // default: - return "unknown"; + stagePrefix = "lib"; + break; + // The traditional rasterization pipeline and compute + // shaders all have custom profile names that identify + // both the stage and shader model, which need to be + // used when compiling a single entry point. + // #define CASE(NAME, PREFIX) case Stage::NAME: stagePrefix = #PREFIX; break CASE(Vertex, vs); CASE(Hull, hs); @@ -311,15 +328,6 @@ namespace Slang CASE(Geometry, gs); CASE(Fragment, ps); CASE(Compute, cs); - - // Note: dxc requires a `lib` target for all - // ray tracing stages. - CASE(RayGeneration, lib); - CASE(Intersection, lib); - CASE(AnyHit, lib); - CASE(ClosestHit, lib); - CASE(Miss, lib); - CASE(Callable, lib); #undef CASE } @@ -976,7 +984,18 @@ String dissassembleDXILUsingDXC( TargetRequest* targetReq, UInt entryPointIndex) { - auto outputPath = targetReq->entryPointOutputPaths[entryPointIndex]; + // It is possible that we are dynamically discovering entry + // points (using `[shader(...)]` attributes), so that the + // number of entry points on the compile request does not + // match the number of entries in teh `entryPointOutputPaths` + // array. + // + String outputPath; + if( entryPointIndex < targetReq->entryPointOutputPaths.Count() ) + { + outputPath = targetReq->entryPointOutputPaths[entryPointIndex]; + } + auto& result = targetReq->entryPointResults[entryPointIndex]; // Skip the case with no output diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 1729508f7..f67123cc6 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -246,15 +246,10 @@ Profile getEffectiveProfile(EntryPointRequest* entryPoint, TargetRequest* target case Stage::AnyHit: case Stage::Miss: case Stage::Callable: - stageMinVersion = ProfileVersion::DX_6_3; - - // When compiling for DXR, we don't actually have distinct - // profiles for all of the DXR stages (e.g., there is no - // `raygeneration_6_3` profile), so we will clear out - // the stage part of the effective profile to avoid - // using a stage that isn't allowed downstream. + // The DirectX ray tracing stages implicitly + // require Shader Model 6.3 or later. // - effectiveProfile.setStage(Stage::Unknown); + stageMinVersion = ProfileVersion::DX_6_3; break; // TODO: Add equivalent logic for geometry, tessellation, and compute stages. |
