Warn when using GPU particles with GLES2

Closes #25733.
This commit is contained in:
Rémi Verschelde 2019-02-09 20:49:58 +01:00
parent 5fa5678eb7
commit 034cd62a77
3 changed files with 18 additions and 6 deletions

View file

@ -45,12 +45,6 @@
@author Juan Linietsky <reduzio@gmail.com> @author Juan Linietsky <reduzio@gmail.com>
*/ */
enum VideoDriver {
VIDEO_DRIVER_GLES3,
VIDEO_DRIVER_GLES2,
VIDEO_DRIVER_MAX,
};
class OS { class OS {
static OS *singleton; static OS *singleton;
@ -184,9 +178,16 @@ public:
virtual VideoMode get_video_mode(int p_screen = 0) const = 0; 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; 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 int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const; virtual const char *get_video_driver_name(int p_driver) const;
virtual int get_current_video_driver() const = 0; virtual int get_current_video_driver() const = 0;
virtual int get_audio_driver_count() const; virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const; virtual const char *get_audio_driver_name(int p_driver) const;

View file

@ -30,6 +30,7 @@
#include "particles_2d.h" #include "particles_2d.h"
#include "core/os/os.h"
#include "scene/resources/particles_material.h" #include "scene/resources/particles_material.h"
#include "scene/scene_string_names.h" #include "scene/scene_string_names.h"
@ -213,6 +214,10 @@ bool Particles2D::get_fractional_delta() const {
String Particles2D::get_configuration_warning() 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; String warnings;
if (process_material.is_null()) { if (process_material.is_null()) {

View file

@ -29,6 +29,8 @@
/*************************************************************************/ /*************************************************************************/
#include "particles.h" #include "particles.h"
#include "core/os/os.h"
#include "scene/resources/particles_material.h" #include "scene/resources/particles_material.h"
#include "servers/visual_server.h" #include "servers/visual_server.h"
@ -224,6 +226,10 @@ bool Particles::get_fractional_delta() const {
String Particles::get_configuration_warning() 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; String warnings;
bool meshes_found = false; bool meshes_found = false;