diff options
author | Clay John <claynjohn@gmail.com> | 2022-10-27 10:02:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 10:02:44 -0700 |
commit | 8fd92ed867a9fddf427d5999b872488c09582c41 (patch) | |
tree | 2a196d36a833939fef5d967253437b36d15d56d4 /servers/rendering/renderer_rd/storage_rd | |
parent | e1caa8797baf55d8f3fbb0b64313c4255228b809 (diff) | |
parent | f5a808192b263b7227b448492cc65d9145e18afd (diff) |
Merge pull request #64710 from MinusKube/window-size-crash
Prevent windows from having a size greater than device limit
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/utilities.cpp | 8 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/utilities.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/utilities.cpp b/servers/rendering/renderer_rd/storage_rd/utilities.cpp index e517186955..4048c46d28 100644 --- a/servers/rendering/renderer_rd/storage_rd/utilities.cpp +++ b/servers/rendering/renderer_rd/storage_rd/utilities.cpp @@ -321,3 +321,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 |