summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/SCsub185
-rw-r--r--drivers/chibi/cp_player_data_control.cpp4
-rw-r--r--drivers/convex_decomp/b2Polygon.cpp1
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp61
-rw-r--r--drivers/gles2/shader_compiler_gles2.h7
-rw-r--r--drivers/theoraplayer/video_stream_theoraplayer.cpp2
-rw-r--r--drivers/windows/dir_access_windows.cpp1
7 files changed, 163 insertions, 98 deletions
diff --git a/drivers/SCsub b/drivers/SCsub
index a1a2191cbc..6ab0973625 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -1,91 +1,94 @@
-Import('env')
-
-env.drivers_sources=[]
-#env.add_source_files(env.drivers_sources,"*.cpp")
-env.Append(CPPPATH=["vorbis"])
-Export('env')
-
-SConscript('unix/SCsub');
-SConscript('alsa/SCsub');
-SConscript('pulseaudio/SCsub');
-SConscript('windows/SCsub');
-SConscript('gles2/SCsub');
-SConscript('gl_context/SCsub');
-SConscript('openssl/SCsub');
-
-if (env["png"]=="yes"):
- SConscript("png/SCsub");
-if (env["jpg"]=="yes"):
- SConscript("jpg/SCsub");
-if (env["webp"]=="yes"):
- SConscript("webp/SCsub");
-SConscript("dds/SCsub");
-SConscript("pvr/SCsub");
-SConscript("etc1/SCsub")
-if (env["builtin_zlib"]=="yes"):
- SConscript("builtin_zlib/SCsub");
-if (env["openssl"]=="builtin"):
- SConscript("builtin_openssl2/SCsub");
-
-SConscript("rtaudio/SCsub");
-SConscript("nedmalloc/SCsub");
-SConscript("trex/SCsub");
-SConscript("chibi/SCsub");
-if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theora"]=="yes"):
- SConscript("ogg/SCsub");
-if (env["vorbis"]=="yes"):
- SConscript("vorbis/SCsub");
-if (env["tools"]=="yes"):
- SConscript("convex_decomp/SCsub");
-
-if env["theora"]=="yes":
- SConscript("theoraplayer/SCsub")
-if (env["theora"]=="yes"):
- SConscript("theora/SCsub");
-if (env['speex']=='yes'):
- SConscript("speex/SCsub");
-if (env['musepack']=='yes'):
- SConscript("mpc/SCsub");
-if (env["squish"]=="yes" and env["tools"]=="yes"):
- SConscript("squish/SCsub");
-
-num = 0
-cur_base = ""
-total = len(env.drivers_sources)
-max_src = 64
-list = []
-lib_list = []
-
-import string
-
-for f in env.drivers_sources:
- fname = ""
- if type(f) == type(""):
- fname = env.File(f).path
- else:
- fname = env.File(f)[0].path
- #base = string.join(fname.split("/")[:-1], "/")
- fname = fname.replace("\\", "/")
- base = string.join(fname.split("/")[:2], "/")
- if base != cur_base and len(list) > max_src:
- lib = env.Library("drivers"+str(num), list)
- lib_list.append(lib)
- list = []
- num = num+1
- cur_base = base
- list.append(f)
-
-if len(list) > 0:
- lib = env.Library("drivers"+str(num), list)
- lib_list.append(lib)
-
-
-drivers_base=[]
-env.add_source_files(drivers_base,"*.cpp")
-lib_list.insert(0, env.Library("drivers", drivers_base))
-
-env.Prepend(LIBS=lib_list)
-
-#lib = env.Library("drivers",env.drivers_sources)
-#env.Prepend(LIBS=[lib])
-
+Import('env')
+
+env.drivers_sources=[]
+#env.add_source_files(env.drivers_sources,"*.cpp")
+env.Append(CPPPATH=["vorbis"])
+Export('env')
+
+SConscript('unix/SCsub');
+SConscript('alsa/SCsub');
+SConscript('pulseaudio/SCsub');
+SConscript('windows/SCsub');
+SConscript('gles2/SCsub');
+SConscript('gl_context/SCsub');
+SConscript('openssl/SCsub');
+
+if (env["png"]=="yes"):
+ SConscript("png/SCsub");
+if (env["jpg"]=="yes"):
+ SConscript("jpg/SCsub");
+if (env["webp"]=="yes"):
+ SConscript("webp/SCsub");
+SConscript("dds/SCsub");
+SConscript("pvr/SCsub");
+SConscript("etc1/SCsub")
+if (env["builtin_zlib"]=="yes"):
+ SConscript("builtin_zlib/SCsub");
+if (env["openssl"]=="builtin"):
+ SConscript("builtin_openssl2/SCsub");
+
+SConscript("rtaudio/SCsub");
+SConscript("nedmalloc/SCsub");
+SConscript("trex/SCsub");
+SConscript("chibi/SCsub");
+if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theora"]=="yes"):
+ SConscript("ogg/SCsub");
+if (env["vorbis"]=="yes"):
+ SConscript("vorbis/SCsub");
+if (env["tools"]=="yes"):
+ SConscript("convex_decomp/SCsub");
+
+if env["theora"]=="yes":
+ SConscript("theoraplayer/SCsub")
+if (env["theora"]=="yes"):
+ SConscript("theora/SCsub");
+if (env['speex']=='yes'):
+ SConscript("speex/SCsub");
+if (env['musepack']=='yes'):
+ SConscript("mpc/SCsub");
+if (env["squish"]=="yes" and env["tools"]=="yes"):
+ SConscript("squish/SCsub");
+
+num = 0
+cur_base = ""
+total = len(env.drivers_sources)
+max_src = 64
+list = []
+lib_list = []
+
+import string
+
+if env['vsproj']=="yes":
+ env.AddToVSProject(env.drivers_sources)
+
+for f in env.drivers_sources:
+ fname = ""
+ if type(f) == type(""):
+ fname = env.File(f).path
+ else:
+ fname = env.File(f)[0].path
+ #base = string.join(fname.split("/")[:-1], "/")
+ fname = fname.replace("\\", "/")
+ base = string.join(fname.split("/")[:2], "/")
+ if base != cur_base and len(list) > max_src:
+ lib = env.Library("drivers"+str(num), list)
+ lib_list.append(lib)
+ list = []
+ num = num+1
+ cur_base = base
+ list.append(f)
+
+if len(list) > 0:
+ lib = env.Library("drivers"+str(num), list)
+ lib_list.append(lib)
+
+
+drivers_base=[]
+env.add_source_files(drivers_base,"*.cpp")
+lib_list.insert(0, env.Library("drivers", drivers_base))
+
+env.Prepend(LIBS=lib_list)
+
+#lib = env.Library("drivers",env.drivers_sources)
+#env.Prepend(LIBS=[lib])
+
diff --git a/drivers/chibi/cp_player_data_control.cpp b/drivers/chibi/cp_player_data_control.cpp
index 4d30c1a703..d5ca648fff 100644
--- a/drivers/chibi/cp_player_data_control.cpp
+++ b/drivers/chibi/cp_player_data_control.cpp
@@ -233,7 +233,7 @@ int CPPlayer::get_channel_voice(int p_channel) {
const char* CPPlayer::get_voice_sample_name(int p_voice) {
- const char *name;
+ const char *name = NULL;
@@ -302,7 +302,7 @@ const char * CPPlayer::get_voice_instrument_name(int p_voice) {
- const char *name;
+ const char *name = NULL;
diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp
index 49a3e74c2a..668313967e 100644
--- a/drivers/convex_decomp/b2Polygon.cpp
+++ b/drivers/convex_decomp/b2Polygon.cpp
@@ -970,6 +970,7 @@ int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys) {
}
if (nTri < 1) {
//Still no luck? Oh well...
+ delete[] triangulated;
return -1;
}
int32 nPolys = PolygonizeTriangles(triangulated, nTri, results, maxPolys);
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 10da30acca..157f2e398b 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -431,6 +431,42 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
// code="get_texpos(gl_ProjectionMatrixInverse * texture2D( depth_texture, clamp(("+dump_node_code(onode->arguments[1],p_level)+").xy,vec2(0.0),vec2(1.0))*gl_LightSource[5].specular.zw+gl_LightSource[5].specular.xy)";
//code="(texture2D( screen_texture, ("+dump_node_code(onode->arguments[1],p_level)+").xy).rgb";
break;
+ } else if (custom_h && callfunc=="cosh_custom") {
+
+ if (!cosh_used) {
+ global_code= "float cosh_custom(float val)\n"\
+ "{\n"\
+ " float tmp = exp(val);\n"\
+ " float cosH = (tmp + 1.0 / tmp) / 2.0;\n"\
+ " return cosH;\n"\
+ "}\n"+global_code;
+ cosh_used=true;
+ }
+ code="cosh_custom("+dump_node_code(onode->arguments[1],p_level)+"";
+ } else if (custom_h && callfunc=="sinh_custom") {
+
+ if (!sinh_used) {
+ global_code= "float sinh_custom(float val)\n"\
+ "{\n"\
+ " float tmp = exp(val);\n"\
+ " float sinH = (tmp - 1.0 / tmp) / 2.0;\n"\
+ " return sinH;\n"\
+ "}\n"+global_code;
+ sinh_used=true;
+ }
+ code="sinh_custom("+dump_node_code(onode->arguments[1],p_level)+"";
+ } else if (custom_h && callfunc=="tanh_custom") {
+
+ if (!tanh_used) {
+ global_code= "float tanh_custom(float val)\n"\
+ "{\n"\
+ " float tmp = exp(val);\n"\
+ " float tanH = (tmp - 1.0 / tmp) / (tmp + 1.0 / tmp);\n"\
+ " return tanH;\n"\
+ "}\n"+global_code;
+ tanh_used=true;
+ }
+ code="tanh_custom("+dump_node_code(onode->arguments[1],p_level)+"";
} else {
@@ -634,6 +670,9 @@ Error ShaderCompilerGLES2::compile(const String& p_code, ShaderLanguage::ShaderT
r_flags.use_var2_interp=false;
r_flags.uses_normalmap=false;
r_flags.uses_normal=false;
+ sinh_used=false;
+ tanh_used=false;
+ cosh_used=false;
String error;
int errline,errcol;
@@ -662,12 +701,18 @@ Error ShaderCompilerGLES2::compile(const String& p_code, ShaderLanguage::ShaderT
r_flags.uses_shadow_color=uses_shadow_color;
r_code_line=code;
r_globals_line=global_code;
-
return OK;
}
ShaderCompilerGLES2::ShaderCompilerGLES2() {
+#ifdef GLEW_ENABLED
+ //use custom functions because they are not supported in GLSL120
+ custom_h=true;
+#else
+ custom_h=false;
+#endif
+
replace_table["bool"]= "bool";
replace_table["float" ]= "float";
replace_table["vec2" ]= "vec2";
@@ -686,9 +731,17 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
replace_table["acos" ]= "acos";
replace_table["atan" ]= "atan";
replace_table["atan2"]= "atan";
- replace_table["sinh" ]= "sinh";
- replace_table["cosh" ]= "cosh";
- replace_table["tanh" ]= "tanh";
+
+ if (custom_h) {
+ replace_table["sinh" ]= "sinh_custom";
+ replace_table["cosh" ]= "cosh_custom";
+ replace_table["tanh" ]= "tanh_custom";
+ } else {
+ replace_table["sinh" ]= "sinh";
+ replace_table["cosh" ]= "cosh";
+ replace_table["tanh" ]= "tanh";
+ }
+
replace_table["pow" ]= "pow";
replace_table["exp" ]= "exp";
replace_table["log" ]= "log";
diff --git a/drivers/gles2/shader_compiler_gles2.h b/drivers/gles2/shader_compiler_gles2.h
index 6dfc213994..43902a7536 100644
--- a/drivers/gles2/shader_compiler_gles2.h
+++ b/drivers/gles2/shader_compiler_gles2.h
@@ -56,6 +56,13 @@ private:
bool uses_worldvec;
bool vertex_code_writes_vertex;
bool uses_shadow_color;
+
+ bool sinh_used;
+ bool tanh_used;
+ bool cosh_used;
+
+ bool custom_h;
+
Flags *flags;
StringName vname_discard;
diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp
index ecafda9d84..ef1f5651ab 100644
--- a/drivers/theoraplayer/video_stream_theoraplayer.cpp
+++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp
@@ -388,7 +388,7 @@ void VideoStreamTheoraplayer::pop_frame(Ref<ImageTexture> p_tex) {
{
DVector<uint8_t>::Write wr = data.write();
uint8_t* ptr = wr.ptr();
- memcpy(ptr, f->getBuffer(), imgsize);
+ copymem(ptr, f->getBuffer(), imgsize);
}
/*
for (int i=0; i<h; i++) {
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index a8fed91d94..f548beaa38 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -167,6 +167,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
if (worked) {
+
GetCurrentDirectoryW(2048,real_current_dir_name);
current_dir=real_current_dir_name; // TODO, utf8 parser
current_dir=current_dir.replace("\\","/");