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

Migrate the repository to a virtual workspace. #590

Merged
merged 14 commits into from
Jun 3, 2024

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented May 30, 2024

The CI, VSCode config, ARCHITECTURE.md and some README.md links have been updated to reflect the new directory structure.

The WGSL shaders now live in the vello_shaders subdirectory. Vello hot reloading depends on our repo structure, which is fine as decided at last office hours due to this being a development feature.

The examples continue to live in a root examples directory, as that is how it remained for Parley as well. I did this for consistency and don't really feel strongly either way if people think we should move them under vello/examples instead. If we had examples without Cargo.toml that would make more sense, but we don't, so ..

The repo README.md and the vello sub-directory README.md are exact clones and both need updating. That is intentionally planned as follow-up work to reduce the review friction here.

@xStrom xStrom marked this pull request as ready for review May 30, 2024 15:05
@xStrom xStrom added this to the Vello 0.2 release milestone May 30, 2024
@@ -62,7 +62,7 @@ pub fn full_shaders(
#[cfg(feature = "hot_reload")]
let mut shaders = vello_shaders::compile::ShaderInfo::from_dir(concat!(
Copy link
Member

@DJMcNab DJMcNab May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can vello_shaders instead export the path to directory the shaders are located in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean the shader directory name, or some more absolute path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I added a new function that returns an absolute path to the shader directory. It depends on using Cargo and the path is computed at compile time.

If someone has a build cache and then moves the directories around, they will need to cargo clean or trigger a rebuild in another way.

/// The path is determined at compile time.
pub fn shader_dir() -> &'static PathBuf {
static SHADER_DIR: OnceLock<PathBuf> = OnceLock::new();
SHADER_DIR.get_or_init(|| Path::new(env!("CARGO_MANIFEST_DIR")).join("shader"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we used concat!, I don't think the runtime string manipulation would be needed.

I guess this is about using the proper separator?

Copy link
Member Author

@xStrom xStrom May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just using concat! is buggy because we don't know if CARGO_MANIFEST_DIR ends with a separator or not. Instead of doing some sort of .ends_with dance and potentially missing some other edge cases, better to use the path module.

Also, this is a singleton. The performance overhead here is trivial.


/// Returns the absolute path to the directory containing the WGSL shaders.
///
/// The path is determined at compile time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And may be invalid at runtime, especially if the program is deployed on a different machine

As a different point:
This is also a reproducible builds challenge, which I guess we should document?
Idk, maybe even making it doc(hidden)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added a note about the impact on reproducible builds.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will give a final check on Monday if this hasn't landed by then


It is used as the rendering backend for [Xilem], a Rust GUI toolkit.

> [!WARNING]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change the formatting of this now, to use something which renders well on crates.io

That might just be using the ⚠️ emoji

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating readme files is intentionally out of scope and planned as follow-up work to reduce the review friction here.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this done. A few small nits, I don't think any are necessarily blocking

vello/LICENSE-APACHE Outdated Show resolved Hide resolved
README.md Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add a big comment at the top that this is "temporarily" duplicated in the vello folder, and updates should be preferred there.


at your option.

In addition, all files in the [`vello_shaders/shader`](https://github.com/linebender/vello/tree/main/vello_shaders/shader) and [`vello_shaders/src/cpu`](https://github.com/linebender/vello/tree/main/vello_shaders/src/cpu)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These additional caveats are not important true for vello itself. I imagine this has the same reasoning as above though?

vello_shaders/src/compile/mod.rs Show resolved Hide resolved
vello_shaders/src/compile/mod.rs Outdated Show resolved Hide resolved
@xStrom xStrom added this pull request to the merge queue Jun 3, 2024
Merged via the queue into linebender:main with commit d2bd951 Jun 3, 2024
16 checks passed
@xStrom xStrom deleted the newstructure branch June 3, 2024 12:51
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