diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/SCsub | 1 | ||||
-rw-r--r-- | drivers/builtin_openssl2/SCsub | 4 | ||||
-rw-r--r-- | drivers/builtin_openssl2/crypto/rand/rand_win.c | 9 | ||||
-rw-r--r-- | drivers/builtin_openssl2/openssl/dtls1.h | 3 | ||||
-rw-r--r-- | drivers/builtin_openssl2/winrt.cpp | 155 | ||||
-rw-r--r-- | drivers/builtin_openssl2/winrt_fix.patch | 64 | ||||
-rw-r--r-- | drivers/freetype/SCsub | 5 | ||||
-rw-r--r-- | drivers/freetype/winrtdef.h | 32 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 39 | ||||
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 1 | ||||
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 4 | ||||
-rw-r--r-- | drivers/gles2/shaders/material.glsl | 8 | ||||
-rw-r--r-- | drivers/png/image_loader_png.cpp | 2 | ||||
-rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 4 | ||||
-rw-r--r-- | drivers/unix/ip_unix.cpp | 15 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 2 | ||||
-rw-r--r-- | drivers/vorbis/SCsub | 4 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 25 | ||||
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 10 | ||||
-rw-r--r-- | drivers/windows/semaphore_windows.cpp | 2 |
20 files changed, 341 insertions, 48 deletions
diff --git a/drivers/SCsub b/drivers/SCsub index 79cbe50685..8243483e17 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -17,6 +17,7 @@ SConscript('gl_context/SCsub'); SConscript('pnm/SCsub'); if (env['openssl']!='no'): + env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']); env_drivers.Append(CPPFLAGS=['-DOPENSSL_ENABLED']); if (env['openssl']=="builtin"): env_drivers.Append(CPPPATH=['#drivers/builtin_openssl2']) diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub index bd0f428cfc..a28bc2922c 100644 --- a/drivers/builtin_openssl2/SCsub +++ b/drivers/builtin_openssl2/SCsub @@ -642,6 +642,7 @@ openssl_sources = [ #env.drivers_sources+=openssl_sources +env.Append(CPPPATH=["#drivers/builtin_openssl2"]) env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto"]) env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/openssl"]) env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/evp"]) @@ -650,6 +651,9 @@ env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/modes"]) #env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/store"]) env_drivers.Append(CPPFLAGS=["-DOPENSSL_NO_ASM","-DOPENSSL_THREADS","-DL_ENDIAN"]) +if "platform" in env and env["platform"] == "winrt": + openssl_sources += ['winrt.cpp'] + # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517) import os if not (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): # not Windows and not MSVC diff --git a/drivers/builtin_openssl2/crypto/rand/rand_win.c b/drivers/builtin_openssl2/crypto/rand/rand_win.c index 06670ae017..70fd52a7aa 100644 --- a/drivers/builtin_openssl2/crypto/rand/rand_win.c +++ b/drivers/builtin_openssl2/crypto/rand/rand_win.c @@ -118,8 +118,10 @@ # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0400 # endif +#ifndef WINRT_ENABLED # include <wincrypt.h> # include <tlhelp32.h> +#endif /* * Limit the time spent walking through the heap, processes, threads and @@ -161,7 +163,7 @@ typedef struct tagCURSORINFO { # define CURSOR_SHOWING 0x00000001 # endif /* CURSOR_SHOWING */ -# if !defined(OPENSSL_SYS_WINCE) +# if !defined(OPENSSL_SYS_WINCE) && !defined(WINRT_ENABLED) typedef BOOL(WINAPI *CRYPTACQUIRECONTEXTW) (HCRYPTPROV *, LPCWSTR, LPCWSTR, DWORD, DWORD); typedef BOOL(WINAPI *CRYPTGENRANDOM) (HCRYPTPROV, DWORD, BYTE *); @@ -196,6 +198,7 @@ typedef NET_API_STATUS(NET_API_FUNCTION *NETFREE) (LPBYTE); # endif /* 1 */ # endif /* !OPENSSL_SYS_WINCE */ +#if !defined(WINRT_ENABLED) int RAND_poll(void) { MEMORYSTATUS m; @@ -580,6 +583,8 @@ int RAND_poll(void) return (1); } +#endif // WINRT_ENABLED + int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) { double add_entropy = 0; @@ -682,7 +687,7 @@ static void readtimer(void) static void readscreen(void) { -# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) +# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) && !defined(WINRT_ENABLED) HDC hScrDC; /* screen DC */ HBITMAP hBitmap; /* handle for our bitmap */ BITMAP bm; /* bitmap properties */ diff --git a/drivers/builtin_openssl2/openssl/dtls1.h b/drivers/builtin_openssl2/openssl/dtls1.h index 64ad3c87d0..a58aca248d 100644 --- a/drivers/builtin_openssl2/openssl/dtls1.h +++ b/drivers/builtin_openssl2/openssl/dtls1.h @@ -81,6 +81,9 @@ # include <sys/time.h> # endif # endif +#ifdef WINRT_ENABLED +#include <winsock2.h> +#endif #ifdef __cplusplus extern "C" { diff --git a/drivers/builtin_openssl2/winrt.cpp b/drivers/builtin_openssl2/winrt.cpp new file mode 100644 index 0000000000..c3a6f8bfcc --- /dev/null +++ b/drivers/builtin_openssl2/winrt.cpp @@ -0,0 +1,155 @@ +/* Snippets extracted from https://github.com/Microsoft/openssl/blob/ec7e430e06e4e3ac87c183dee33cb216814cf980/ms/winrt.cpp + * Adapted for Godot definitions + */ +/* winrt.cpp + * Copyright 2014 Microsoft Corporation + * C++/CX Entropy/shims for Windows Phone/Windows Store platform + * written by Alejandro Jimenez Martinez + * (aljim@microsoft.com) for the OpenSSL project 2014. + */ + +#include <windows.h> +#if defined(WINAPI_FAMILY) +extern "C" +{ + unsigned entropyRT(BYTE *buffer, unsigned len); + void RAND_add(const void *buf,int num,double entropy); + int RAND_poll(void); +} +#endif + +unsigned entropyRT(BYTE *buffer, unsigned len) + { + using namespace Platform; + using namespace Windows::Foundation; + using namespace Windows::Foundation::Collections; + using namespace Windows::Security::Cryptography; + using namespace Windows::Storage::Streams; + IBuffer ^buf = CryptographicBuffer::GenerateRandom(len); + Array<unsigned char> ^arr; + CryptographicBuffer::CopyToByteArray(buf, &arr); + unsigned arrayLen = arr->Length; + + // Make sure not to overflow the copy + arrayLen = (arrayLen > len) ? len : arrayLen; + memcpy(buffer, arr->Data, arrayLen); + return arrayLen; + } + +int RAND_poll(void) + { + BYTE buf[60]; + unsigned collected = entropyRT(buf , sizeof(buf)); + RAND_add(buf, collected, collected); + return 1; + } + +#if defined(WINRT_ENABLED) +extern "C" +{ +#include<stdio.h> +#include<string.h> +#include<stdlib.h> + + void* GetModuleHandle( + _In_opt_ LPCTSTR lpModuleName + ) + { + return NULL; + } + //no log for phone + int RegisterEventSource( + _In_ LPCTSTR lpUNCServerName, + _In_ LPCTSTR lpSourceName + ) + { + return NULL; + } + + int ReportEvent( + _In_ HANDLE hEventLog, + _In_ WORD wType, + _In_ WORD wCategory, + _In_ DWORD dwEventID, + _In_ PSID lpUserSid, + _In_ WORD wNumStrings, + _In_ DWORD dwDataSize, + _In_ LPCTSTR *lpStrings, + _In_ LPVOID lpRawData + ) + { + return 0; + } + int MessageBox( + _In_opt_ HWND hWnd, + _In_opt_ LPCTSTR lpText, + _In_opt_ LPCTSTR lpCaption, + _In_ UINT uType + ) + { + return 0; + } + int __cdecl GetProcessWindowStation(void) + { + return NULL; + } + BOOL __cdecl GetUserObjectInformationW( + _In_ HANDLE hObj, + _In_ int nIndex, + _Out_opt_ PVOID pvInfo, + _In_ DWORD nLength, + _Out_opt_ LPDWORD lpnLengthNeeded + ) + { + return 0; + } + int __cdecl GetStdHandle( + _In_ DWORD nStdHandle + ) + { + return 0; + } + BOOL DeregisterEventSource( + _Inout_ HANDLE hEventLog + ) + { + return 0; + } + char *getenv( + const char *varname + ) + { + //hardcoded environmental variables used for the appx testing application for store/phone + if (!strcmp(varname, "OPENSSL_CONF")) + { + return "./openssl.cnf"; + } + return 0; + } + int setenv(const char *envname, const char *envval, int overwrite) + { + return -1; + } + int _getch(void) + { + return 0; + } + int _kbhit() + { + return 0; + } + BOOL __cdecl FlushConsoleInputBuffer( + _In_ HANDLE hConsoleInput + ) + { + return 0; + } + int winrt_GetTickCount(void) + { + LARGE_INTEGER t; + return(int) (QueryPerformanceCounter(&t) ? t.QuadPart : 0); + } + void *OPENSSL_UplinkTable [26]= {0}; +} //extern C + +#endif /*defined(WINRT_ENABLED)*/ diff --git a/drivers/builtin_openssl2/winrt_fix.patch b/drivers/builtin_openssl2/winrt_fix.patch new file mode 100644 index 0000000000..caf180a75b --- /dev/null +++ b/drivers/builtin_openssl2/winrt_fix.patch @@ -0,0 +1,64 @@ +diff --git a/drivers/builtin_openssl2/crypto/rand/rand_win.c b/drivers/builtin_openssl2/crypto/rand/rand_win.c +index 06670ae..70fd52a 100644 +--- a/drivers/builtin_openssl2/crypto/rand/rand_win.c ++++ b/drivers/builtin_openssl2/crypto/rand/rand_win.c +@@ -118,8 +118,10 @@ + # ifndef _WIN32_WINNT + # define _WIN32_WINNT 0x0400 + # endif ++#ifndef WINRT_ENABLED + # include <wincrypt.h> + # include <tlhelp32.h> ++#endif + + /* + * Limit the time spent walking through the heap, processes, threads and +@@ -161,7 +163,7 @@ typedef struct tagCURSORINFO { + # define CURSOR_SHOWING 0x00000001 + # endif /* CURSOR_SHOWING */ + +-# if !defined(OPENSSL_SYS_WINCE) ++# if !defined(OPENSSL_SYS_WINCE) && !defined(WINRT_ENABLED) + typedef BOOL(WINAPI *CRYPTACQUIRECONTEXTW) (HCRYPTPROV *, LPCWSTR, LPCWSTR, + DWORD, DWORD); + typedef BOOL(WINAPI *CRYPTGENRANDOM) (HCRYPTPROV, DWORD, BYTE *); +@@ -196,6 +198,7 @@ typedef NET_API_STATUS(NET_API_FUNCTION *NETFREE) (LPBYTE); + # endif /* 1 */ + # endif /* !OPENSSL_SYS_WINCE */ + ++#if !defined(WINRT_ENABLED) + int RAND_poll(void) + { + MEMORYSTATUS m; +@@ -580,6 +583,8 @@ int RAND_poll(void) + return (1); + } + ++#endif // WINRT_ENABLED ++ + int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) + { + double add_entropy = 0; +@@ -682,7 +687,7 @@ static void readtimer(void) + + static void readscreen(void) + { +-# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) ++# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) && !defined(WINRT_ENABLED) + HDC hScrDC; /* screen DC */ + HBITMAP hBitmap; /* handle for our bitmap */ + BITMAP bm; /* bitmap properties */ +diff --git a/drivers/builtin_openssl2/openssl/dtls1.h b/drivers/builtin_openssl2/openssl/dtls1.h +index 64ad3c8..a58aca2 100644 +--- a/drivers/builtin_openssl2/openssl/dtls1.h ++++ b/drivers/builtin_openssl2/openssl/dtls1.h +@@ -81,6 +81,9 @@ + # include <sys/time.h> + # endif + # endif ++#ifdef WINRT_ENABLED ++#include <winsock2.h> ++#endif + + #ifdef __cplusplus + extern "C" { diff --git a/drivers/freetype/SCsub b/drivers/freetype/SCsub index 0c7ab91ba2..4ddc785088 100644 --- a/drivers/freetype/SCsub +++ b/drivers/freetype/SCsub @@ -48,6 +48,11 @@ ft_sources=[\ if (env["freetype"]=="builtin"): + + # Include header for WinRT to fix build issues + if "platform" in env and env["platform"] == "winrt": + env.Append(CCFLAGS=['/FI', '"drivers/freetype/winrtdef.h"']) + # fix for Windows' shell miserably failing on long lines, split in two libraries half1=[] half2=[] diff --git a/drivers/freetype/winrtdef.h b/drivers/freetype/winrtdef.h new file mode 100644 index 0000000000..69c6baf532 --- /dev/null +++ b/drivers/freetype/winrtdef.h @@ -0,0 +1,32 @@ +/*************************************************************************/ +/* winrtdef.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +// "generic" is a reserved keyword in C++/CX code +// this avoids the errors in the variable name from Freetype code +#define generic freetype_generic diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 3809f4c7b9..aeb3d9e039 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -1998,7 +1998,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, if (use_VBO) { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=true; normalize=true; @@ -2007,7 +2006,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, } else { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLfloat); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=false; datatype=GL_FLOAT; @@ -2019,7 +2017,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, if (use_VBO) { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLubyte); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=true; datatype=GL_UNSIGNED_BYTE; @@ -2027,7 +2024,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, } else { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=false; datatype=GL_UNSIGNED_SHORT; @@ -4666,7 +4662,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { enablers.push_back("#define USE_LIGHT_SHADER_CODE\n"); } if (light_flags.uses_shadow_color) { - enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n"); } if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) { enablers.push_back("#define USE_TIME\n"); @@ -4709,7 +4705,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { enablers.push_back("#define USE_TEXPIXEL_SIZE\n"); } if (light_flags.uses_shadow_color) { - enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n"); } if (vertex_flags.uses_worldvec) { @@ -5210,7 +5206,6 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material material_shader.set_conditional(MaterialShaderGLES2::USE_FOG,current_env && current_env->fx_enabled[VS::ENV_FX_FOG]); //glDepthMask( true ); - } @@ -6778,7 +6773,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans } } - if (e->instance->billboard || e->instance->depth_scale) { + if (e->instance->billboard || e->instance->billboard_y || e->instance->depth_scale) { Transform xf=e->instance->transform; if (e->instance->depth_scale) { @@ -6809,6 +6804,21 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans xf.basis.scale(scale); } + + if (e->instance->billboard_y) { + + Vector3 scale = xf.basis.get_scale(); + Vector3 look_at = p_view_transform.get_origin(); + look_at.y = 0.0; + Vector3 look_at_norm = look_at.normalized(); + + if (current_rt && current_rt_vflip) { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, -1.0, 0.0)); + } else { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, 1.0, 0.0)); + } + xf.basis.scale(scale); + } material_shader.set_uniform(MaterialShaderGLES2::WORLD_TRANSFORM, xf); } else { @@ -7008,6 +7018,10 @@ void RasterizerGLES2::_process_glow_bloom() { void RasterizerGLES2::_process_hdr() { + if (framebuffer.luminance.empty()) { + return; + } + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, framebuffer.color ); @@ -10843,6 +10857,11 @@ void RasterizerGLES2::init() { copy_shader.set_conditional(CopyShaderGLES2::USE_GLES_OVER_GL,true); #endif +#ifdef ANGLE_ENABLED + // Fix for ANGLE + material_shader.set_conditional(MaterialShaderGLES2::DISABLE_FRONT_FACING, true); +#endif + shadow=NULL; shadow_pass=0; @@ -10930,7 +10949,11 @@ void RasterizerGLES2::init() { srgb_supported=extensions.has("GL_EXT_sRGB"); +#ifndef ANGLE_ENABLED s3tc_srgb_supported = s3tc_supported && extensions.has("GL_EXT_texture_compression_s3tc"); +#else + s3tc_srgb_supported = s3tc_supported; +#endif latc_supported = extensions.has("GL_EXT_texture_compression_latc"); anisotropic_level=1.0; use_anisotropic_filter=extensions.has("GL_EXT_texture_filter_anisotropic"); diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 3be0fdab17..d4636ed444 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -904,6 +904,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_VEC"]="light_vec"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_HEIGHT"]="light_height"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_COLOR"]="light"; + mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_SHADOW"]="light_shadow_color"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_UV"]="light_uv"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT"]="light_out"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["SHADOW"]="shadow_color"; diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 285abd30ff..5f4767940d 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -244,7 +244,7 @@ FRAGMENT_SHADER_CODE vec2 light_uv = light_uv_interp.xy; vec4 light = texture2D(light_texture,light_uv) * light_color; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) vec4 shadow_color=vec4(0.0,0.0,0.0,0.0); #endif @@ -380,7 +380,7 @@ LIGHT_SHADER_CODE #endif -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) color=mix(shadow_color,color,shadow_attenuation); #else //color*=shadow_attenuation; diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index e68949b056..477a451f2f 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -811,7 +811,11 @@ void main() { float specular_exp=1.0; float glow=0.0; float shade_param=0.0; +#ifdef DISABLE_FRONT_FACING + float side=float(1)*2.0-1.0; +#else float side=float(gl_FrontFacing)*2.0-1.0; +#endif #if defined(ENABLE_TANGENT_INTERP) vec3 binormal = normalize(binormal_interp)*side; vec3 tangent = normalize(tangent_interp)*side; @@ -1181,7 +1185,7 @@ FRAGMENT_SHADER_CODE vec3 mdiffuse = diffuse.rgb; vec3 light; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) vec3 shadow_color=vec3(0.0,0.0,0.0); #endif @@ -1205,7 +1209,7 @@ LIGHT_SHADER_CODE #endif diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation); #endif diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index e10ac7493f..4967b0f9df 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -270,7 +270,7 @@ static void user_read_data(png_structp png_ptr,png_bytep data, png_size_t p_leng PNGReadStatus *rstatus; rstatus=(PNGReadStatus*)png_get_io_ptr(png_ptr); - int to_read=p_length; + png_size_t to_read=p_length; if (rstatus->size>=0) { to_read = MIN( p_length, rstatus->size - rstatus->offset); } diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 4804bc5630..954d2c20f2 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -175,8 +175,8 @@ void AudioDriverPulseAudio::finish() { exit_thread = true; Thread::wait_to_finish(thread); - if (pulse) - pa_simple_free(pulse); + if (pulse) + pa_simple_free(pulse); if (samples_in) { memdelete_arr(samples_in); diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 535a425302..08a8c19583 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "ip_unix.h" -#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) +#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED) #ifdef WINDOWS_ENABLED @@ -83,6 +83,19 @@ IP_Address IP_Unix::_resolve_hostname(const String& p_hostname) { void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const { + using namespace Windows::Networking; + using namespace Windows::Networking::Connectivity; + + auto hostnames = NetworkInformation::GetHostNames(); + + for (int i = 0; i < hostnames->Size; i++) { + + if (hostnames->GetAt(i)->Type == HostNameType::Ipv4 && hostnames->GetAt(i)->IPInformation != nullptr) { + + r_addresses->push_back(IP_Address(String(hostnames->GetAt(i)->CanonicalName->Data()))); + + } + } }; #else diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index fd515d6dd3..271cf302ef 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -390,7 +390,7 @@ Error OS_Unix::execute(const String& p_path, const List<String>& p_arguments,boo if (p_blocking) { int status; - pid_t rpid = waitpid(pid,&status,0); + waitpid(pid,&status,0); if (r_exitcode) *r_exitcode=WEXITSTATUS(status); } else { diff --git a/drivers/vorbis/SCsub b/drivers/vorbis/SCsub index 87805cc2d8..4afafcc4ba 100644 --- a/drivers/vorbis/SCsub +++ b/drivers/vorbis/SCsub @@ -5,7 +5,7 @@ sources = [ ] sources_lib = [ - "vorbis/analysis.c", + #"vorbis/analysis.c", #"vorbis/barkmel.c", "vorbis/bitrate.c", "vorbis/block.c", @@ -27,7 +27,7 @@ sources_lib = [ "vorbis/smallft.c", "vorbis/synthesis.c", #"vorbis/tone.c", - "vorbis/vorbisenc.c", + #"vorbis/vorbisenc.c", "vorbis/vorbisfile.c", "vorbis/window.c", ] diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 90e43d2518..ad4e8f301c 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -37,12 +37,6 @@ #include <stdio.h> #include "print_string.h" -#ifdef WINRT_ENABLED -#include <Synchapi.h> -#include <collection.h> -#include <ppltasks.h> -#endif - /* [03:57] <reduz> yessopie, so i dont havemak to rely on unicows @@ -135,14 +129,6 @@ Error DirAccessWindows::change_dir(String p_dir) { GLOBAL_LOCK_FUNCTION -#ifdef WINRT_ENABLED - - p_dir = fix_path(p_dir); - current_dir = normalize_path(p_dir); - - return OK; -#else - p_dir=fix_path(p_dir); @@ -178,19 +164,12 @@ Error DirAccessWindows::change_dir(String p_dir) { //} return worked?OK:ERR_INVALID_PARAMETER; -#endif } Error DirAccessWindows::make_dir(String p_dir) { GLOBAL_LOCK_FUNCTION -#ifdef WINRT_ENABLED - - return ERR_CANT_CREATE; - -#else - if (p_dir.is_rel_path()) p_dir=get_current_dir().plus_file(p_dir); @@ -215,8 +194,6 @@ Error DirAccessWindows::make_dir(String p_dir) { }; return ERR_CANT_CREATE; - -#endif } @@ -259,7 +236,6 @@ bool DirAccessWindows::file_exists(String p_file) { return false; return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY); - } bool DirAccessWindows::dir_exists(String p_dir) { @@ -282,7 +258,6 @@ bool DirAccessWindows::dir_exists(String p_dir) { if (INVALID_FILE_ATTRIBUTES == fileAttr) return false; return (fileAttr&FILE_ATTRIBUTE_DIRECTORY); - } Error DirAccessWindows::rename(String p_path,String p_new_path) { diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 3f27068fb2..36dcab1d67 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -124,7 +124,16 @@ void FileAccessWindows::close() { bool rename_error; + +#ifdef WINRT_ENABLED + // WinRT has no PathFileExists, so we check attributes instead + DWORD fileAttr; + + fileAttr = GetFileAttributesW(save_path.c_str()); + if (INVALID_FILE_ATTRIBUTES == fileAttr) { +#else if (!PathFileExistsW(save_path.c_str())) { +#endif //creating new file rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str())!=0; } else { @@ -139,7 +148,6 @@ void FileAccessWindows::close() { ERR_FAIL_COND( rename_error ); } - } bool FileAccessWindows::is_open() const { diff --git a/drivers/windows/semaphore_windows.cpp b/drivers/windows/semaphore_windows.cpp index 74094f482a..8d11d1b1c1 100644 --- a/drivers/windows/semaphore_windows.cpp +++ b/drivers/windows/semaphore_windows.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "semaphore_windows.h" -#if defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) +#if defined(WINDOWS_ENABLED) #include "os/memory.h" |