Repository navigation
Wrap compiler options, module loading and global queries - #21
Merged
Merged
Conversation
The idiomatic layer wrapped 14 of Slang's ~80 COM methods and none of its ~160 compiler options. This adds the three groups chosen for 0.0.11. Compiler options. SessionBuilder gains typed setters for the common ones -- optimization, debugInfo, warningsAsErrors, disableWarnings, languageVersion, capability (by name, resolved through findCapability) and bitfieldPacking, the last being Slang 2026.19's fix for MSVC-compatible packing -- plus raw option(name, value) overloads taking ffi.gen.CompilerOptionName constants for everything else. TargetOptions gets the same raw overloads, per target. Slang loads the session's entries before adding targets, so each target inherits them and its own entries override; the javadoc warns that FloatingPointMode, LineDirectiveMode and GLSLForceScalarLayout are re-applied from TargetDesc fields after inheritance, so those only work per target. New enums OptimizationLevel, DebugInfoLevel and BitfieldPacking follow Stage's value()/of(int)/UNKNOWN convention; passing UNKNOWN is refused. Module loading and introspection. Session.loadModule(name) resolves an import name through the search paths or a SlangFileSystem, and returns an already-loaded module rather than recompiling. Module gains name(), filePath(), dependencyFiles() (its source, #includes, and the sources of modules it imports -- checked, not assumed), entryPoints() (what Slang found: [shader(...)] functions and, as Slang infers, [numthreads]-only compute functions) and entryPoint(name, stage) for undecorated functions. Session.isIrUpToDate(path, ir) wraps isBinaryModuleUpToDate; its javadoc records that a session keeps the files it has read, so an edit is only seen from a fresh session. Global queries and whole-program code. GlobalSession gains findCapability, isTargetSupported, isPassThroughSupported and downstreamCompilerPath (the 2026.17 replacement for getDownstreamCompilerVersion), with a PassThrough enum; ComponentType.targetCode(target) returns code for every entry point at once. Entry points from getDefinedEntryPoint and findAndCheckEntryPoint are caller-owned, as upstream's detached ComPtrs make them. Tests: CompilerOptionsTest checks each typed option by its effect (debug info in the SPIR-V, NONE vs MAXIMAL code size, warnings failing or vanishing, MSVC bitfield storage in generated HLSL, per-target entries landing on one target only); ModuleLoadingTest and GlobalQueriesTest cover the rest, including that glslang resolves to the payload's library. 64 of 64 pass against the 2026.19 macos-aarch64 payload; javadoc builds warning-free. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Qodana for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2026.1.3
with:
upload-result: trueContact Qodana teamContact us at qodana-support@jetbrains.com
|
Qodana (Declaration has problems in Javadoc references) flagged
Session.loadModule's javadoc: {@link SessionBuilder#fileSystem} without a
signature resolves to the builder's private fileSystem field, which is
inaccessible from Session. Both links now name their method signatures, so
neither depends on how a bare member name resolves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Wraps three groups of Slang API in the higher-level layer for 0.0.11. Until now it covered 14 of Slang's ~80 COM methods and none of its ~160 compiler options.
Compiler options
SessionBuilder:optimization,debugInfo,warningsAsErrors,disableWarnings,languageVersion,capability(name)andbitfieldPacking(Slang 2026.19's MSVC-compatible packing).option(name, value): onSessionBuilderandTargetOptions, takingffi.gen.CompilerOptionNameconstants for everything else.OptimizationLevel,DebugInfoLevel,BitfieldPacking.Module loading and introspection
Session.loadModule(name): resolves through search paths or aSlangFileSystem; loading a name again returns the module already loaded.Module:name(),filePath(),dependencyFiles()(including the sources of imported modules),entryPoints()([shader]functions plus[numthreads]-only compute functions), andentryPoint(name, stage)for undecorated functions.Session.isIrUpToDate(path, ir): whether a cached.slang-moduleis stale. A session keeps files it has read, so edits only show from a fresh session.Global queries and whole-program code
GlobalSession:findCapability,isTargetSupported,isPassThroughSupportedanddownstreamCompilerPath(new in 2026.17), plus aPassThroughenum.ComponentType.targetCode(target): one artifact covering every entry point.Verification
:slang:test64/64 locally against the 2026.19 macos-aarch64 payload, including 21 new tests that check effects rather than calls: debug info in the SPIR-V, code size at each optimization level, warnings failing or silenced, MSVC bitfield storage in the generated HLSL, and per-target options landing on one target only. Javadoc builds without warnings. Qodana couldn't run locally, so this PR's run is the first check with the stricter gate.🤖 Generated with Claude Code