summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-10 12:16:45 +0100
committerGitHub <noreply@github.com>2019-02-10 12:16:45 +0100
commit6c57bdf6ff02c566efc0d3a8b84f5d0393a69894 (patch)
tree56b8ec39f3afa6467a4db9efcc9ded8ad7f1cd28
parent3b3bb8c57815a348bc852db5b70548873a938f9c (diff)
parent034cd62a7740a51d2527272a44bf225cd7a89724 (diff)
Merge pull request #25746 from akien-mga/gpu-particles-gles2
Warn when using GPU particles with GLES2
-rw-r--r--core/os/os.h13
-rw-r--r--scene/2d/particles_2d.cpp5
-rw-r--r--scene/3d/particles.cpp6
3 files changed, 18 insertions, 6 deletions
diff --git a/core/os/os.h b/core/os/os.h
index 20a3494e11..396555970a 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -45,12 +45,6 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-enum VideoDriver {
- VIDEO_DRIVER_GLES3,
- VIDEO_DRIVER_GLES2,
- VIDEO_DRIVER_MAX,
-};
-
class OS {
static OS *singleton;
@@ -184,9 +178,16 @@ public:
virtual VideoMode get_video_mode(int p_screen = 0) const = 0;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const = 0;
+ enum VideoDriver {
+ VIDEO_DRIVER_GLES3,
+ VIDEO_DRIVER_GLES2,
+ VIDEO_DRIVER_MAX,
+ };
+
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
virtual int get_current_video_driver() const = 0;
+
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index c005c33a19..9701998f5d 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -30,6 +30,7 @@
#include "particles_2d.h"
+#include "core/os/os.h"
#include "scene/resources/particles_material.h"
#include "scene/scene_string_names.h"
@@ -213,6 +214,10 @@ bool Particles2D::get_fractional_delta() const {
String Particles2D::get_configuration_warning() const {
+ if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) {
+ return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
+ }
+
String warnings;
if (process_material.is_null()) {
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 2add50dd5d..78b2958400 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "particles.h"
+
+#include "core/os/os.h"
#include "scene/resources/particles_material.h"
#include "servers/visual_server.h"
@@ -224,6 +226,10 @@ bool Particles::get_fractional_delta() const {
String Particles::get_configuration_warning() const {
+ if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) {
+ return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
+ }
+
String warnings;
bool meshes_found = false;