diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 12 | ||||
| -rw-r--r-- | drivers/nrex/regex.cpp | 9 | ||||
| -rw-r--r-- | drivers/nrex/regex.h | 1 | ||||
| -rw-r--r-- | drivers/register_driver_types.cpp | 1 | ||||
| -rw-r--r-- | drivers/theora/video_stream_theora.cpp | 3 | ||||
| -rw-r--r-- | drivers/unix/memory_pool_static_malloc.cpp | 29 | ||||
| -rw-r--r-- | drivers/unix/thread_posix.cpp | 17 | ||||
| -rw-r--r-- | drivers/unix/thread_posix.h | 5 |
8 files changed, 51 insertions, 26 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index e3a3e7def3..4b976c5b06 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -7088,11 +7088,13 @@ void RasterizerGLES2::_draw_tex_bg() { copy_shader.set_uniform(CopyShaderGLES2::ENERGY,nrg); copy_shader.set_uniform(CopyShaderGLES2::CUSTOM_ALPHA,float(current_env->bg_param[VS::ENV_BG_PARAM_GLOW])); + float flip_sign = (current_env->bg_mode==VS::ENV_BG_TEXTURE && current_rt && current_rt_vflip)?-1:1; + Vector3 vertices[4]={ - Vector3(-1,-1,1), - Vector3( 1,-1,1), - Vector3( 1, 1,1), - Vector3(-1, 1,1) + Vector3(-1,-1*flip_sign,1), + Vector3( 1,-1*flip_sign,1), + Vector3( 1, 1*flip_sign,1), + Vector3(-1, 1*flip_sign,1) }; @@ -7238,7 +7240,7 @@ void RasterizerGLES2::end_scene() { bgcolor = current_env->bg_param[VS::ENV_BG_PARAM_COLOR]; else bgcolor = Globals::get_singleton()->get("render/default_clear_color"); - bgcolor = _convert_color(bgcolor); + bgcolor = _convert_color(bgcolor); float a = use_fb ? float(current_env->bg_param[VS::ENV_BG_PARAM_GLOW]) : 1.0; glClearColor(bgcolor.r,bgcolor.g,bgcolor.b,a); _glClearDepth(1.0); diff --git a/drivers/nrex/regex.cpp b/drivers/nrex/regex.cpp index 459cf28e1e..5d6c9583ef 100644 --- a/drivers/nrex/regex.cpp +++ b/drivers/nrex/regex.cpp @@ -21,6 +21,7 @@ void RegEx::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid); ObjectTypeDB::bind_method(_MD("get_capture_count"),&RegEx::get_capture_count); ObjectTypeDB::bind_method(_MD("get_capture","capture"),&RegEx::get_capture); + ObjectTypeDB::bind_method(_MD("get_capture_start","capture"),&RegEx::get_capture_start); ObjectTypeDB::bind_method(_MD("get_captures"),&RegEx::_bind_get_captures); }; @@ -68,6 +69,14 @@ String RegEx::get_capture(int capture) const { } +int RegEx::get_capture_start(int capture) const { + + ERR_FAIL_COND_V( get_capture_count() <= capture, -1 ); + + return captures[capture].start; + +} + Error RegEx::compile(const String& p_pattern, int capture) { clear(); diff --git a/drivers/nrex/regex.h b/drivers/nrex/regex.h index ae8d40ceab..4b063f0bf1 100644 --- a/drivers/nrex/regex.h +++ b/drivers/nrex/regex.h @@ -35,6 +35,7 @@ public: void clear(); bool is_valid() const; int get_capture_count() const; + int get_capture_start(int capture) const; String get_capture(int capture) const; Error compile(const String& p_pattern, int capture = 9); int find(const String& p_text, int p_start = 0, int p_end = -1) const; diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index e7bbf28f01..235438f126 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -31,7 +31,6 @@ #endif #ifdef TOOLS_ENABLED -#include "pe_bliss/pe_bliss_godot.h" #include "platform/windows/export/export.h" #endif diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp index 1d2e6b9dda..e577c3f932 100644 --- a/drivers/theora/video_stream_theora.cpp +++ b/drivers/theora/video_stream_theora.cpp @@ -489,6 +489,9 @@ Ref<Texture> VideoStreamPlaybackTheora::get_texture() { void VideoStreamPlaybackTheora::update(float p_delta) { + if (!file) + return; + if (!playing || paused) { //printf("not playing\n"); return; diff --git a/drivers/unix/memory_pool_static_malloc.cpp b/drivers/unix/memory_pool_static_malloc.cpp index 1a79272dc1..f89b55de12 100644 --- a/drivers/unix/memory_pool_static_malloc.cpp +++ b/drivers/unix/memory_pool_static_malloc.cpp @@ -48,7 +48,12 @@ void* MemoryPoolStaticMalloc::alloc(size_t p_bytes,const char *p_description) { #else - int total = p_bytes + DEFAULT_ALIGNMENT; + size_t total; + #if defined(_add_overflow) + if (_add_overflow(p_bytes, DEFAULT_ALIGNMENT, &total)) return NULL; + #else + total = p_bytes + DEFAULT_ALIGNMENT; + #endif uint8_t* ptr = (uint8_t*)_alloc(total, p_description); ERR_FAIL_COND_V( !ptr, ptr ); int ofs = (DEFAULT_ALIGNMENT - ((uintptr_t)ptr & (DEFAULT_ALIGNMENT - 1))); @@ -64,11 +69,18 @@ void* MemoryPoolStaticMalloc::_alloc(size_t p_bytes,const char *p_description) { MutexLock lock(mutex); #ifdef DEBUG_MEMORY_ENABLED - void *mem=malloc(p_bytes+sizeof(RingPtr)); /// add for size and ringlist + + size_t total; + #if defined(_add_overflow) + if (_add_overflow(p_bytes, sizeof(RingPtr), &total)) return NULL; + #else + total = p_bytes + sizeof(RingPtr); + #endif + void *mem=malloc(total); /// add for size and ringlist if (!mem) { - printf("**ERROR: out of memory while allocating %i bytes by %s?\n",(int) p_bytes, p_description); - printf("**ERROR: memory usage is %i\n", (int)get_total_usage()); + printf("**ERROR: out of memory while allocating %lu bytes by %s?\n", (unsigned long) p_bytes, p_description); + printf("**ERROR: memory usage is %lu\n", (unsigned long) get_total_usage()); }; ERR_FAIL_COND_V(!mem,0); //out of memory, or unreasonable request @@ -129,7 +141,12 @@ void* MemoryPoolStaticMalloc::realloc(void *p_memory,size_t p_bytes) { if (!p_memory) return alloc(p_bytes); - int total = p_bytes + DEFAULT_ALIGNMENT; + size_t total; + #if defined(_add_overflow) + if (_add_overflow(p_bytes, DEFAULT_ALIGNMENT, &total)) return NULL; + #else + total = p_bytes + DEFAULT_ALIGNMENT; + #endif uint8_t* mem = (uint8_t*)p_memory; int ofs = *(mem-1); mem = mem - ofs; @@ -321,7 +338,7 @@ size_t MemoryPoolStaticMalloc::get_max_usage() { /* Most likely available only if memory debugger was compiled in */ int MemoryPoolStaticMalloc::get_alloc_count() { - return 0; + return total_pointers; } void * MemoryPoolStaticMalloc::get_alloc_ptr(int p_alloc_idx) { diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index bd33c81298..6ace64a923 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -81,9 +81,9 @@ void ThreadPosix::wait_to_finish_func_posix(Thread* p_thread) { tp->pthread=0; } -Error ThreadPosix::set_name(const String& p_name) { +Error ThreadPosix::set_name_func_posix(const String& p_name) { - ERR_FAIL_COND_V(pthread == 0, ERR_UNCONFIGURED); + pthread_t running_thread = pthread_self(); #ifdef PTHREAD_NO_RENAME return ERR_UNAVAILABLE; @@ -93,22 +93,15 @@ Error ThreadPosix::set_name(const String& p_name) { #ifdef PTHREAD_RENAME_SELF // check if thread is the same as caller - int caller = Thread::get_caller_ID(); - int self = get_ID(); - if (caller != self) { - ERR_EXPLAIN("On this platform, thread can only be renamed with calls from the threads to be renamed."); - ERR_FAIL_V(ERR_UNAVAILABLE); - return ERR_UNAVAILABLE; - }; int err = pthread_setname_np(p_name.utf8().get_data()); #else #ifdef PTHREAD_BSD_SET_NAME - pthread_set_name_np(pthread, p_name.utf8().get_data()); + pthread_set_name_np(running_thread, p_name.utf8().get_data()); int err = 0; // Open/FreeBSD ignore errors in this function #else - int err = pthread_setname_np(pthread, p_name.utf8().get_data()); + int err = pthread_setname_np(running_thread, p_name.utf8().get_data()); #endif // PTHREAD_BSD_SET_NAME #endif // PTHREAD_RENAME_SELF @@ -123,7 +116,7 @@ void ThreadPosix::make_default() { create_func=create_func_posix; get_thread_ID_func=get_thread_ID_func_posix; wait_to_finish_func=wait_to_finish_func_posix; - + set_name_func = set_name_func_posix; } ThreadPosix::ThreadPosix() { diff --git a/drivers/unix/thread_posix.h b/drivers/unix/thread_posix.h index 179d56d5bd..06a17c2ae6 100644 --- a/drivers/unix/thread_posix.h +++ b/drivers/unix/thread_posix.h @@ -55,13 +55,14 @@ class ThreadPosix : public Thread { static Thread* create_func_posix(ThreadCreateCallback p_callback,void *,const Settings&); static ID get_thread_ID_func_posix(); static void wait_to_finish_func_posix(Thread* p_thread); - + + static Error set_name_func_posix(const String& p_name); + ThreadPosix(); public: virtual ID get_ID() const; - Error set_name(const String& p_name); static void make_default(); |