File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1024,6 +1024,7 @@ class IContext {
10241024 virtual Result upload (TextureHandle handle, const TextureRangeDesc& range, const void * data) = 0;
10251025 virtual Result download (TextureHandle handle, const TextureRangeDesc& range, void * outData) = 0;
10261026 [[nodiscard]] virtual Dimensions getDimensions (TextureHandle handle) const = 0;
1027+ [[nodiscard]] virtual float getAspectRatio (TextureHandle handle) const = 0;
10271028 [[nodiscard]] virtual Format getFormat (TextureHandle handle) const = 0;
10281029#pragma endregion
10291030
Original file line number Diff line number Diff line change @@ -5102,6 +5102,22 @@ lvk::Dimensions lvk::VulkanContext::getDimensions(TextureHandle handle) const {
51025102 };
51035103}
51045104
5105+ float lvk::VulkanContext::getAspectRatio (TextureHandle handle) const {
5106+ if (!handle) {
5107+ return 1 .0f ;
5108+ }
5109+
5110+ const lvk::VulkanImage* tex = texturesPool_.get (handle);
5111+
5112+ LVK_ASSERT (tex);
5113+
5114+ if (!tex) {
5115+ return 1 .0f ;
5116+ }
5117+
5118+ return static_cast <float >(tex->vkExtent_ .width ) / static_cast <float >(tex->vkExtent_ .height );
5119+ }
5120+
51055121void lvk::VulkanContext::generateMipmap (TextureHandle handle) const {
51065122 if (handle.empty ()) {
51075123 return ;
Original file line number Diff line number Diff line change @@ -516,6 +516,7 @@ class VulkanContext final : public IContext {
516516 Result upload (TextureHandle handle, const TextureRangeDesc& range, const void * data) override ;
517517 Result download (TextureHandle handle, const TextureRangeDesc& range, void * outData) override ;
518518 Dimensions getDimensions (TextureHandle handle) const override ;
519+ float getAspectRatio (TextureHandle handle) const override ;
519520 Format getFormat (TextureHandle handle) const override ;
520521
521522 TextureHandle getCurrentSwapchainTexture () override ;
You can’t perform that action at this time.
0 commit comments