From f5a808192b263b7227b448492cc65d9145e18afd Mon Sep 17 00:00:00 2001 From: MinusKube Date: Mon, 22 Aug 2022 00:16:56 +0200 Subject: Prevent windows from having a size greater than device limit --- servers/rendering/renderer_rd/storage_rd/utilities.cpp | 8 ++++++++ servers/rendering/renderer_rd/storage_rd/utilities.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'servers/rendering/renderer_rd/storage_rd') diff --git a/servers/rendering/renderer_rd/storage_rd/utilities.cpp b/servers/rendering/renderer_rd/storage_rd/utilities.cpp index b80bcd514f..260805c957 100644 --- a/servers/rendering/renderer_rd/storage_rd/utilities.cpp +++ b/servers/rendering/renderer_rd/storage_rd/utilities.cpp @@ -342,3 +342,11 @@ RenderingDevice::DeviceType Utilities::get_video_adapter_type() const { String Utilities::get_video_adapter_api_version() const { return RenderingDevice::get_singleton()->get_device_api_version(); } + +Size2i Utilities::get_maximum_viewport_size() const { + RenderingDevice *device = RenderingDevice::get_singleton(); + + int max_x = device->limit_get(RenderingDevice::LIMIT_MAX_VIEWPORT_DIMENSIONS_X); + int max_y = device->limit_get(RenderingDevice::LIMIT_MAX_VIEWPORT_DIMENSIONS_Y); + return Size2i(max_x, max_y); +} diff --git a/servers/rendering/renderer_rd/storage_rd/utilities.h b/servers/rendering/renderer_rd/storage_rd/utilities.h index a80eb8510e..dda656c380 100644 --- a/servers/rendering/renderer_rd/storage_rd/utilities.h +++ b/servers/rendering/renderer_rd/storage_rd/utilities.h @@ -115,6 +115,8 @@ public: virtual String get_video_adapter_vendor() const override; virtual RenderingDevice::DeviceType get_video_adapter_type() const override; virtual String get_video_adapter_api_version() const override; + + virtual Size2i get_maximum_viewport_size() const override; }; } // namespace RendererRD -- cgit v1.2.3