Skip to content

fix(timeline): resolve shader asset paths relative to baseUrl and cache WebGL assets - #929

Merged
kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-vnyymqxskowk
Aug 31, 2026
Merged

kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-vnyymqxskowk

Conversation

@kyasbal

@kyasbal kyasbal commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes shader asset path resolution when KHI is served under a subpath / custom baseUrl (with <base href="...">). Removed the leading / insertion in WebGLUtil.getShaderString so relative paths resolve against document.baseURI.
  • Adds in-memory caching in WebGLUtil for shaders (shaderCache), BMFont configuration JSON (bmFontConfigCache), and images (imageCache) to avoid duplicate fetch requests and redundant allocations.
  • Adds WebGLUtil.clearCache() to clear all WebGL asset caches.
  • Adds unit tests in glutil.spec.ts verifying path resolution with custom <base href>, caching deduplication, error handling/retry, and SharedTmpBuffer memory behavior.

Test Plan

  • Run make test-web (verified 1088/1088 tests passing).
  • Run make lint-web and make build-storybook.
  • Run make pre-commit.

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

Copy link
Copy Markdown
Contributor

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 caching mechanisms for BMFont configurations, images, and shader strings in WebGLUtil to optimize asset loading, and adds a new clearCache method. It also includes a comprehensive test suite in glutil.spec.ts to verify the caching and utility behaviors. The feedback suggests using an absolute import path in the test file instead of a relative one to align with project standards.

@kyasbal kyasbal added the type:bug Something isn't working as expected label Aug 31, 2026
@kyasbal
kyasbal merged commit 4cfd277 into GoogleCloudPlatform:main Aug 31, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-vnyymqxskowk branch August 31, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something isn't working as expected

1 participant