-
Notifications
You must be signed in to change notification settings - Fork 192
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
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 anExtent2D
to aRect2D
any time you want to start a render pass that affects an entire framebuffer.