Skip to content

tsl transpiler not working with vec2[4] name{..} #30858

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

Open
Makio64 opened this issue Apr 4, 2025 · 2 comments
Open

tsl transpiler not working with vec2[4] name{..} #30858

Makio64 opened this issue Apr 4, 2025 · 2 comments
Labels
Enhancement TSL Three.js Shading Language

Comments

@Makio64
Copy link
Contributor

Makio64 commented Apr 4, 2025

Description

simplified example :

vec2[4] marching_square(vec2 uv, float level)
{
    vec2 edge[4] = vec2[](vec2(-50.), vec2(-50.),vec2(-50.), vec2(-50.));
    return edge;
}

result


import { vec2 } from 'three/tsl';

const [ = vec2().toVar(), float = vec2().toVar();

Reproduction steps

test the code above in https://threejs.org/examples/?q=tsl#webgpu_tsl_transpiler

Code

X

Live example

X

Screenshots

X

Version

r175

Device

No response

Browser

No response

OS

No response

@Makio64
Copy link
Contributor Author

Makio64 commented Apr 7, 2025

it also doesnt work as a parameters out

void marching_square(vec2 edge[4])
{
    edge[0] = vec2(-50.);
    edge[1] = vec2(-50.);
    edge[2] = vec2(-50.);
    edge[3] = vec2(-50.);
}

result in Error: Expected ","

@Makio64
Copy link
Contributor Author

Makio64 commented Apr 11, 2025

also not supporting :

const vec4 edge_table[16] = vec4[](
   vec4(-1,-1,-1,-1),
   vec4(3,0,-1,-1),
   vec4(0,1,-1,-1),
   vec4(1,3,-1,-1),
   
   vec4(1,2,-1,-1),
   vec4(0,1,2,3),
   vec4(0,2,-1,-1),
   vec4(2,3,-1,-1),
   
   vec4(2,3,-1,-1),
   vec4(0,2,-1,-1),
   vec4(0,3,1,2),
   vec4(1,2,-1,-1),
   
   vec4(1,3,-1,-1),
   vec4(0,1,-1,-1),
   vec4(3,0,-1,-1),
   vec4(-1,-1,-1,-1)
);

transpiling to :

const edge_table = vec4().toConst()

@sunag just cross this problems on another shaders i'm porting. Is TSL supporting array of vec4 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement TSL Three.js Shading Language
Projects
None yet
Development

No branches or pull requests

2 participants