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 | |
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')
-rw-r--r-- | servers/rendering/dummy/storage/utilities.h | 2 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/utilities.cpp | 8 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/utilities.h | 2 | ||||
-rw-r--r-- | servers/rendering/rendering_device.cpp | 2 | ||||
-rw-r--r-- | servers/rendering/rendering_device.h | 2 | ||||
-rw-r--r-- | servers/rendering/rendering_server_default.cpp | 8 | ||||
-rw-r--r-- | servers/rendering/rendering_server_default.h | 2 | ||||
-rw-r--r-- | servers/rendering/storage/utilities.h | 2 | ||||
-rw-r--r-- | servers/rendering_server.h | 2 |
9 files changed, 30 insertions, 0 deletions
diff --git a/servers/rendering/dummy/storage/utilities.h b/servers/rendering/dummy/storage/utilities.h index cb7b2a2b63..a42ab0d814 100644 --- a/servers/rendering/dummy/storage/utilities.h +++ b/servers/rendering/dummy/storage/utilities.h @@ -109,6 +109,8 @@ public: virtual String get_video_adapter_vendor() const override { return String(); } virtual RenderingDevice::DeviceType get_video_adapter_type() const override { return RenderingDevice::DeviceType::DEVICE_TYPE_OTHER; } virtual String get_video_adapter_api_version() const override { return String(); } + + virtual Size2i get_maximum_viewport_size() const override { return Size2i(); }; }; } // namespace RendererDummy 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 diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index dd190437a3..93118f39e7 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -974,6 +974,8 @@ void RenderingDevice::_bind_methods() { BIND_ENUM_CONSTANT(LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_X); BIND_ENUM_CONSTANT(LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Y); BIND_ENUM_CONSTANT(LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Z); + BIND_ENUM_CONSTANT(LIMIT_MAX_VIEWPORT_DIMENSIONS_X); + BIND_ENUM_CONSTANT(LIMIT_MAX_VIEWPORT_DIMENSIONS_Y); BIND_ENUM_CONSTANT(MEMORY_TEXTURES); BIND_ENUM_CONSTANT(MEMORY_BUFFERS); diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h index ca30a30786..d0b85d8220 100644 --- a/servers/rendering/rendering_device.h +++ b/servers/rendering/rendering_device.h @@ -1252,6 +1252,8 @@ public: LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_X, LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Y, LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Z, + LIMIT_MAX_VIEWPORT_DIMENSIONS_X, + LIMIT_MAX_VIEWPORT_DIMENSIONS_Y, LIMIT_SUBGROUP_SIZE, LIMIT_SUBGROUP_IN_SHADERS, // Set flags using SHADER_STAGE_VERTEX_BIT, SHADER_STAGE_FRAGMENT_BIT, etc. LIMIT_SUBGROUP_OPERATIONS, diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp index 9103b0cf56..c0cd564308 100644 --- a/servers/rendering/rendering_server_default.cpp +++ b/servers/rendering/rendering_server_default.cpp @@ -331,6 +331,14 @@ bool RenderingServerDefault::is_low_end() const { return RendererCompositor::is_low_end(); } +Size2i RenderingServerDefault::get_maximum_viewport_size() const { + if (RSG::utilities) { + return RSG::utilities->get_maximum_viewport_size(); + } else { + return Size2i(); + } +} + void RenderingServerDefault::_thread_exit() { exit.set(); } diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index fe212151e3..a68c7ddf2c 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -994,6 +994,8 @@ public: virtual void set_print_gpu_profile(bool p_enable) override; + virtual Size2i get_maximum_viewport_size() const override; + RenderingServerDefault(bool p_create_thread = false); ~RenderingServerDefault(); }; diff --git a/servers/rendering/storage/utilities.h b/servers/rendering/storage/utilities.h index d240d58917..23a782c14a 100644 --- a/servers/rendering/storage/utilities.h +++ b/servers/rendering/storage/utilities.h @@ -181,6 +181,8 @@ public: virtual String get_video_adapter_vendor() const = 0; virtual RenderingDevice::DeviceType get_video_adapter_type() const = 0; virtual String get_video_adapter_api_version() const = 0; + + virtual Size2i get_maximum_viewport_size() const = 0; }; #endif // RENDERER_UTILITIES_H diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 3c6f46a985..36779690de 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -1575,6 +1575,8 @@ public: virtual void set_print_gpu_profile(bool p_enable) = 0; + virtual Size2i get_maximum_viewport_size() const = 0; + RenderingDevice *get_rendering_device() const; RenderingDevice *create_local_rendering_device() const; |