Skip to content

Conversation

@slimbuck
Copy link
Member

This PR brings the wgsl GS chunks inline with glsl.

A separate PR will add the missing SOGS wgsl chunks.

@slimbuck slimbuck requested review from a team and Copilot May 13, 2025 10:07
@slimbuck slimbuck self-assigned this May 13, 2025
@slimbuck slimbuck added area: graphics Graphics related issue enhancement labels May 13, 2025
@slimbuck slimbuck changed the title latest Wgsl GS chunk updates May 13, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the WGSL GS chunks to align with the GLSL implementation, refactoring functions to return values rather than using output pointers and replacing the deprecated quatToMat3 implementations.

  • Refactored fetch functions to return structured data (ScaleAndSH/SH) in gsplatSH.js
  • Updated quaternion-to-matrix conversion usage in gsplatData.js and consolidated a new quatToMat3 in gsplatCommon.js
  • Removed the old quatToMat3 in gsplatCompressedData.js

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatSH.js Introduces new struct types and refactored fetch functions for spherical harmonic coefficients
src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatData.js Updates readCovariance to use a swizzled quaternion from unpackRotation
src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatCompressedData.js Removes the outdated quatToMat3 implementation
src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatCommon.js Adds a new implementation for quatToMat3 using WGSL’s new syntax
Comments suppressed due to low confidence (1)

src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatData.js:24

  • The addition of the .wxyz swizzle on the quaternion from unpackRotation changes the expected component order; please verify that this reordering is intended and consistent with the new quatToMat3 implementation.
let rot: mat3x3f = quatToMat3(unpackRotation(vec3f(unpack2x16float(bitcast<u32>(tAw)), tB.w)).wxyz);

#endif
}
fn quatToMat3(R: vec4<f32>) -> mat3x3<f32> {
Copy link

Copilot AI May 13, 2025

Choose a reason for hiding this comment

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

There are multiple implementations of quatToMat3 across the module; consider consolidating the quaternion-to-matrix conversion into a single shared implementation to avoid inconsistencies.

Copilot uses AI. Check for mistakes.
@slimbuck slimbuck merged commit 255bea9 into playcanvas:main May 13, 2025
7 checks passed
@slimbuck slimbuck deleted the wgsl-dev branch May 13, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants