Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSLNodeBuilder: Remove Int16Array check from getTypeFromAttribute(). #28920

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 19, 2024

Related issue: #28918

Description

Int16Array or gl.SHORT is a float type by default in WebGLRenderer. It is only interpreted as integer input for attributes in the vertex shader if attribute.gpuType is IntType.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.7 kB (169.3 kB) 683.7 kB (169.3 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.9 kB (111.2 kB) 460.9 kB (111.2 kB) +0 B

@@ -476,7 +476,7 @@ ${ flowData.code }

const array = dataAttribute.array;

if ( ( array instanceof Uint32Array || array instanceof Int32Array || array instanceof Int16Array ) === false ) {
if ( ( array instanceof Uint32Array || array instanceof Int32Array ) === false ) {
Copy link
Collaborator Author

@Mugen87 Mugen87 Jul 19, 2024

Choose a reason for hiding this comment

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

@sunag I do not fully understand why getTypeFromAttribute() needs to modify the data type of the attribute in the shader based on the geometry data array type. I think it would be best to generate the correct data type in the shader code right from the beginning.

iuvec* types should only be generated when attribute.gpuType === IntType or when the geometry data array is of type Uint32Array or Int32Array.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok for me, I don't remember exactly when this was done, so you can proceed as you see fit.

@Mugen87 Mugen87 merged commit 5d5eb01 into mrdoob:dev Jul 20, 2024
12 checks passed
@Mugen87 Mugen87 added this to the r167 milestone Jul 20, 2024
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.

2 participants