Fix entry_point() crash on generic compute shaders with integer generic parameters#791
Draft
Fix entry_point() crash on generic compute shaders with integer generic parameters#791
Conversation
…meters For unspecialized generic entry points (e.g. with integer generic parameters like `<int N>`), calling getLayout() on the Slang entry point throws an internal Slang exception that nanobind cannot translate. Two fixes: 1. In SlangEntryPoint::init(), check getSpecializationParamCount() before calling getLayout(). For unspecialized generics, use the descriptor name and ShaderStage::none as fallback. The proper name/stage will be set when specialize() is called. 2. In SlangModule::entry_points(), use getFunctionReflection()->getName() instead of getLayout()->getEntryPointByIndex(0)->getName() to get the entry point name, avoiding the getLayout() call entirely. Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
…ation to test Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix nanobind exception in module.entry_point() for generic shaders
Fix entry_point() crash on generic compute shaders with integer generic parameters
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
module.entry_point()throws an untranslatable nanobind exception on generic compute shaders with integer generic parameters (e.g.,<int N>). The Slang API'sgetLayout()cannot be called on unspecialized generic entry points—it throws an internal exception that bypasses nanobind's exception translation.Changes
SlangEntryPoint::init(): CheckgetSpecializationParamCount() > 0before callinggetLayout(). For unspecialized generics, use the descriptor name andShaderStage::noneas temporaries—both are resolved correctly whenspecialize()is later called.SlangModule::entry_points(): ReplacegetLayout()->getEntryPointByIndex(0)->getName()withgetFunctionReflection()->getName(). The latter is available directly onIEntryPointand works for generic entry points without requiring layout computation.entry_point()andentry_pointswith<int N>generics.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.