All checks were successful
Build / build (push) Successful in 1m42s
Create a parallel WebGPU XR path that uses XRGPUBinding and XRProjectionLayer instead of the WebGL-only XRWebGLLayer, while preserving the existing WebGL XR path as the default fallback. New files in src/core/xr-webgpu/: - xrGpuTypes.ts: TypeScript declarations for XRGPUBinding spec types - xrGpuSessionSetup.ts: GPUDevice access and session init helpers - xrGpuTextureProvider.ts: Per-frame GPUTexture swap via hwTex.set() - xrGpuLayerWrapper.ts: WebXRLayerWrapper subclass for projection layers - xrGpuRenderTarget.ts: WebXRRenderTarget using XRGPUBinding - xrGpuEntryPoint.ts: Public API for availability check and creation Modified xrEntryHandler.ts to conditionally route through WebGPU or WebGL XR entry based on XRGPUBinding availability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
/**
|
|
* WebXRLayerWrapper subclass for XRProjectionLayer created via XRGPUBinding.
|
|
*/
|
|
import { WebGPUEngine } from "@babylonjs/core";
|
|
import { WebXRLayerWrapper } from "@babylonjs/core/XR/webXRLayerWrapper";
|
|
import type { Scene } from "@babylonjs/core";
|
|
import { XRGPUTextureProvider } from "./xrGpuTextureProvider";
|
|
import type { XRGPUBinding } from "./xrGpuTypes";
|
|
|
|
export class XRGPUProjectionLayerWrapper extends WebXRLayerWrapper {
|
|
constructor(
|
|
public override readonly layer: XRProjectionLayer,
|
|
private readonly _gpuBinding: XRGPUBinding,
|
|
private readonly _gpuEngine: WebGPUEngine,
|
|
private readonly _scene: Scene
|
|
) {
|
|
super(
|
|
() => layer.textureWidth,
|
|
() => layer.textureHeight,
|
|
layer,
|
|
"XRProjectionLayer",
|
|
(sessionManager) =>
|
|
new XRGPUTextureProvider(
|
|
sessionManager.scene,
|
|
this,
|
|
_gpuBinding,
|
|
layer,
|
|
_gpuEngine
|
|
)
|
|
);
|
|
}
|
|
}
|