diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-01-22 11:57:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-22 08:57:53 -0800 |
| commit | 14211ec3c4e56e59f479dbac23123ea61eab7d91 (patch) | |
| tree | 2ccc5c02bfbdfc3d34f077036b9ab8cd8c4d4def /source/slang/slang-ir-entry-point-uniforms.cpp | |
| parent | ea98e24d304f99f9d49daa8d870a953bdf3d49e7 (diff) | |
Remove unnecessary parameters from Metal entry point signature (#6131)
* fix metal entry point global params
* address review comments, cleanup and test
* remove dead code
* undo accidental change
* address review comments and cleanup
* minor fix and cleanup
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-ir-entry-point-uniforms.cpp')
| -rw-r--r-- | source/slang/slang-ir-entry-point-uniforms.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/slang/slang-ir-entry-point-uniforms.cpp b/source/slang/slang-ir-entry-point-uniforms.cpp index b3073a97d..12dcd187a 100644 --- a/source/slang/slang-ir-entry-point-uniforms.cpp +++ b/source/slang/slang-ir-entry-point-uniforms.cpp @@ -494,19 +494,27 @@ struct MoveEntryPointUniformParametersToGlobalScope : PerEntryPointPass // for CPU/CUDA) that might want to treat entry-point parameters // different from other cases. // - // TODO: Once we have support for multiple entry points to be emitted - // at once, we need a way to associate these per-entry-point parameters - // more closely with the original entry point. The two easiest options - // are: + // We need a way to associate these per-entry-point parameters + // more closely with the original entry point. The two current + // methods are: // // 1. Don't move the new aggregate parameter to the global scope // on those targets, and instead keep it as a parameter of the - // entry point. + // entry point. This is used for CPU/CUDA targets. // - // 2. Use a decoration on the entry point itself to point at the - // global parameter for its per-entry-point parameter data. + // 2. Use a decoration on the global param itself to point at the + // entry point for its per-entry-point parameter data, without moving + // the parameter to the global scope. This is used for Metal targets, as + // Metal does not have global parameters at the global scope. // - builder->addDecoration(globalParam, kIROp_EntryPointParamDecoration); + // Method (1) is not used because Metal contains shading language concepts + // such as binding offets, similar to other shading language targets. + // We want to reuse code from other shading language targets for Metal, hence + // we move parameters to the global scope, and then move the parameters back to + // the entry points that they originate from. The originating entry points are + // tracked through this decoration. + // + builder->addEntryPointParamDecoration(globalParam, entryPointFunc); param->replaceUsesWith(globalParam); param->removeAndDeallocate(); |
