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

expression must not be a pointer error with RadialAccelModifier #275

Closed
jiftoo opened this issue Feb 14, 2024 · 1 comment · Fixed by #277
Closed

expression must not be a pointer error with RadialAccelModifier #275

jiftoo opened this issue Feb 14, 2024 · 1 comment · Fixed by #277
Labels
A - modifiers Change related to modifiers C - bug Something isn't working

Comments

@jiftoo
Copy link

jiftoo commented Feb 14, 2024

Hello!

I've been playing around with complex particle systems and noticed that I can't use any custom attributes with RadialAccelModifier.

Here's an example:

RadialAccelModifier::new(
	writer.lit(Vec3::ZERO).expr(),
	(writer.lit(-1000.0) * writer.attr(Attribute::AGE)).expr(),
)

// add it to EffectAsset later

And here's the shader error I get:

2024-02-14T18:38:38.292587Z ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: the value accessed by a `.member` expression must not be a pointer
    ┌─ hanabi/emit:burst_9174278904343164398.wgsl:138:52
    │
138 │     (*particle).velocity += radial * (((-1000.) * (particle.age)) * sim_params.delta_time);
    │                                                    ^^^^^^^^ expression is a pointer
    │
    = the value accessed by a `.member` expression must not be a pointer

Is this a limitation of some sort? I quickly tested non-radial AccelModifier and didn't seem to get any errors.

Thank you!

@djeedai djeedai added C - bug Something isn't working A - modifiers Change related to modifiers labels Feb 15, 2024
@djeedai
Copy link
Owner

djeedai commented Feb 15, 2024

It's a bug, thanks for flagging, should be easy to fix a priori.

djeedai added a commit that referenced this issue Feb 16, 2024
Ensure that the generated code within a function, which generally
accesses the particle attribute struct via a pointer, is emitted with a
pointer indirection.

This is a partial fix, as `make_fn()` could be called with a non-pointer
attribute struct, which would break with the reverse error. However for
now it's only called in the update context with a pointer.

Fixes #275
djeedai added a commit that referenced this issue Feb 16, 2024
Ensure that the generated code within a function, which generally
accesses the particle attribute struct via a pointer, is emitted with a
pointer indirection.

This is a partial fix, as `make_fn()` could be called with a non-pointer
attribute struct, which would break with the reverse error. However for
now it's only called in the update context with a pointer.

Fixes #275
djeedai added a commit that referenced this issue Feb 16, 2024
Ensure that the generated code within a function, which generally
accesses the particle attribute struct via a pointer, is emitted with a
pointer indirection.

This is a partial fix, as `make_fn()` could be called with a non-pointer
attribute struct, which would break with the reverse error. However for
now it's only called in the update context with a pointer.

Fixes #275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A - modifiers Change related to modifiers C - bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants