Add conversions between Extent2D, Extent3D and Rect2D#557
Conversation
|
This is just a first-pass PR since there are some outstanding questions:
Anyway, let me know if this seems sane, or how I can improve things. |
I'd do it the way vector libraries such as EDIT: For the truncation, not really sure what makes most sense, we try to not be too opinionated, and as a result not provide too many such helpers...
We're moving away from having static code in the generator. Feel free to add this in Over time we will work towards a cleaner split between handwritten files, and dump everything autogenerated in an
That is odd, are submodules or your local |
|
As an aside, you may showcase your new helpers in the examples :) |
|
For 2D -> 3D, I think a Is there a specific use case for the 3D -> 2D case? |
1785050 to
4d0145c
Compare
Unless you feel strongly about this, my reasoning is the same as in @Ralith's comment; my own use-cases (and the
I'll skip the 3D-to-2D conversion for now since that's less clear cut..? While I've encountered situations where I've wanted that, maybe it'll turn out to be easy enough to work around using 2D-to-3D conversions.
Ok, I've redone this to use the prelude instead of modifying the generator.
I don't think
Ok, examples updated. |
|
Huh... I just now noticed there are two preludes: |
Gave his comment a thumbs-up because of that, no strong feelings either way.
It might be the
Shaves off a lot of code 😉
|
4d0145c to
c7f88e9
Compare
MarijnS95
left a comment
There was a problem hiding this comment.
D'oh I forgot to ask in my previous comment: please add an entry to ash/changelog.md :)
I'm running Windows 10 on x86. The difference persists even after running |
Did you run |
Yeah, that explains things. We had more Windows-vs-Linux For obvious reasons crates usually keep generated output separate per platform/OS, but the Video extensions are supposed to "have the same ABI" across all architectures. EDIT: See also KhronosGroup/Vulkan-Docs#1571, won't waste too much time on it as the extension is still experimental and the type definitions are supposedly moved into |
d4975f5 to
03e7502
Compare
I just now noticed this comment... added. |
These two conversions occur all the time in Vulkan applications. For example, Extent2D -> Extent3D occurs whenever you need to make an image the same size as a surface and Extent2D -> Rect2D occurs whenever you fill out a scissors or render area from a surface resolution.
03e7502 to
8417126
Compare
When using
ash, I frequently find myself wishing that converting between 2D/3D extents was less verbose, since it's so common. Likewise, you need to convert from anExtent2Dto aRect2Dany time you want to start a render pass that affects an entire framebuffer.