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

Fix ConvertType #24967

Merged
merged 4 commits into from
Nov 16, 2022
Merged

Fix ConvertType #24967

merged 4 commits into from
Nov 16, 2022

Conversation

LeviPesin
Copy link
Contributor

Related issue: #24964 (comment)

Description

I think this should fix it...

@LeviPesin
Copy link
Contributor Author

It seems that actually that bug is two bugs, and this PR fixes only one of them... With this PR WebGPU complains on uvec4( index, index, index, uint( 1 ) ) like so:

1 error(s) generated while compiling the shader:
:32:49 error: no matching initializer for vec4<u32>(vec3<u32>, abstract-float)

10 candidate initializers:
  vec4(xyz: vec3<T>, w: T) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(xy: vec2<T>, zw: vec2<T>) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(x: T, zyw: vec3<T>) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(vec4<T>) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(T) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4<T>() -> vec4<T>  where: T is f32, f16, i32, u32 or bool
  vec4(xy: vec2<T>, z: T, w: T) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(x: T, yz: vec2<T>, w: T) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(x: T, y: T, zw: vec2<T>) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
  vec4(x: T, y: T, z: T, w: T) -> vec4<T>  where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool

5 candidate conversions:
  vec4<T>(vec4<U>) -> vec4<f32>  where: T is f32, U is abstract-int, abstract-float, i32, f16, u32 or bool
  vec4<T>(vec4<U>) -> vec4<f16>  where: T is f16, U is abstract-int, abstract-float, f32, i32, u32 or bool
  vec4<T>(vec4<U>) -> vec4<i32>  where: T is i32, U is abstract-int, abstract-float, f32, f16, u32 or bool
  vec4<T>(vec4<U>) -> vec4<u32>  where: T is u32, U is abstract-int, abstract-float, f32, f16, i32 or bool
  vec4<T>(vec4<U>) -> vec4<bool>  where: T is bool, U is abstract-int, abstract-float, f32, f16, i32 or u32

  NodeBuffer_291.nodeUniform0[ instanceIndex ] = vec4<u32>( vec4<u32>( instanceIndex, instanceIndex, instanceIndex, 1u ).xyz, 1.0 );
                                                 ^^^^

Note there are no vec4<f32> there anymore.

@mrdoob mrdoob requested a review from sunag November 16, 2022 08:51
@LeviPesin
Copy link
Contributor Author

LeviPesin commented Nov 16, 2022

The second bug is very strange - debugging it, it seems that builder.format( 'vec4<u32>( instanceIndex, instanceIndex, instanceIndex, 1u )', 'uvec4', 'vec3' ) and then builder.format( 'vec4<u32>( instanceIndex, instanceIndex, instanceIndex, 1u ).xyz', 'vec3', 'uvec4' ) are called...
This is a bug in my own code 🤦‍♂️. So this fix seems sufficient.

@sunag sunag added this to the r147 milestone Nov 16, 2022
@sunag sunag merged commit 4738e28 into mrdoob:dev Nov 16, 2022
@sunag
Copy link
Collaborator

sunag commented Nov 16, 2022

Thanks! :)

@LeviPesin LeviPesin deleted the patch-2 branch November 17, 2022 03:58
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.

None yet

2 participants