Skip to content

Proc macro for running picasso and include!ing the compiled shader #22

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

Merged
merged 5 commits into from
Sep 26, 2023

Conversation

ian-h-chamberlain
Copy link
Member

#2

@adryzz This is what I was thinking about in my comments on that issue. As far as I can tell it works correctly, with perhaps the exception that I haven't tried publishing it to https://crates.io.

My guess is that rewriting picasso in rust will probably take a bit, so maybe we could just use this in the meantime as a stopgap until the full "librarified" proc macro is available? In any case, users of citro3d could use whichever they prefer.

Open to suggestions on naming. pica200 seems to be available on https://crates.io but maybe is a little too general, not sure...

@ian-h-chamberlain ian-h-chamberlain requested review from a team, AzureMarker and Meziu August 5, 2023 17:48
@adryzz
Copy link

adryzz commented Aug 5, 2023

yeah this works, i guess, even if the filesystem access is not ideal.

also beware that there may be two shaders with the same name

i used syn instead of manually parsing but yeah

as for the picasso port... I'll do my best, although converting accurately idiomatic C++ to idiomatic Rust isn't super simple.

Its data types are all over the place as well.

as for naming, i liked picard and reserved it on crates.io already, but yeah anything works, i guess... also because we don't need any "outside recognition", as all the users of this macro are rust3ds users anyway...

Export as pub mod macros, add tests, and refactor error handling a bit
to make the logic simpler.
Use map_err everywhere to add context / file paths when possible. Also
add some basic compile_fail doctests for missing / bad syntax shader
sources.
Base automatically changed from fix/gfx-updates-3d-example to main September 23, 2023 18:06
@ian-h-chamberlain
Copy link
Member Author

I decided to call this citro3d-macros, following the example of https://lib.rs/crates/bevy_ecs_macros and allowing for possible future general proc-macros unrelated to shaders specifically.

I'm not necessarily expecting too much feedback here, but I think I'll plan to merge this after a bit if there isn't any major objection to this API. Having a proper assembler like discussed above would be nice, but this works for now and seems to me a cleaner user experience than the build scripts we had before.

@ian-h-chamberlain ian-h-chamberlain marked this pull request as ready for review September 23, 2023 18:10
@ian-h-chamberlain ian-h-chamberlain changed the title Proof of concept for proc-macro running picasso Proc macro for running picasso and include!ing the compiled shader Sep 23, 2023
@ian-h-chamberlain ian-h-chamberlain changed the title Proc macro for running picasso and include!ing the compiled shader Proc macro for running picasso and include!ing the compiled shader Sep 23, 2023
@adryzz
Copy link

adryzz commented Sep 25, 2023

yeah, i've kinda paused development, been a bit busy with irl stuff and uni, but i do plan to finish what i started

@ian-h-chamberlain ian-h-chamberlain merged commit ff380cf into main Sep 26, 2023
@ian-h-chamberlain ian-h-chamberlain deleted the feature/pica200-proc-macro branch September 26, 2023 02:09
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