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

[Merged by Bors] - shader examples wording coherence #4810

Closed

Conversation

Vrixyz
Copy link
Member

@Vrixyz Vrixyz commented May 20, 2022

Objective

I noticed different examples descriptions were not using the same structure:
different_wordings_examples

This results in sentences that a reader has to read differently each time, which might result in information being hard to find, especially foreign language users.

Original discord discussion: https://discord.com/channels/691052431525675048/976846499889705020

Solution

  • Use less different words, similar structure and being straight to the point.

Changelog

  • Examples descriptions more accessible.

@Vrixyz
Copy link
Member Author

Vrixyz commented May 20, 2022

it might be a good opportunity to tackle all examples descriptions and not only "shader" ones, but I'll await feedbacks before doing so.
Also, I'm not a native english speaker.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples labels May 20, 2022
`animate_shader` | [`shader/animate_shader.rs`](./shader/animate_shader.rs) | A shader that uses dynamic data like the time since startup.
`compute_shader_game_of_life` | [`shader/compute_shader_game_of_life.rs`](./shader/compute_shader_game_of_life.rs) | A compute shader that simulates Conway's Game of Life.
`custom_vertex_attribute` | [`shader/custom_vertex_attribute.rs`](./shader/custom_vertex_attribute.rs) | A shader that reads a mesh's custom vertex attribute.
`shader_defs` | [`shader/shader_defs.rs`](./shader/shader_defs.rs) | A shader that uses "shaders defs" (a bevy tool to selectively toggle parts of a shader).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`shader_defs` | [`shader/shader_defs.rs`](./shader/shader_defs.rs) | A shader that uses "shaders defs" (a bevy tool to selectively toggle parts of a shader).
`shader_defs` | [`shader/shader_defs.rs`](./shader/shader_defs.rs) | A shader that uses "shaders defs" to selectively toggle parts of a shader.

This isn't a Bevy-specific concept and we can phrase this more directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

a quick search for "shaders def" gave me very little information on internet, I also remembered bevy having a custom shader preprocessor https://bevyengine.org/news/bevy-0-6/#shader-preprocessor.

While the concept is not from bevy, isn't the implementation specific to bevy ? Even though probably very similar to other implementations, it might surprise readers if not all features are similar ?

I'd love to be wrong here, if there's a specification to "shader_defs", maybe this would benefit giving a link to a reference to that shader_def concept (or link to a shader preprocessor documentation ?)

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, apparently you're right. I think we should really strive to have a useful introduction both here and in the docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the way we do it in bevy is specific to bevy. Wgsl doesn't support that natively.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Small suggestions, then this looks good to me.

@alice-i-cecile
Copy link
Member

@bevyengine/rendering-team, can I get a pithy explanation of what a "shader def" is exactly, so we can improve the descriptions of these examples?

@Vrixyz
Copy link
Member Author

Vrixyz commented May 20, 2022

I should note this discussion: https://discord.com/channels/691052431525675048/743559241461399582/977244773410832384 ; if "first line" in example docs should be the same as or imported to the example readme, we might lose this change PR, so I should update the examples "first line" docs too.

@alice-i-cecile
Copy link
Member

so I should update the examples "first line" docs too.

Yes please!

@superdump
Copy link
Contributor

@bevyengine/rendering-team, can I get a pithy explanation of what a "shader def" is exactly, so we can improve the descriptions of these examples?

A ‘shader def’ is a definition used by a shader. The term ‘definition’ comes from preprocessor languages where source code is processed to apply preprocessor definitions before it is passed to a compiler. In bevy, the currently-supported definitions allow pieces of shader code to be included or not based on whether the shader defs are supplied when the shader code is being preprocessed. This allows you to do things like:

#ifdef SUPPORTS_FEATURE_A
Code for when feature A is supported.
#else
Code for when feature A is not supported.
#endif

Then, in this example, if in rust code you detect that your mesh has some particular vertex attributes or the GPU supports a particular feature, and that is feature ‘A’ then you provide SUPPORTS_FEATURE_A as a shader def and the first piece of code is included in the processed shader code and the second piece is not.

We also use preprocessor directives for handling shader imports - saying ‘insert the code from this other shader file here.’

We will add more functionality as it is needed. I expect another one that will come soon is being able to replace a definition with a value. So in the shader code there may be SOME_CONSTANT and from rust we would be able to provide a HashMap<String, String> to the preprocessor that contains a mapping from that string to format!(“{}”, 123.456) or so.

@Vrixyz
Copy link
Member Author

Vrixyz commented May 22, 2022

Thanks @superdump ; we might want to add that kind of description into https://docs.rs/bevy/latest/bevy/render/render_resource/struct.VertexState.html ? and link to there from the example ?

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

bors r+

bors bot pushed a commit that referenced this pull request May 30, 2022
# Objective

I noticed different examples descriptions were not using the same structure:
![different_wordings_examples](https://user-images.githubusercontent.com/2290685/169487055-ab76743e-3400-486f-b672-e8f60455b8e4.png)

This results in sentences that a reader has to read differently each time, which might result in information being hard to find, especially foreign language users.

Original discord discussion: https://discord.com/channels/691052431525675048/976846499889705020

## Solution

- Use less different words, similar structure and being straight to the point.

---

## Changelog

- Examples descriptions more accessible.
@bors bors bot changed the title shader examples wording coherence [Merged by Bors] - shader examples wording coherence May 30, 2022
@bors bors bot closed this May 30, 2022
james7132 pushed a commit to james7132/bevy that referenced this pull request Jun 7, 2022
# Objective

I noticed different examples descriptions were not using the same structure:
![different_wordings_examples](https://user-images.githubusercontent.com/2290685/169487055-ab76743e-3400-486f-b672-e8f60455b8e4.png)

This results in sentences that a reader has to read differently each time, which might result in information being hard to find, especially foreign language users.

Original discord discussion: https://discord.com/channels/691052431525675048/976846499889705020

## Solution

- Use less different words, similar structure and being straight to the point.

---

## Changelog

- Examples descriptions more accessible.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

I noticed different examples descriptions were not using the same structure:
![different_wordings_examples](https://user-images.githubusercontent.com/2290685/169487055-ab76743e-3400-486f-b672-e8f60455b8e4.png)

This results in sentences that a reader has to read differently each time, which might result in information being hard to find, especially foreign language users.

Original discord discussion: https://discord.com/channels/691052431525675048/976846499889705020

## Solution

- Use less different words, similar structure and being straight to the point.

---

## Changelog

- Examples descriptions more accessible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants