summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/shaders/canvas.glsl15
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp16
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h13
-rw-r--r--drivers/gles3/shaders/scene.glsl4
-rw-r--r--drivers/unix/dir_access_unix.cpp4
-rw-r--r--drivers/unix/dir_access_unix.h3
-rw-r--r--drivers/windows/dir_access_windows.cpp29
-rw-r--r--drivers/windows/dir_access_windows.h3
-rw-r--r--drivers/windows/thread_windows.cpp11
9 files changed, 60 insertions, 38 deletions
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 0de60d7421..d483659e4d 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -433,19 +433,14 @@ FRAGMENT_SHADER_CODE
#ifdef SHADOW_USE_GRADIENT
-#define SHADOW_TEST(m_ofs) \
- { \
- highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
- shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); \
- }
+ /* clang-format off */
+ /* GLSL es 100 doesn't support line continuation characters(backslashes) */
+#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); }
#else
-#define SHADOW_TEST(m_ofs) \
- { \
- highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
- shadow_attenuation += step(sz, sd); \
- }
+#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); shadow_attenuation += step(sz, sd); }
+ /* clang-format on */
#endif
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index d53b27eb88..1fba8535d8 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -2677,13 +2677,6 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
-// Drop -O3 for this function as it triggers a GCC bug up until at least GCC 8.2.1.
-// This refers to GH issue #19633.
-// The bug has been reported to the GCC project.
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC push_options
-#pragma GCC optimize("-O2")
-#endif
void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows) {
LightInstance *li = directional_lights[p_index];
@@ -2784,7 +2777,7 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform
CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[j].camera * modelview;
- store_camera(shadow_mtx, &ubo_data.shadow_matrix1[16 * j]);
+ store_camera(shadow_mtx, &ubo_data.shadow.matrix[16 * j]);
ubo_data.light_clamp[0] = atlas_rect.position.x;
ubo_data.light_clamp[1] = atlas_rect.position.y;
@@ -2801,9 +2794,6 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform
glBindBufferBase(GL_UNIFORM_BUFFER, 3, state.directional_ubo);
}
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC pop_options
-#endif
void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_shadow_atlas) {
@@ -2898,7 +2888,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
Transform proj = (p_camera_inverse_transform * li->transform).inverse();
- store_transform(proj, ubo_data.shadow_matrix1);
+ store_transform(proj, ubo_data.shadow.matrix1);
ubo_data.light_params[3] = 1.0; //means it has shadow
ubo_data.light_clamp[0] = float(x) / atlas_size;
@@ -2987,7 +2977,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[0].camera * modelview;
- store_camera(shadow_mtx, ubo_data.shadow_matrix1);
+ store_camera(shadow_mtx, ubo_data.shadow.matrix1);
}
li->light_index = state.spot_light_count;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 9772b5dd23..325617745a 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -569,10 +569,15 @@ public:
float light_params[4]; //spot attenuation, spot angle, specular, shadow enabled
float light_clamp[4];
float light_shadow_color_contact[4];
- float shadow_matrix1[16]; //up to here for spot and omni, rest is for directional
- float shadow_matrix2[16];
- float shadow_matrix3[16];
- float shadow_matrix4[16];
+ union {
+ struct {
+ float matrix1[16]; //up to here for spot and omni, rest is for directional
+ float matrix2[16];
+ float matrix3[16];
+ float matrix4[16];
+ };
+ float matrix[4 * 16];
+ } shadow;
float shadow_split_offsets[4];
};
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 86aac2801a..1a8ad5e1ef 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -165,10 +165,8 @@ uniform int spot_light_count;
out vec4 diffuse_light_interp;
out vec4 specular_light_interp;
-
void light_compute(vec3 N, vec3 L, vec3 V, vec3 light_color, float roughness, inout vec3 diffuse, inout vec3 specular) {
-
float NdotL = dot(N, L);
float cNdotL = max(NdotL, 0.0); // clamped NdotL
float NdotV = dot(N, V);
@@ -225,8 +223,6 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 light_color, float roughness, in
specular += specular_brdf_NL * light_color * (1.0 / M_PI);
}
-
-
}
void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) {
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 7284226ae7..e011176806 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -407,6 +407,10 @@ size_t DirAccessUnix::get_space_left() {
#endif
};
+String DirAccessUnix::get_filesystem_type() const {
+ return ""; //TODO this should be implemented
+}
+
DirAccessUnix::DirAccessUnix() {
dir_stream = 0;
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index 4da7e42b64..b85ae719ff 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -82,6 +82,9 @@ public:
virtual size_t get_space_left();
+ virtual String get_filesystem_type() const;
+
+
DirAccessUnix();
~DirAccessUnix();
};
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index c20f707684..c32e063736 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -346,6 +346,35 @@ size_t DirAccessWindows::get_space_left() {
return (size_t)bytes;
}
+String DirAccessWindows::get_filesystem_type() const {
+ String path = fix_path(const_cast<DirAccessWindows*>(this)->get_current_dir());
+ print_line("fixed path: "+path);
+ int unit_end = path.find(":");
+ ERR_FAIL_COND_V(unit_end==-1,String());
+ String unit = path.substr(0,unit_end+1) + "\\";
+ print_line("unit: "+unit);
+
+ TCHAR szVolumeName[100] = "";
+ TCHAR szFileSystemName[10] = "";
+ DWORD dwSerialNumber = 0;
+ DWORD dwMaxFileNameLength = 0;
+ DWORD dwFileSystemFlags = 0;
+
+ if(::GetVolumeInformation(unit.utf8().get_data(),
+ szVolumeName,
+ sizeof(szVolumeName),
+ &dwSerialNumber,
+ &dwMaxFileNameLength,
+ &dwFileSystemFlags,
+ szFileSystemName,
+ sizeof(szFileSystemName)) == TRUE) {
+
+ return String(szFileSystemName);
+ }
+
+ ERR_FAIL_V("");
+}
+
DirAccessWindows::DirAccessWindows() {
p = memnew(DirAccessWindowsPrivate);
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index 2e2d23f4e2..b8599d5c26 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -82,6 +82,9 @@ public:
//virtual FileType get_file_type() const;
size_t get_space_left();
+ virtual String get_filesystem_type() const;
+
+
DirAccessWindows();
~DirAccessWindows();
};
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index 1bcd5a10d4..8a2992e0c2 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -52,6 +52,7 @@ DWORD ThreadWindows::thread_callback(LPVOID userdata) {
t->id = (ID)GetCurrentThreadId(); // must implement
t->callback(t->user);
+ SetEvent(t->handle);
ScriptServer::thread_exit();
@@ -63,13 +64,9 @@ Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void
ThreadWindows *tr = memnew(ThreadWindows);
tr->callback = p_callback;
tr->user = p_user;
- tr->handle = CreateThread(
- NULL, // default security attributes
- 0, // use default stack size
- thread_callback, // thread function name
- tr, // argument to thread function
- 0, // use default creation flags
- NULL); // returns the thread identifier
+ tr->handle = CreateEvent(NULL, TRUE, FALSE, NULL);
+
+ QueueUserWorkItem(thread_callback, tr, WT_EXECUTELONGFUNCTION);
return tr;
}