Commit graph

9 commits

Author SHA1 Message Date
Robert Swain
0a4136d266 Add a helper for storage buffers similar to UniformVec (#4079)
# Objective

- Add a helper for storage buffers similar to `UniformVec`

## Solution

- Add a `StorageBuffer<T, U>` where `T` is the main body of the shader struct without any final variable-sized array member, and `U` is the type of the items in a variable-sized array.
- Use `()` as the type for unwanted parts, e.g. `StorageBuffer<(), Vec4>::default()` would construct a binding that would work with `struct MyType { data: array<vec4<f32>>; }` in WGSL and `StorageBuffer<MyType, ()>::default()` would work with `struct MyType { ... }` in WGSL as long as there are no variable-sized arrays.
- Std430 requires that there is at most one variable-sized array in a storage buffer, that if there is one it is the last member of the binding, and that it has at least one item. `StorageBuffer` handles all of these constraints.
2022-03-22 21:23:50 +00:00
Alice Cecile
7ce3ae43e3 Bump Bevy to 0.7.0-dev (#4230)
# Objective

- The [dev docs](https://dev-docs.bevyengine.org/bevy/index.html#) show version 0.6.0, which is actively misleading.

[Image of the problem](https://cdn.discordapp.com/attachments/695741366520512563/953513612943704114/Screenshot_20220316-154100_Firefox-01.jpeg)

Noticed by @ickk, fix proposed by @mockersf.

## Solution

- Bump the version across all Bevy crates to 0.7.0 dev.
- Set a reminder in the Release Checklist to remember to do this each release.
2022-03-19 03:54:15 +00:00
Ted Driggs
8e1f660e1d Don't panic in macro shape validation (#3647)
# Objective
Emitting compile errors produces cleaner messages than panicking in a proc-macro.

## Solution
- Replace match-with-panic code with call to new `bevy_macro_utils::get_named_struct_fields` function
- Replace one use of match-with-panic for enums with inline match

_Aside:_ I'm also the maintainer of [`darling`](https://docs.rs/darling), a crate which provides a serde-like API for parsing macro inputs. I avoided using it here because it seemed like overkill, but if there are plans to add lots more attributes/macros then that might be a good way of offloading macro error handling.
2022-01-15 22:14:43 +00:00
Robert Swain
2186eae89c bevy_crevice: Fix incorrect iterator usage in WriteStd430 impl for [T] (#3591)
# Objective

- Fix incorrect iterator usage in WriteStd430 impl for [T]
  - The first item was being written twice. This is correct in the WriteStd140 impl for [T].

## Solution

- See the code.
2022-01-15 20:10:33 +00:00
Michael Dorst
130953c717 Enable the doc_markdown clippy lint (#3457)
# Objective

CI should check for missing backticks in doc comments.

Fixes #3435

## Solution

`clippy` has a lint for this: `doc_markdown`. This enables that lint in the CI script.

Of course, enabling this lint in CI causes a bunch of lint errors, so I've gone through and fixed all of them. This was a huge edit that touched a ton of files, so I split the PR up by crate.

When all of the following are merged, the CI should pass and this can be merged.

+ [x] #3467
+ [x] #3468
+ [x] #3470 
+ [x] #3469
+ [x] #3471 
+ [x] #3472 
+ [x] #3473 
+ [x] #3474 
+ [x] #3475 
+ [x] #3476 
+ [x] #3477 
+ [x] #3478 
+ [x] #3479 
+ [x] #3480 
+ [x] #3481 
+ [x] #3482 
+ [x] #3483 
+ [x] #3484 
+ [x] #3485 
+ [x] #3486
2022-01-09 23:20:13 +00:00
Carter Anderson
2ee38cb9e0 Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
dependabot[bot]
97012950f9 Update nalgebra requirement from 0.29.0 to 0.30.0 (#3540)
Updates the requirements on [nalgebra](https://github.com/dimforge/nalgebra) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/dimforge/nalgebra/blob/dev/CHANGELOG.md">nalgebra's changelog</a>.</em></p>
<blockquote>
<h2>[0.30.0] (02 Jan. 2022)</h2>
<h3>Breaking changes</h3>
<ul>
<li>The <code>Dim</code> trait is now marked as unsafe.</li>
<li>The <code>Matrix::pow</code> and <code>Matrix::pow_mut</code> methods only allow positive integer exponents now. To compute negative
exponents, the user is free to invert the matrix before calling <code>pow</code> with the exponent’s absolute value.</li>
</ul>
<h3>Modified</h3>
<ul>
<li>Use more concise debug impls for matrices and geometric transformation types.</li>
<li>The singular values computed by the SVD are now sorted in increasing order by default. Use <code>SVD::new_unordered</code>
instead to reproduce the older behavior without the sorting overhead.</li>
<li>The <code>UnitDualQuaternion::sclerp</code> method will no longer panic when given two equal rotations.</li>
<li>The <code>Matrix::select_rows</code> and <code>Matrix::select_columns</code> methods no longer require the matrix components to implement
the trait <code>Zero</code>.</li>
<li>The <code>Matrix::pow</code> and <code>Matrix::pow_mut</code> methods will now also work with integer matrices.</li>
</ul>
<h3>Added</h3>
<ul>
<li>Added the conversion trait <code>From&lt;Vec&lt;T&gt;&gt;</code> and method <code>from_vec_storage</code> for <code>RowDVector</code>.</li>
<li>Added implementation of <code>From</code> and <code>Into</code> for converting between <code>nalgebra</code> types and types from
<code>glam 0.18</code>. These can be enabled by enabling the <code>convert-glam018</code> cargo features.</li>
<li>Added the methods <code>Matrix::product</code>, <code>::row_product</code>, <code>::row_product_tr</code>, and <code>::column_product</code> to compute the
product of the components, rows, or columns, of a single matrix or vector.</li>
<li>The <code>Default</code> trait is now implemented for most geometric types: <code>Point</code>, <code>Isometry</code>, <code>Rotation</code>, <code>Similarity</code>,
<code>Transform</code>, <code>UnitComplex</code>, and <code>UnitQuaternion</code>.</li>
<li>Added the <code>Scale</code> geometric type for representing non-uniform scaling.</li>
<li>Added <code>Cholesky::new_with_substitute</code> that will replace diagonal elements by a given constant whenever <code>Cholesky</code>
meets a non-definite-positiveness.</li>
<li>Re-added the conversion from a vector/matrix slice to a static array.</li>
<li>Added the <code>cuda</code> feature that enables the support of <a href="https://github.com/Rust-GPU/Rust-CUDA">rust-cuda</a> for using
<code>nalgebra</code> features with CUDA kernels written in Rust.</li>
<li>Added special-cases implementations for the 2x2 and 3x3 SVDs for better accuracy and performances.</li>
<li>Added the methods <code>Matrix::polar</code>, <code>Matrix::try_polar</code>, and <code>SVD::to_polar</code> to compute the polar decomposition of
a matrix, based on its SVD.</li>
<li><code>nalgebra-sparse</code>: provide constructors for unsorted but otherwise valid data using the CSR format.</li>
<li><code>nalgebra-sparse</code>: added reading MatrixMarked data files to a sparse <code>CooMatrix</code>.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fixed a potential unsoundness with <code>matrix.get(i)</code> and <code>matrix.get_mut(i)</code> where <code>i</code>  is an <code>usize</code>, and <code>matrix</code>
is a matrix slice with non-default strides.</li>
<li>Fixed potential unsoundness with <code>vector.perp</code> where <code>vector</code> isn’t actually a 2D vector as expected.</li>
<li>Fixed linkage issue with <code>nalgebra-lapack</code>: the user of <code>nalgebra-lapack</code> no longer have to add
<code>extern crate lapack-src</code> to their <code>main.rs</code>.</li>
<li>Fixed the <code>no-std</code> build of <code>nalgebra-glm</code>.</li>
<li>Fix the <code>pow</code> and <code>pow_mut</code> functions (the result was incorrect for some exponent values).</li>
</ul>
<h2>[0.29.0]</h2>
<h3>Breaking changes</h3>
<ul>
<li>We updated to the version 0.6 of <code>simba</code>. This means that the trait bounds <code>T: na::RealField</code>, <code>na::ComplexField</code>,
<code>na::SimdRealField</code>, <code>na:SimdComplexField</code> no imply that <code>T: Copy</code> (they only imply that <code>T: Clone</code>). This may affect</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="e8b9c40123"><code>e8b9c40</code></a> Release v0.30.0</li>
<li><a href="c0f8530d5e"><code>c0f8530</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dimforge/nalgebra/issues/1055">#1055</a> from dimforge/fix-pow</li>
<li><a href="99ac8c4032"><code>99ac8c4</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dimforge/nalgebra/issues/1050">#1050</a> from metric-space/polar-decomposition-take-2</li>
<li><a href="498d7e3d4c"><code>498d7e3</code></a> Semi-unitary test checks for if rows or cols are orthonomal</li>
<li><a href="ae6fda7dc7"><code>ae6fda7</code></a> Change svd to svd_unordered for the method output to be equal</li>
<li><a href="d806669cc7"><code>d806669</code></a> Fix Matrix::pow and make it work only with positive exponents</li>
<li><a href="fdaf8c0fbe"><code>fdaf8c0</code></a> Add tests for Matrix::pow</li>
<li><a href="67a82c2c88"><code>67a82c2</code></a> Test: minor style fix</li>
<li><a href="8e0ca439c2"><code>8e0ca43</code></a> Use proptest for testing the polar decomposition</li>
<li><a href="cc10b67dd1"><code>cc10b67</code></a> Add Matrix::try_polar that returns Option and make Matrix::polar not return O...</li>
<li>Additional commits viewable in <a href="https://github.com/dimforge/nalgebra/compare/v0.29.0...v0.30.0">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
2022-01-03 08:33:15 +00:00
François
f3b053d11f crevice derive macro: fix path to render_resource when importing from bevy (#3438)
# Objective

- Fix #3436 

## Solution

- Do not add twice `render_resource` when coming from `bevy`


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-26 19:04:02 +00:00
François
79d36e7c28 Prepare crevice for vendored release (#3394)
# Objective

- Our crevice is still called "crevice", which we can't use for a release
- Users would need to use our "crevice" directly to be able to use the derive macro

## Solution

- Rename crevice to bevy_crevice, and crevice-derive to bevy-crevice-derive
- Re-export it from bevy_render, and use it from bevy_render everywhere
- Fix derive macro to work either from bevy_render, from bevy_crevice, or from bevy

## Remaining

- It is currently re-exported as `bevy::render::bevy_crevice`, is it the path we want?
- After a brief suggestion to Cart, I changed the version to follow Bevy version instead of crevice, do we want that?
- Crevice README.md need to be updated
- in the `Cargo.toml`, there are a few things to change. How do we want to change them? How do we keep attributions to original Crevice?
```
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
documentation = "https://docs.rs/crevice"
homepage = "https://github.com/LPGhatguy/crevice"
repository = "https://github.com/LPGhatguy/crevice"
```


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-12-23 22:49:12 +00:00