Skip to content

Structs passed by value through tsbindgen, not gen_nvrhi_classes.py's table - #86

Merged
ASDAlexander77 merged 3 commits into
mainfrom
nvrhi-records-by-value
Oct 14, 2026
Merged

ASDAlexander77 merged 3 commits into
mainfrom
nvrhi-records-by-value

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

tslang pre-alpha102 (ASDAlexander77/TypeScriptCompiler#578) passes a @cpp method's struct by value as each C++ ABI does (MSVC x64, SysV x86-64, AAPCS64) and reads small structs back from registers. Its tsbindgen now binds such methods instead of skipping them. So:

  • tools/gen_nvrhi_classes.py loses BY_VALUE. That table held hand-written declarations and wrapper functions, one per ABI, for the 11 methods tsbindgen used to skip: clearTextureFloat, clearDepthStencilTexture, clearTextureUInt, beginTrackingTextureState, setTextureState, getNativeView, createHandleForNativeTexture, createHandleForNativeBuffer, createSamplerFeedbackForNativeTexture, queryCoopVecMatMulFormatSupport, queryCoopVecTrainingFormatSupport. The generator now stops if an older tsbindgen leaves one of them out.
  • core/nvrhi_classes.<os>.ts declare them as tsbindgen writes them. TextureSubresourceSet, nvrhi::Object and std::optional are tuples; the coop vec results are records.
  • core/nvrhi.ts has the nvrhi.* functions callers use, written once for both ABIs.
  • TSLANG_VERSION is bumped to v0.0-pre-alpha102, which these declarations need. The version mentions in the README and the generator now name it.

Verification

  • The classes regenerated with the released pre-alpha102 tsbindgen are identical to the committed ones.
  • Windows with pre-alpha102: full build, CTest 61/61, including nvrhi_direct and headless on dx12 and vk with -debug.
  • Android emulator (api34 x86_64 AVD) with pre-alpha102: headless and nvrhi_direct pass on x86_64, and on arm64 through the emulator's ARM translation. That covers the SysV and AAPCS64 by-value calls.

🤖 Generated with Claude Code

ASDAlexander77 and others added 3 commits October 14, 2026 17:57
…s.py's table

tslang now passes a @cpp method's record by value as each C++ ABI does,
and reads small records back from registers, and its tsbindgen binds
such methods instead of skipping them (TypeScriptCompiler
cpp-records-by-value; needs a tslang newer than pre-alpha101). So:
- tools/gen_nvrhi_classes.py loses BY_VALUE, the hand-written
  declarations and functions of the 11 methods tsbindgen skipped
  (clearTextureFloat, clearDepthStencilTexture, clearTextureUInt,
  beginTrackingTextureState, setTextureState, getNativeView,
  createHandleForNativeTexture, createHandleForNativeBuffer,
  createSamplerFeedbackForNativeTexture, queryCoopVecMatMulFormatSupport,
  queryCoopVecTrainingFormatSupport), each one per ABI; it stops if an
  older tsbindgen leaves one out;
- core/nvrhi_classes.<os>.ts declare them as tsbindgen writes them: the
  TextureSubresourceSet, nvrhi::Object and std::optional<ComponentMapping>
  as tuples, the coop vec results as records;
- core/nvrhi.ts has the nvrhi.* functions callers use, once for both ABIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t has it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 50586a7 into main Oct 14, 2026
@ASDAlexander77
ASDAlexander77 deleted the nvrhi-records-by-value branch October 14, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant