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] - Documenting BufferVec. #4673

Closed
wants to merge 6 commits into from
Closed

[Merged by Bors] - Documenting BufferVec. #4673

wants to merge 6 commits into from

Conversation

bzm3r
Copy link
Contributor

@bzm3r bzm3r commented May 6, 2022

Objective

Documents the BufferVec render resource.

BufferVec is a fairly low level object, that will likely be managed by a higher level API (e.g. through encase) in the future. For now, since it is still used by some simple
example crates (e.g. bevy-vertex-pulling), it will be helpful
to provide some simple documentation on what BufferVec does.

Solution

I looked through Discord discussion on BufferVec, and found a comment by @superdump to be particularly helpful, in the general discussion around encase.

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to reserve), and when data writes from host to device are scheduled (using write_buffer calls).


Changelog

  • Added doc string for BufferVec and two of its methods: reserve and write_buffer.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label May 6, 2022
@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels May 6, 2022
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.

Excellent, these are looking good. Ping @bevyengine/rendering-team for a second review.

@bzm3r
Copy link
Contributor Author

bzm3r commented Jun 10, 2022

@superdump Could you give this a second review? (not able to ping the bevy rendering-team)

Copy link
Contributor

@superdump superdump 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 contributing some much-needed clarification! I've tweaked a few bits.

crates/bevy_render/src/render_resource/buffer_vec.rs Outdated Show resolved Hide resolved
/// for the [`RenderDevice`](crate::renderer::RenderDevice).
///
/// "Properly formatted" means data that is [`#[repr(C)]`](https://doc.rust-lang.org/reference/type-layout.html#the-c-representation), [`Pod`]
/// and `Zeroable`. Unlike the [`DynamicUniformVec`](crate::render_resource::DynamicUniformVec),
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that since we now use encase, the helper types were renamed to UniformBuffer, DynamicUniformBuffer, StorageBuffer, and DynamicStorageBuffer. I think I have made the necessary changes in the suggestion below.

crates/bevy_render/src/render_resource/buffer_vec.rs Outdated Show resolved Hide resolved
/// If a [`Buffer`](crate::render_resource::Buffer) exists, but is too small, references to it will be discarded,
/// and a new [`Buffer`](crate::render_resource::Buffer) will be created. Any previously created [`Buffer`](crate::render_resource::Buffer)s
/// that are no longer referenced will be deleted by the [`RenderDevice`](crate::renderer::RenderDevice)
/// once it is done using them (typically 1-2 frames).
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice attention to detail!

crates/bevy_render/src/render_resource/buffer_vec.rs Outdated Show resolved Hide resolved
bzm3r and others added 3 commits June 21, 2022 09:33
Co-authored-by: Robert Swain <robert.swain@gmail.com>
…w being merged.

Co-authored-by: Robert Swain <robert.swain@gmail.com>
…ce memory"

Co-authored-by: Robert Swain <robert.swain@gmail.com>
@bzm3r
Copy link
Contributor Author

bzm3r commented Jun 21, 2022

@superdump Thanks for the review! (and for including commit suggestions instead of just comments :D that made it much easier to integrate the changes!)

Copy link
Contributor

@superdump superdump left a comment

Choose a reason for hiding this comment

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

With this minor mistake, LGTM.

crates/bevy_render/src/render_resource/buffer_vec.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jun 21, 2022
Co-authored-by: Robert Swain <robert.swain@gmail.com>
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Jun 21, 2022
# Objective

Documents the `BufferVec` render resource.

`BufferVec` is a fairly low level object, that will likely be managed by a higher level API (e.g. through [`encase`](#4272)) in the future. For now, since it is still used by some simple 
example crates (e.g. [bevy-vertex-pulling](https://github.com/superdump/bevy-vertex-pulling)), it will be helpful
to provide some simple documentation on what `BufferVec` does.  

## Solution

I looked through Discord discussion on `BufferVec`, and found [a comment](https://discord.com/channels/691052431525675048/953222550568173580/956596218857918464 ) by @superdump to be particularly helpful, in the general discussion around `encase`. 

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to `reserve`), and when data writes from host to device are scheduled (using `write_buffer` calls). 

---

## Changelog

- Added doc string for `BufferVec` and two of its methods: `reserve` and `write_buffer`. 


Co-authored-by: Brian Merchant <bhmerchant@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jun 21, 2022

Build failed:

@alice-i-cecile
Copy link
Member

@bzm3r can you please format this? I'd like to merge it :)

/// so this helper type is a good choice for them. Uniform buffers must adhere to std140
/// alignment/padding requirements, and storage buffers to std430. There are helper types for such
/// buffers:
/// - Uniform buffers
Copy link
Member

@james7132 james7132 Jun 27, 2022

Choose a reason for hiding this comment

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

One small usability nit: Please update these other types' docs to point back to this more detailed one.

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean? Over at UniformBuffer add a link to here? Or you mean for each of the helpers, link to the others?

I definitely think we should have some bevy book docs for how to get data into your shader, and how to decide which way is appropriate for your needs.

Copy link
Member

Choose a reason for hiding this comment

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

Over at UniformBuffer add a link to here?

This was my understanding, and what I would like to see.

@alice-i-cecile
Copy link
Member

We're going to document the StorageBuffer and UniformBuffer in their own PRs, so will merge this as is.

bors r+

bors bot pushed a commit that referenced this pull request Jun 28, 2022
# Objective

Documents the `BufferVec` render resource.

`BufferVec` is a fairly low level object, that will likely be managed by a higher level API (e.g. through [`encase`](#4272)) in the future. For now, since it is still used by some simple 
example crates (e.g. [bevy-vertex-pulling](https://github.com/superdump/bevy-vertex-pulling)), it will be helpful
to provide some simple documentation on what `BufferVec` does.  

## Solution

I looked through Discord discussion on `BufferVec`, and found [a comment](https://discord.com/channels/691052431525675048/953222550568173580/956596218857918464 ) by @superdump to be particularly helpful, in the general discussion around `encase`. 

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to `reserve`), and when data writes from host to device are scheduled (using `write_buffer` calls). 

---

## Changelog

- Added doc string for `BufferVec` and two of its methods: `reserve` and `write_buffer`. 


Co-authored-by: Brian Merchant <bhmerchant@gmail.com>
@bors bors bot changed the title Documenting BufferVec. [Merged by Bors] - Documenting BufferVec. Jun 28, 2022
@bors bors bot closed this Jun 28, 2022
james7132 pushed a commit to james7132/bevy that referenced this pull request Jul 2, 2022
# Objective

Documents the `BufferVec` render resource.

`BufferVec` is a fairly low level object, that will likely be managed by a higher level API (e.g. through [`encase`](bevyengine#4272)) in the future. For now, since it is still used by some simple 
example crates (e.g. [bevy-vertex-pulling](https://github.com/superdump/bevy-vertex-pulling)), it will be helpful
to provide some simple documentation on what `BufferVec` does.  

## Solution

I looked through Discord discussion on `BufferVec`, and found [a comment](https://discord.com/channels/691052431525675048/953222550568173580/956596218857918464 ) by @superdump to be particularly helpful, in the general discussion around `encase`. 

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to `reserve`), and when data writes from host to device are scheduled (using `write_buffer` calls). 

---

## Changelog

- Added doc string for `BufferVec` and two of its methods: `reserve` and `write_buffer`. 


Co-authored-by: Brian Merchant <bhmerchant@gmail.com>
inodentry pushed a commit to IyesGames/bevy that referenced this pull request Aug 8, 2022
# Objective

Documents the `BufferVec` render resource.

`BufferVec` is a fairly low level object, that will likely be managed by a higher level API (e.g. through [`encase`](bevyengine#4272)) in the future. For now, since it is still used by some simple 
example crates (e.g. [bevy-vertex-pulling](https://github.com/superdump/bevy-vertex-pulling)), it will be helpful
to provide some simple documentation on what `BufferVec` does.  

## Solution

I looked through Discord discussion on `BufferVec`, and found [a comment](https://discord.com/channels/691052431525675048/953222550568173580/956596218857918464 ) by @superdump to be particularly helpful, in the general discussion around `encase`. 

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to `reserve`), and when data writes from host to device are scheduled (using `write_buffer` calls). 

---

## Changelog

- Added doc string for `BufferVec` and two of its methods: `reserve` and `write_buffer`. 


Co-authored-by: Brian Merchant <bhmerchant@gmail.com>
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

Documents the `BufferVec` render resource.

`BufferVec` is a fairly low level object, that will likely be managed by a higher level API (e.g. through [`encase`](bevyengine#4272)) in the future. For now, since it is still used by some simple 
example crates (e.g. [bevy-vertex-pulling](https://github.com/superdump/bevy-vertex-pulling)), it will be helpful
to provide some simple documentation on what `BufferVec` does.  

## Solution

I looked through Discord discussion on `BufferVec`, and found [a comment](https://discord.com/channels/691052431525675048/953222550568173580/956596218857918464 ) by @superdump to be particularly helpful, in the general discussion around `encase`. 

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to `reserve`), and when data writes from host to device are scheduled (using `write_buffer` calls). 

---

## Changelog

- Added doc string for `BufferVec` and two of its methods: `reserve` and `write_buffer`. 


Co-authored-by: Brian Merchant <bhmerchant@gmail.com>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

Documents the `BufferVec` render resource.

`BufferVec` is a fairly low level object, that will likely be managed by a higher level API (e.g. through [`encase`](bevyengine#4272)) in the future. For now, since it is still used by some simple 
example crates (e.g. [bevy-vertex-pulling](https://github.com/superdump/bevy-vertex-pulling)), it will be helpful
to provide some simple documentation on what `BufferVec` does.  

## Solution

I looked through Discord discussion on `BufferVec`, and found [a comment](https://discord.com/channels/691052431525675048/953222550568173580/956596218857918464 ) by @superdump to be particularly helpful, in the general discussion around `encase`. 

I have taken care to clarify where the data is stored (host-side), when the device-side buffer is created (through calls to `reserve`), and when data writes from host to device are scheduled (using `write_buffer` calls). 

---

## Changelog

- Added doc string for `BufferVec` and two of its methods: `reserve` and `write_buffer`. 


Co-authored-by: Brian Merchant <bhmerchant@gmail.com>
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-Docs An addition or correction to our documentation S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants