Skip to content

Introduce VRMKitRuntime#43

Merged
tattn merged 2 commits intomainfrom
feature/vrmkitruntime
Feb 3, 2026
Merged

Introduce VRMKitRuntime#43
tattn merged 2 commits intomainfrom
feature/vrmkitruntime

Conversation

@tattn
Copy link
Owner

@tattn tattn commented Feb 3, 2026

This pull request introduces a new VRMKitRuntime target to centralize and share runtime types and utility extensions across both the RealityKit and SceneKit implementations. The main focus is on deduplicating common code such as blend shape types, SIMD extensions, and Unity transform helpers, which are now moved from the individual frameworks into the new runtime module. This change simplifies maintenance and improves consistency across the codebase.

Key changes include:

Runtime module introduction and dependency updates

  • Added a new VRMKitRuntime target, moved shared types and extensions into it, and updated VRMRealityKit and VRMSceneKit targets to depend on VRMKitRuntime. Updated Package.swift accordingly.

Deduplication and centralization of core types and extensions

  • Moved BlendShapeKey and BlendShapePreset enums, SIMD math extensions, and Unity transform helpers into Sources/VRMKitRuntime from both RealityKit and SceneKit implementations. Removed their previous definitions from Sources/VRMRealityKit/CustomType/BlendShape.swift, Sources/VRMSceneKit/CustomType/BlendShape.swift, and related extension files. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Refactoring and code cleanup

  • Updated all relevant files in both RealityKit and SceneKit implementations to import and use types and extensions from VRMKitRuntime instead of their local copies. This includes BlendShapeKey, BlendShapePreset, SIMD extensions, and Unity transform helpers. [1] [2] [3] [4] [5] [6] [7] [8] [9]

GLTF protocol and extension adjustments

  • Moved the GLTFTextureInfoProtocol protocol and its extensions to the runtime module and updated access control. Removed the duplicate protocol from SceneKit. [1] [2]

Example app update

  • Updated the example app (RealityKitViewController.swift) to use the new shared Expression type instead of the local RKExpression enum, and removed the now-unnecessary local enum definition. [1] [2] [3] [4]

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @tattn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the project's architecture by introducing a dedicated VRMKitRuntime module. This new module serves as a shared foundation for core VRM-related functionalities, centralizing common types and extensions that were previously scattered across the VRMRealityKit and VRMSceneKit modules. The change improves modularity, reduces code duplication, and simplifies maintenance by establishing a single source of truth for these runtime components.

Highlights

  • New VRMKitRuntime Module: A new Swift module, VRMKitRuntime, has been introduced to centralize common types, protocols, and extensions previously duplicated across VRMRealityKit and VRMSceneKit.
  • Code Centralization: Key definitions such as BlendShapeKey, BlendShapePreset, UnityTransformCompatible, UnityTransform, and various SIMD extensions have been moved into VRMKitRuntime.
  • Dependency Updates: Both VRMRealityKit and VRMSceneKit have been updated to depend on and import the new VRMKitRuntime module, removing their internal, duplicated implementations of these shared components.
  • File Renames and Deletions: Several files were renamed or deleted as their contents were migrated to the new VRMKitRuntime module, streamlining the project structure.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Package.swift
    • Added 'VRMKitRuntime' as a new product target with a dependency on 'VRMKit'.
    • Updated 'VRMSceneKit' and 'VRMRealityKit' targets to include 'VRMKitRuntime' as a dependency.
  • Sources/VRMKitRuntime/BlendShapeTypes.swift
    • New file: Defines 'BlendShapeKey' and 'BlendShapePreset' enums, previously located in 'VRMRealityKit' and 'VRMSceneKit'.
  • Sources/VRMKitRuntime/GLTF+Runtime.swift
    • New file: Renamed from 'Sources/VRMRealityKit/Extensions/GLTF+.swift', now part of 'VRMKitRuntime'.
  • Sources/VRMKitRuntime/SIMD+Runtime.swift
    • New file: Contains extensions for 'SIMD3' and 'simd_quatf', and global SIMD-related functions, previously in 'VRMRealityKit' and 'VRMSceneKit'.
  • Sources/VRMKitRuntime/UnityTransform.swift
    • New file: Defines 'UnityTransformCompatible' protocol and 'UnityTransform' class, previously in 'VRMRealityKit' and 'VRMSceneKit'.
  • Sources/VRMRealityKit/CustomType/BlendShape.swift
    • Removed local definitions of 'BlendShapeKey' and 'BlendShapePreset'.
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMRealityKit/CustomType/VRMEntity.swift
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMRealityKit/CustomType/VRMEntitySpringBone.swift
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMRealityKit/Extensions/Entity+UnityTransform.swift
    • Removed local definitions of 'UnityTransformCompatible' and 'UnityTransform'.
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMRealityKit/Extensions/Simd+.swift
    • Removed extensions for 'SIMD3' and 'simd_quatf', and global SIMD-related functions.
  • Sources/VRMRealityKit/RuntimeExports.swift
    • New file: Exports 'VRMKitRuntime' for convenience.
  • Sources/VRMSceneKit/CustomType/BlendShape.swift
    • Removed local definitions of 'BlendShapeKey' and 'BlendShapePreset'.
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMSceneKit/CustomType/VRMNode.swift
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMSceneKit/CustomType/VRMSpringBone.swift
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMSceneKit/Extensions/GLTF+.swift
    • Removed file: Content moved to 'VRMKitRuntime/GLTF+Runtime.swift'.
  • Sources/VRMSceneKit/Extensions/SCNNode+UnityTransform.swift
    • Removed local definitions of 'UnityTransformCompatible' and 'UnityTransform'.
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMSceneKit/Extensions/simd+.swift
    • Removed extensions for 'SIMD3' and 'simd_quatf', and global SIMD-related functions.
  • Sources/VRMSceneKit/GLTF2SCN/SCNMaterialProperty+GLTF.swift
    • Added import for 'VRMKitRuntime'.
  • Sources/VRMSceneKit/RuntimeExports.swift
    • New file: Exports 'VRMKitRuntime' for convenience.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new VRMKitRuntime module to centralize common types, protocols, and extensions from VRMRealityKit and VRMSceneKit, aiming to improve code reuse and maintainability. While this refactoring is a positive architectural improvement, several critical security vulnerabilities were identified. Specifically, mathematical operations on SIMD vectors (normalization and cross products) lack proper input validation, which can result in NaN propagation and lead to crashes in rendering or physics engines. Furthermore, the loader is missing explicit bounds checks when accessing GLTF data structures, making it susceptible to runtime traps and Denial of Service when processing malformed VRM files.

@tattn tattn marked this pull request as ready for review February 3, 2026 14:46
@tattn tattn merged commit 207d36f into main Feb 3, 2026
5 checks passed
@tattn tattn deleted the feature/vrmkitruntime branch February 3, 2026 14:57
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