summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorClay John <claynjohn@gmail.com>2022-10-27 10:02:44 -0700
committerGitHub <noreply@github.com>2022-10-27 10:02:44 -0700
commit8fd92ed867a9fddf427d5999b872488c09582c41 (patch)
tree2a196d36a833939fef5d967253437b36d15d56d4 /drivers/gles3
parente1caa8797baf55d8f3fbb0b64313c4255228b809 (diff)
parentf5a808192b263b7227b448492cc65d9145e18afd (diff)
Merge pull request #64710 from MinusKube/window-size-crash
Prevent windows from having a size greater than device limit
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/storage/config.cpp1
-rw-r--r--drivers/gles3/storage/config.h1
-rw-r--r--drivers/gles3/storage/utilities.cpp9
-rw-r--r--drivers/gles3/storage/utilities.h2
4 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp
index 609ecacded..943df3b156 100644
--- a/drivers/gles3/storage/config.cpp
+++ b/drivers/gles3/storage/config.cpp
@@ -94,6 +94,7 @@ Config::Config() {
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_image_units);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_uniform_buffer_size);
+ glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &max_viewport_size);
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &uniform_buffer_offset_alignment);
diff --git a/drivers/gles3/storage/config.h b/drivers/gles3/storage/config.h
index de08385e04..d4b38acd18 100644
--- a/drivers/gles3/storage/config.h
+++ b/drivers/gles3/storage/config.h
@@ -64,6 +64,7 @@ public:
int max_texture_image_units = 0;
int max_texture_size = 0;
int max_uniform_buffer_size = 0;
+ int max_viewport_size = 0;
int max_renderable_elements = 0;
int max_renderable_lights = 0;
int max_lights_per_object = 0;
diff --git a/drivers/gles3/storage/utilities.cpp b/drivers/gles3/storage/utilities.cpp
index 6e91f38050..0a04f0d4d0 100644
--- a/drivers/gles3/storage/utilities.cpp
+++ b/drivers/gles3/storage/utilities.cpp
@@ -356,4 +356,13 @@ String Utilities::get_video_adapter_api_version() const {
return (const char *)glGetString(GL_VERSION);
}
+Size2i Utilities::get_maximum_viewport_size() const {
+ Config *config = Config::get_singleton();
+ if (!config) {
+ return Size2i();
+ }
+
+ return Size2i(config->max_viewport_size, config->max_viewport_size);
+}
+
#endif // GLES3_ENABLED
diff --git a/drivers/gles3/storage/utilities.h b/drivers/gles3/storage/utilities.h
index e054f2f816..936ac35cc9 100644
--- a/drivers/gles3/storage/utilities.h
+++ b/drivers/gles3/storage/utilities.h
@@ -150,6 +150,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 GLES3