diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/shaders/copy.glsl | 4 | ||||
-rw-r--r-- | drivers/unix/file_access_unix.cpp | 13 | ||||
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 14 |
3 files changed, 24 insertions, 7 deletions
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index 232b9ce7c0..1952e201aa 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -165,11 +165,11 @@ void main() { #elif defined(USE_ASYM_PANO) // When an asymmetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result. - // Note that we're ignoring the x-offset for IPD, with Z sufficiently in the distance it becomes neglectible, as a result we could probably just set cube_normal.z to -1. + // Asymmetrical projection means the center of projection is no longer in the center of the screen but shifted. // The Matrix[2][0] (= asym_proj.x) and Matrix[2][1] (= asym_proj.z) values are what provide the right shift in the image. vec3 cube_normal; - cube_normal.z = -1000000.0; + cube_normal.z = -1.0; cube_normal.x = (cube_normal.z * (-uv_interp.x - asym_proj.x)) / asym_proj.y; cube_normal.y = (cube_normal.z * (-uv_interp.y - asym_proj.z)) / asym_proj.a; cube_normal = mat3(sky_transform) * mat3(pano_transform) * cube_normal; diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 5820a59019..071734eb48 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -38,6 +38,8 @@ #include <sys/stat.h> #include <sys/types.h> +#include <errno.h> + #if defined(UNIX_ENABLED) #include <unistd.h> #endif @@ -112,8 +114,15 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) { f = fopen(path.utf8().get_data(), mode_string); if (f == NULL) { - last_error = ERR_FILE_CANT_OPEN; - return ERR_FILE_CANT_OPEN; + switch (errno) { + case ENOENT: { + last_error = ERR_FILE_NOT_FOUND; + } break; + default: { + last_error = ERR_FILE_CANT_OPEN; + } break; + } + return last_error; } else { last_error = OK; flags = p_mode_flags; diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index c12a2d75a8..fb21c0c5a1 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -38,6 +38,7 @@ #include <shlwapi.h> #include <windows.h> +#include <errno.h> #include <sys/stat.h> #include <sys/types.h> #include <tchar.h> @@ -114,11 +115,18 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { path = path + ".tmp"; } - _wfopen_s(&f, path.c_str(), mode_string); + errno_t errcode = _wfopen_s(&f, path.c_str(), mode_string); if (f == NULL) { - last_error = ERR_FILE_CANT_OPEN; - return ERR_FILE_CANT_OPEN; + switch (errcode) { + case ENOENT: { + last_error = ERR_FILE_NOT_FOUND; + } break; + default: { + last_error = ERR_FILE_CANT_OPEN; + } break; + } + return last_error; } else { last_error = OK; flags = p_mode_flags; |