Skip to content

Transpiler - No Translation of Bitcast Functions #31735

@cmhhelgeson

Description

@cmhhelgeson

Description

This GLSL function...

vec3 hash34(vec4 src) {
  uvec3 h = murmurHash34(floatBitsToUint(src));
  vec3 v = uintBitsToFloat(h & 0x007fffffu | 0x3f800000u) - 1.0;
  return v * 2.0 - 1.0;
}

Is returning this TSL

export const hash34 = /*@__PURE__*/ Fn( ( [ src ] ) => {

	const h = murmurHash34( floatBitsToUint( src ) );
	const v = uintBitsToFloat( h.bitAnd( 0x007fffff ).bitOr( 0x3f800000 ) ).sub( 1.0 );

	return v.mul( 2.0 ).sub( 1.0 );

}, { src: 'vec4', return: 'vec3' } );

Functions using their shader language's equivalents of bitcast functionality should probably be recognized and return as TSL bitcast functions.

Reproduction steps

Copy the provided GLSL code into the TSL Transpiler example on Threejs.org

Code

N/A

Live example

N/A

Screenshots

No response

Version

r179

Device

Desktop

Browser

Chrome

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSLThree.js Shading Language

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions