diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/dummy/rasterizer_dummy.h | 4 | ||||
| -rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 33 | ||||
| -rw-r--r-- | drivers/gles2/rasterizer_gles2.h | 3 | ||||
| -rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 19 | ||||
| -rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.h | 4 | ||||
| -rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 23 | ||||
| -rw-r--r-- | drivers/gles3/rasterizer_gles3.h | 3 | ||||
| -rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 23 | ||||
| -rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.h | 8 | ||||
| -rw-r--r-- | drivers/unix/os_unix.cpp | 2 | ||||
| -rw-r--r-- | drivers/unix/os_unix.h | 2 |
11 files changed, 51 insertions, 73 deletions
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index e39ec915fc..0381d3f0c1 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -789,6 +789,10 @@ public: void end_frame(bool p_swap_buffers) {} void finalize() {} + static Error is_viable() { + return OK; + } + static Rasterizer *_create_current() { return memnew(RasterizerDummy); } diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index c926f2bcc4..76ee80aa07 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -136,26 +136,21 @@ RasterizerScene *RasterizerGLES2::get_scene() { return scene; } -void RasterizerGLES2::initialize() { - - print_verbose("Using GLES2 video driver"); +Error RasterizerGLES2::is_viable() { #ifdef GLAD_ENABLED if (!gladLoadGL()) { ERR_PRINT("Error initializing GLAD"); + return ERR_UNAVAILABLE; } // GLVersion seems to be used for both GL and GL ES, so we need different version checks for them #ifdef OPENGL_ENABLED // OpenGL 2.1 Profile required - if (GLVersion.major < 2) { -#else // OpenGL ES 3.0 + if (GLVersion.major < 2 || (GLVersion.major == 2 && GLVersion.minor < 1)) { +#else // OpenGL ES 2.0 if (GLVersion.major < 2) { #endif - ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n" - "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); - OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n" - "Godot Engine will self-destruct as soon as you acknowledge this error message.", - "Fatal error: Insufficient OpenGL / GLES driver support"); + return ERR_UNAVAILABLE; } #ifdef GLES_OVER_GL @@ -181,14 +176,21 @@ void RasterizerGLES2::initialize() { glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT; glGenerateMipmap = glGenerateMipmapEXT; } else { - ERR_PRINT("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n" - "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); - OS::get_singleton()->alert("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n" - "Godot Engine will self-destruct as soon as you acknowledge this error message.", - "Fatal error: Insufficient OpenGL / GLES driver support"); + return ERR_UNAVAILABLE; } } #endif + +#endif // GLAD_ENABLED + + return OK; +} + +void RasterizerGLES2::initialize() { + + print_verbose("Using GLES2 video driver"); + +#ifdef GLAD_ENABLED if (true || OS::get_singleton()->is_stdout_verbose()) { if (GLAD_GL_ARB_debug_output) { glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); @@ -198,7 +200,6 @@ void RasterizerGLES2::initialize() { print_line("OpenGL debugging not supported!"); } } - #endif // GLAD_ENABLED // For debugging diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index f727af39dd..98c73b776b 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -61,9 +61,10 @@ public: virtual void end_frame(bool p_swap_buffers); virtual void finalize(); + static Error is_viable(); static void make_current(); - static void register_config(); + RasterizerGLES2(); ~RasterizerGLES2(); }; diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 22e56fbb09..3cee42983d 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -365,7 +365,6 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_ ERR_FAIL_COND(!texture); texture->width = p_width; texture->height = p_height; - texture->depth = 0; texture->format = p_format; texture->flags = p_flags; texture->stored_cube_sides = 0; @@ -385,7 +384,6 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_ } break; case VS::TEXTURE_TYPE_3D: { texture->images.resize(p_depth_3d); - texture->depth = p_depth_3d; } break; default: { ERR_PRINT("Unknown texture type!"); @@ -398,7 +396,6 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_ texture->alloc_width = texture->width; texture->alloc_height = texture->height; - texture->alloc_depth = texture->depth; texture->gl_format_cache = format; texture->gl_type_cache = type; @@ -594,9 +591,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) PoolVector<uint8_t> data; - int alloc_depth = MAX(texture->alloc_depth, 1); - - int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, texture->mipmaps > 1 ? -1 : 0) * alloc_depth; + int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, texture->mipmaps > 1 ? -1 : 0); data.resize(data_size * 2); //add some memory at the end, just in case for buggy drivers PoolVector<uint8_t>::Write wb = data.write(); @@ -625,7 +620,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) wb = PoolVector<uint8_t>::Write(); - data.resize(data_size / alloc_depth); + data.resize(data_size); Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, real_format, data)); @@ -785,7 +780,7 @@ void RasterizerStorageGLES2::texture_debug_usage(List<VS::TextureInfo> *r_info) tinfo.format = t->format; tinfo.width = t->alloc_width; tinfo.height = t->alloc_height; - tinfo.depth = t->alloc_depth; + tinfo.depth = 0; tinfo.bytes = t->total_data_size; r_info->push_back(tinfo); } @@ -3667,8 +3662,6 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) { texture->alloc_width = rt->width; texture->height = rt->height; texture->alloc_height = rt->height; - texture->depth = 0; - texture->alloc_depth = 0; texture->active = true; texture_set_flags(rt->texture, texture->flags); @@ -3716,8 +3709,6 @@ void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) { Texture *tex = texture_owner.get(rt->texture); tex->alloc_height = 0; tex->alloc_width = 0; - tex->alloc_depth = 0; - tex->depth = 0; tex->width = 0; tex->height = 0; tex->active = false; @@ -3741,10 +3732,8 @@ RID RasterizerStorageGLES2::render_target_create() { t->flags = 0; t->width = 0; t->height = 0; - t->depth = 0; - t->alloc_width = 0; t->alloc_height = 0; - t->alloc_depth = 0; + t->alloc_width = 0; t->format = Image::FORMAT_R8; t->target = GL_TEXTURE_2D; t->gl_format_cache = 0; diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index c3066b754d..88783d7160 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -232,7 +232,7 @@ public: String path; uint32_t flags; int width, height, depth; - int alloc_width, alloc_height, alloc_depth; + int alloc_width, alloc_height; Image::Format format; VS::TextureType type; @@ -275,10 +275,8 @@ public: flags = 0; width = 0; height = 0; - depth = 0; alloc_width = 0; alloc_height = 0; - alloc_depth = 0; format = Image::FORMAT_L8; target = 0; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 0d42635194..e4824695d5 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -136,28 +136,32 @@ typedef void (*DEBUGPROCARB)(GLenum source, typedef void (*DebugMessageCallbackARB)(DEBUGPROCARB callback, const void *userParam); -void RasterizerGLES3::initialize() { - - print_verbose("Using GLES3 video driver"); +Error RasterizerGLES3::is_viable() { #ifdef GLAD_ENABLED if (!gladLoadGL()) { ERR_PRINT("Error initializing GLAD"); + return ERR_UNAVAILABLE; } // GLVersion seems to be used for both GL and GL ES, so we need different version checks for them #ifdef OPENGL_ENABLED // OpenGL 3.3 Core Profile required - if (GLVersion.major < 3 && GLVersion.minor < 3) { + if (GLVersion.major < 3 || (GLVersion.major == 3 && GLVersion.minor < 3)) { #else // OpenGL ES 3.0 if (GLVersion.major < 3) { #endif - ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n" - "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); - OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n" - "Godot Engine will self-destruct as soon as you acknowledge this error message.", - "Fatal error: Insufficient OpenGL / GLES driver support"); + return ERR_UNAVAILABLE; } +#endif // GLAD_ENABLED + return OK; +} + +void RasterizerGLES3::initialize() { + + print_verbose("Using GLES3 video driver"); + +#ifdef GLAD_ENABLED if (OS::get_singleton()->is_stdout_verbose()) { if (GLAD_GL_ARB_debug_output) { glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); @@ -167,7 +171,6 @@ void RasterizerGLES3::initialize() { print_line("OpenGL debugging not supported!"); } } - #endif // GLAD_ENABLED /* // For debugging diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index f4449ac0f9..0a264caf8f 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -62,9 +62,10 @@ public: virtual void end_frame(bool p_swap_buffers); virtual void finalize(); + static Error is_viable(); static void make_current(); - static void register_config(); + RasterizerGLES3(); ~RasterizerGLES3(); }; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 5ee6c28d83..0bb0e12b8e 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -667,7 +667,7 @@ void RasterizerStorageGLES3::texture_allocate(RID p_texture, int p_width, int p_ int mipmaps = 0; while (width != 1 && height != 1) { - glTexImage3D(texture->target, mipmaps, internal_format, width, height, depth, 0, format, type, NULL); + glTexImage3D(texture->target, 0, internal_format, width, height, depth, 0, format, type, NULL); width = MAX(1, width / 2); height = MAX(1, height / 2); @@ -1029,11 +1029,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) PoolVector<uint8_t> data; - int alloc_depth = MAX(texture->alloc_depth, 1); - - ERR_FAIL_COND_V(p_layer < 0 || p_layer >= alloc_depth, Ref<Image>()); - - int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, texture->mipmaps > 1 ? -1 : 0) * alloc_depth; + int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, texture->mipmaps > 1 ? -1 : 0); data.resize(data_size * 2); //add some memory at the end, just in case for buggy drivers PoolVector<uint8_t>::Write wb = data.write(); @@ -1089,13 +1085,9 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) img_format = real_format; } - int slice_size = data_size / alloc_depth; - - if (p_layer) { - memcpy(&wb[0], &wb[slice_size * p_layer], slice_size); - } + wb = PoolVector<uint8_t>::Write(); - data.resize(slice_size); + data.resize(data_size); Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, img_format, data)); @@ -1283,7 +1275,7 @@ void RasterizerStorageGLES3::texture_debug_usage(List<VS::TextureInfo> *r_info) tinfo.format = t->format; tinfo.width = t->alloc_width; tinfo.height = t->alloc_height; - tinfo.depth = t->alloc_depth; + tinfo.depth = 0; tinfo.bytes = t->total_data_size; r_info->push_back(tinfo); } @@ -1450,7 +1442,6 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source, int p_ ctex->height = p_resolution; ctex->alloc_width = p_resolution; ctex->alloc_height = p_resolution; - ctex->alloc_depth = 0; ctex->format = use_float ? Image::FORMAT_RGBAH : Image::FORMAT_RGBA8; ctex->target = GL_TEXTURE_CUBE_MAP; ctex->gl_format_cache = format; @@ -6473,7 +6464,6 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { Texture *tex = texture_owner.get(rt->texture); tex->alloc_height = 0; tex->alloc_width = 0; - tex->alloc_depth = 0; tex->width = 0; tex->height = 0; tex->active = false; @@ -6587,7 +6577,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) { tex->height = rt->height; tex->alloc_height = rt->height; tex->active = true; - tex->alloc_depth = 0; texture_set_flags(rt->texture, tex->flags); } @@ -6876,10 +6865,8 @@ RID RasterizerStorageGLES3::render_target_create() { t->flags = 0; t->width = 0; t->height = 0; - t->depth = 0; t->alloc_height = 0; t->alloc_width = 0; - t->alloc_depth = 0; t->format = Image::FORMAT_R8; t->target = GL_TEXTURE_2D; t->gl_format_cache = 0; diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 43b7d5fc99..b74dd77e26 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -294,13 +294,7 @@ public: stored_cube_sides = 0; ignore_mipmaps = false; render_target = NULL; - flags = 0; - width = 0; - height = 0; - depth = 0; - alloc_width = 0; - alloc_height = 0; - alloc_depth = 0; + flags = width = height = 0; tex_id = 0; data_size = 0; format = Image::FORMAT_L8; diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 8aab4cb521..05dfd69f58 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -329,7 +329,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo return OK; } -Error OS_Unix::kill(const ProcessID &p_pid, const int p_max_wait_msec) { +Error OS_Unix::kill(const ProcessID &p_pid) { int ret = ::kill(p_pid, SIGKILL); if (!ret) { diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index c5240231fa..95b74d23ff 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -91,7 +91,7 @@ public: virtual uint64_t get_ticks_usec() const; virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false); - virtual Error kill(const ProcessID &p_pid, const int p_max_wait_msec = -1); + virtual Error kill(const ProcessID &p_pid); virtual int get_process_id() const; virtual bool has_environment(const String &p_var) const; |