summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/SCsub2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp27
-rw-r--r--drivers/png/image_loader_png.cpp7
-rw-r--r--drivers/register_driver_types.cpp1
-rw-r--r--drivers/theora/video_stream_theora.cpp32
-rw-r--r--drivers/theora/video_stream_theora.h2
-rw-r--r--drivers/unix/memory_pool_static_malloc.cpp2
-rw-r--r--drivers/unix/thread_posix.cpp17
-rw-r--r--drivers/unix/thread_posix.h5
9 files changed, 66 insertions, 29 deletions
diff --git a/drivers/SCsub b/drivers/SCsub
index a00d7fc3f9..701738c9f8 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -63,7 +63,7 @@ import string
if env['vsproj']=="yes":
env.AddToVSProject(env.drivers_sources)
-if (False): #split drivers, this used to be needed for windows until separate builders for windows were created
+if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created
for f in env.drivers_sources:
fname = ""
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index f0978228ff..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);
@@ -9260,7 +9262,13 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater
glReadBuffer(GL_BACK);
}
#endif
- glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
+ if (current_rt) {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height);
+ canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(viewport.y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height));
+ //window_size.height-(viewport.height+viewport.y)
+ } else {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
+ }
// if (current_clip) {
// // print_line(" a clip ");
// }
@@ -9457,7 +9465,12 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
glReadBuffer(GL_BACK);
}
#endif
- glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,w,h);
+ if (current_rt) {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height);
+ //window_size.height-(viewport.height+viewport.y)
+ } else {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
+ }
// if (current_clip) {
// // print_line(" a clip ");
// }
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index a86e747d80..50b26d601a 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -124,6 +124,13 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image)
png_read_update_info(png, info);
}
+ if (png_get_valid(png,info,PNG_INFO_tRNS)) {
+// png_set_expand_gray_1_2_4_to_8(png);
+ png_set_tRNS_to_alpha(png);
+ png_read_update_info(png, info);
+ png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL);
+ }
+
int palette_colors = 0;
int palette_components = 0;
int components = 0;
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 0659f007e5..e577c3f932 100644
--- a/drivers/theora/video_stream_theora.cpp
+++ b/drivers/theora/video_stream_theora.cpp
@@ -38,8 +38,16 @@ int VideoStreamPlaybackTheora:: buffer_data() {
}
int VideoStreamPlaybackTheora::queue_page(ogg_page *page){
- if(theora_p)ogg_stream_pagein(&to,page);
- if(vorbis_p)ogg_stream_pagein(&vo,page);
+ if(theora_p) {
+ ogg_stream_pagein(&to,page);
+ if (to.e_o_s)
+ theora_eos=true;
+ }
+ if(vorbis_p) {
+ ogg_stream_pagein(&vo,page);
+ if (vo.e_o_s)
+ vorbis_eos=true;
+ }
return 0;
}
@@ -238,6 +246,8 @@ void VideoStreamPlaybackTheora::clear() {
videobuf_ready = 0;
frames_pending = 0;
videobuf_time = 0;
+ theora_eos=false;
+ vorbis_eos=false;
if (file) {
memdelete(file);
@@ -281,6 +291,9 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) {
th_comment_init(&tc);
th_info_init(&ti);
+ theora_eos=false;
+ vorbis_eos=false;
+
/* Ogg file open; parse the headers */
/* Only interested in Vorbis/Theora streams */
int stateflag = 0;
@@ -476,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;
@@ -499,7 +515,9 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
bool frame_done=false;
bool audio_done=false;
- while (!frame_done || !audio_done) {
+ bool theora_done=false;
+
+ while (!frame_done || (!audio_done && !vorbis_eos)) {
//a frame needs to be produced
ogg_packet op;
@@ -641,10 +659,14 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
break;
}
}
+
+
+ //print_line("no theora: "+itos(no_theora)+" theora eos: "+itos(theora_eos)+" frame done "+itos(frame_done));
+
#ifdef THEORA_USE_THREAD_STREAMING
- if (file && thread_eof && (no_vorbis || no_theora) && ring_buffer.data_left()==0) {
+ if (file && thread_eof && no_theora && theora_eos && ring_buffer.data_left()==0) {
#else
- if (file && /*!videobuf_ready && */ (no_vorbis || no_theora) && file->eof_reached()) {
+ if (file && /*!videobuf_ready && */ no_theora && theora_eos) {
#endif
printf("video done, stopping\n");
stop();
diff --git a/drivers/theora/video_stream_theora.h b/drivers/theora/video_stream_theora.h
index 3e144c0125..f07acb2935 100644
--- a/drivers/theora/video_stream_theora.h
+++ b/drivers/theora/video_stream_theora.h
@@ -36,6 +36,8 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
void video_write(void);
float get_time() const;
+ bool theora_eos;
+ bool vorbis_eos;
ogg_sync_state oy;
ogg_page og;
diff --git a/drivers/unix/memory_pool_static_malloc.cpp b/drivers/unix/memory_pool_static_malloc.cpp
index 1a79272dc1..e75b682c19 100644
--- a/drivers/unix/memory_pool_static_malloc.cpp
+++ b/drivers/unix/memory_pool_static_malloc.cpp
@@ -321,7 +321,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();