Merge branch 'nazara-next' into graphics-next
This commit is contained in:
commit
2ef772cec7
|
|
@ -158,7 +158,8 @@ function NazaraBuild:Execute()
|
|||
"../include",
|
||||
"../src/"
|
||||
})
|
||||
sysincludedirs("../thirdparty/include")
|
||||
|
||||
sysincludedirs("../thirdparty/include", "/usr/local/include/")
|
||||
|
||||
files(moduleTable.Files)
|
||||
excludes(moduleTable.FilesExcluded)
|
||||
|
|
@ -173,6 +174,14 @@ function NazaraBuild:Execute()
|
|||
"../thirdparty/lib/common",
|
||||
"../lib"
|
||||
})
|
||||
|
||||
if (os.ishost("macosx")) then
|
||||
libdirs({
|
||||
"../thirdparty/lib/common",
|
||||
"../lib",
|
||||
"/usr/local/lib" --brew
|
||||
})
|
||||
end
|
||||
|
||||
-- Output to lib/conf/arch
|
||||
self:FilterLibDirectory("../lib/", targetdir)
|
||||
|
|
@ -932,7 +941,10 @@ end
|
|||
|
||||
function NazaraBuild:PostconfigGenericProject()
|
||||
-- Add options required for C++17 thread and filesystem (have to be linked last)
|
||||
filter("action:gmake*")
|
||||
filter({"action:gmake*", "system:macosx"})
|
||||
links("pthread")
|
||||
|
||||
filter({"action:gmake*", "system:not macosx"})
|
||||
links("stdc++fs")
|
||||
links("pthread")
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,10 @@ MODULE.Custom = function()
|
|||
|
||||
filter({"architecture:x86", "system:linux"})
|
||||
defines("_POSIX_VER")
|
||||
|
||||
filter({"architecture:x86_64", "system:macosx"})
|
||||
defines("_POSIX_VER_64")
|
||||
|
||||
filter({"architecture:x86", "system:macosx"})
|
||||
defines("_POSIX_VER")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,11 +21,15 @@ MODULE.OsDefines.Windows = {
|
|||
"SDL_VIDEO_DRIVER_WINDOWS=1"
|
||||
}
|
||||
|
||||
MODULE.OsDefines.Posix = {
|
||||
"SDL_VIDEO_DRIVER_X11=1",
|
||||
"SDL_VIDEO_DRIVER_WAYLAND=1",
|
||||
}
|
||||
|
||||
MODULE.DynLib = {
|
||||
"SDL2"
|
||||
}
|
||||
|
||||
MODULE.Custom = function()
|
||||
filter("system:linux")
|
||||
defines("SDL_VIDEO_DRIVER_X11=1")
|
||||
defines("SDL_VIDEO_DRIVER_WAYLAND=1")
|
||||
|
||||
filter("system:macosx")
|
||||
defines("SDL_VIDEO_DRIVER_COCOA=1")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace Nz
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef NAZARA_PLATFORM_POSIX
|
||||
#ifdef NAZARA_PLATFORM_LINUX
|
||||
template<typename T>
|
||||
void SinCos(std::enable_if_t<!std::is_same<T, float>::value && !std::is_same<T, long double>::value, double> x, T* sin, T* cos)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Loader.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ namespace Nz
|
|||
inline GLenum ToOpenGL(GL::BufferTarget bufferTarget);
|
||||
inline GLenum ToOpenGL(GL::TextureTarget bufferTarget);
|
||||
|
||||
//NAZARA_OPENGLRENDERER_API std::string TranslateOpenGLError(GLenum code);
|
||||
NAZARA_OPENGLRENDERER_API std::string TranslateOpenGLError(GLenum code);
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/Utils.inl>
|
||||
|
|
|
|||
|
|
@ -121,9 +121,12 @@
|
|||
|
||||
#define NAZARA_EXPORT __attribute__((visibility ("default")))
|
||||
#define NAZARA_IMPORT __attribute__((visibility ("default")))
|
||||
/*#elif defined(__APPLE__) && defined(__MACH__)
|
||||
#define NAZARA_PLATFORM_MACOSX
|
||||
#define NAZARA_PLATFORM_POSIX*/
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
#define NAZARA_PLATFORM_MACOSX
|
||||
#define NAZARA_PLATFORM_POSIX
|
||||
|
||||
#define NAZARA_EXPORT __attribute__((visibility ("default")))
|
||||
#define NAZARA_IMPORT __attribute__((visibility ("default")))
|
||||
#else
|
||||
#error This operating system is not fully supported by the Nazara Engine
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,11 @@ namespace Nz
|
|||
"libopenal.so.0",
|
||||
"libopenal.so"
|
||||
};
|
||||
//#elif defined(NAZARA_PLATFORM_MACOSX)
|
||||
#elif defined(NAZARA_PLATFORM_MACOSX)
|
||||
const char* libs[] = {
|
||||
"libopenal.dylib",
|
||||
"libopenal.1.dylib",
|
||||
};
|
||||
#else
|
||||
NazaraError("Unknown OS");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ namespace Nz
|
|||
{
|
||||
if (!m_endOfFileUpdated)
|
||||
{
|
||||
struct stat64 fileSize;
|
||||
if (fstat64(m_fileDescriptor, &fileSize) == -1)
|
||||
struct Stat fileSize;
|
||||
if (Fstat(m_fileDescriptor, &fileSize) == -1)
|
||||
fileSize.st_size = 0;
|
||||
|
||||
m_endOfFile = (GetCursorPos() >= static_cast<UInt64>(fileSize.st_size));
|
||||
|
|
@ -50,7 +50,7 @@ namespace Nz
|
|||
|
||||
UInt64 FileImpl::GetCursorPos() const
|
||||
{
|
||||
off64_t position = lseek64(m_fileDescriptor, 0, SEEK_CUR);
|
||||
Off_t position = Lseek(m_fileDescriptor, 0, SEEK_CUR);
|
||||
return static_cast<UInt64>(position);
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ namespace Nz
|
|||
if (mode & OpenMode_Truncate)
|
||||
flags |= O_TRUNC;
|
||||
|
||||
int fileDescriptor = open64(filePath.generic_u8string().data(), flags, permissions);
|
||||
int fileDescriptor = Open_def(filePath.generic_u8string().data(), flags, permissions);
|
||||
if (fileDescriptor == -1)
|
||||
{
|
||||
NazaraError("Failed to open \"" + filePath.generic_u8string() + "\" : " + Error::GetLastSystemError());
|
||||
|
|
@ -166,12 +166,12 @@ namespace Nz
|
|||
|
||||
m_endOfFileUpdated = false;
|
||||
|
||||
return lseek64(m_fileDescriptor, offset, moveMethod) != -1;
|
||||
return Lseek(m_fileDescriptor, offset, moveMethod) != -1;
|
||||
}
|
||||
|
||||
bool FileImpl::SetSize(UInt64 size)
|
||||
{
|
||||
return ftruncate64(m_fileDescriptor, size) != 0;
|
||||
return Ftruncate(m_fileDescriptor, size) != 0;
|
||||
}
|
||||
|
||||
std::size_t FileImpl::Write(const void* buffer, std::size_t size)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,24 @@
|
|||
#include <ctime>
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_MACOSX)
|
||||
#define Stat stat
|
||||
#define Fstat fstat
|
||||
#define Off_t off_t
|
||||
#define Lseek lseek
|
||||
#define Open_def open
|
||||
#define Ftruncate ftruncate
|
||||
#elif defined(NAZARA_PLATFORM_LINUX)
|
||||
#define Stat stat64
|
||||
#define Fstat fstat64
|
||||
#define Off_t off64_t
|
||||
#define Lseek lseek64
|
||||
#define Open_def open64
|
||||
#define Ftruncate ftruncate64
|
||||
#else
|
||||
#error This operating system is not fully supported by the Nazara Engine
|
||||
#endif
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class File;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
#include <Nazara/Core/Functor.hpp>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_MACOSX)
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
bool TaskSchedulerImpl::Initialize(unsigned int workerCount)
|
||||
|
|
@ -191,4 +195,55 @@ namespace Nz
|
|||
pthread_cond_t TaskSchedulerImpl::s_cvEmpty;
|
||||
pthread_cond_t TaskSchedulerImpl::s_cvNotEmpty;
|
||||
pthread_barrier_t TaskSchedulerImpl::s_barrier;
|
||||
|
||||
#if defined(NAZARA_PLATFORM_MACOSX)
|
||||
//Code from https://blog.albertarmea.com/post/47089939939/using-pthreadbarrier-on-mac-os-x
|
||||
int TaskSchedulerImpl::pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
|
||||
{
|
||||
if(count == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if(pthread_mutex_init(&barrier->mutex, 0) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(pthread_cond_init(&barrier->cond, 0) < 0)
|
||||
{
|
||||
pthread_mutex_destroy(&barrier->mutex);
|
||||
return -1;
|
||||
}
|
||||
barrier->tripCount = count;
|
||||
barrier->count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TaskSchedulerImpl::pthread_barrier_destroy(pthread_barrier_t *barrier)
|
||||
{
|
||||
pthread_cond_destroy(&barrier->cond);
|
||||
pthread_mutex_destroy(&barrier->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TaskSchedulerImpl::pthread_barrier_wait(pthread_barrier_t *barrier)
|
||||
{
|
||||
pthread_mutex_lock(&barrier->mutex);
|
||||
++(barrier->count);
|
||||
if(barrier->count >= barrier->tripCount)
|
||||
{
|
||||
barrier->count = 0;
|
||||
pthread_cond_broadcast(&barrier->cond);
|
||||
pthread_mutex_unlock(&barrier->mutex);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_cond_wait(&barrier->cond, &(barrier->mutex));
|
||||
pthread_mutex_unlock(&barrier->mutex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,17 @@
|
|||
#include <pthread.h>
|
||||
#include <queue>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_MACOSX)
|
||||
typedef int pthread_barrierattr_t;
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
int count;
|
||||
int tripCount;
|
||||
} pthread_barrier_t;
|
||||
#endif
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct Functor;
|
||||
|
|
@ -45,6 +56,12 @@ namespace Nz
|
|||
static pthread_cond_t s_cvEmpty;
|
||||
static pthread_cond_t s_cvNotEmpty;
|
||||
static pthread_barrier_t s_barrier;
|
||||
|
||||
#if defined(NAZARA_PLATFORM_MACOSX)
|
||||
static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count);
|
||||
static int pthread_barrier_destroy(pthread_barrier_t *barrier);
|
||||
static int pthread_barrier_wait(pthread_barrier_t *barrier);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ namespace Nz
|
|||
#elif defined(NAZARA_PLATFORM_LINUX)
|
||||
std::string_view temp(string);
|
||||
// Nothing to do
|
||||
#elif defined(NAZARA_PLATFORM_MACOS)
|
||||
#elif defined(NAZARA_PLATFORM_MACOSX)
|
||||
std::string temp(string);
|
||||
ReplaceStr(temp, "\n", "\r");
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@
|
|||
#include <cstring>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE)
|
||||
#define TCP_KEEPIDLE TCP_KEEPALIVE // see -> https://gitlab.freedesktop.org/spice/usbredir/-/issues/9
|
||||
#endif
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
constexpr int SOCKET_ERROR = -1;
|
||||
|
|
@ -269,6 +273,9 @@ namespace Nz
|
|||
unsigned int code;
|
||||
socklen_t codeLength = sizeof(code);
|
||||
|
||||
#if defined(NAZARA_PLATFORM_MACOSX)
|
||||
return 0; //No IP_MTU on macosx
|
||||
#else
|
||||
if (getsockopt(handle, IPPROTO_IP, IP_MTU, &code, &codeLength) == SOCKET_ERROR)
|
||||
{
|
||||
if (error)
|
||||
|
|
@ -276,6 +283,7 @@ namespace Nz
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (error)
|
||||
*error = SocketError_NoError;
|
||||
|
|
@ -597,8 +605,11 @@ namespace Nz
|
|||
}
|
||||
|
||||
IpAddress senderIp;
|
||||
|
||||
#if defined(MSG_NOSIGNAL)
|
||||
int byteRead = recvmsg(handle, &msgHdr, MSG_NOSIGNAL);
|
||||
#else
|
||||
int byteRead = recvmsg(handle, &msgHdr, 0);
|
||||
#endif
|
||||
if (byteRead == -1)
|
||||
{
|
||||
int errorCode = GetLastErrorCode();
|
||||
|
|
@ -714,7 +725,12 @@ namespace Nz
|
|||
msgHdr.msg_iov = sysBuffers.data();
|
||||
msgHdr.msg_iovlen = static_cast<int>(bufferCount);
|
||||
|
||||
#if defined(MSG_NOSIGNAL)
|
||||
int byteSent = sendmsg(handle, &msgHdr, MSG_NOSIGNAL);
|
||||
#else
|
||||
int byteSent = sendmsg(handle, &msgHdr, 0);
|
||||
#endif
|
||||
|
||||
if (byteSent == SOCKET_ERROR)
|
||||
{
|
||||
int errorCode = GetLastErrorCode();
|
||||
|
|
@ -896,6 +912,18 @@ namespace Nz
|
|||
|
||||
if (error)
|
||||
*error = SocketError_NoError;
|
||||
|
||||
#if not defined(MSG_NOSIGNAL) // -> https://github.com/intel/parameter-framework/pull/133/files
|
||||
//There is no MSG_NOSIGNAL on macos
|
||||
const int set = 1;
|
||||
if (setsockopt(handle, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set)) == SOCKET_ERROR)
|
||||
{
|
||||
if (error)
|
||||
*error = TranslateErrnoToSocketError(GetLastErrorCode());
|
||||
|
||||
return false; //< Error
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,105 +2,47 @@
|
|||
// This file is part of the "Nazara Engine - OpenGL Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if 0
|
||||
|
||||
#include <Nazara/OpenGLRenderer/Utils.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
std::string TranslateOpenGLError(VkResult code)
|
||||
std::string TranslateOpenGLError(GLenum code)
|
||||
{
|
||||
// From https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/xhtml/vkspec.html#VkResult
|
||||
switch (code)
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
return "No error";
|
||||
|
||||
case VK_NOT_READY:
|
||||
return "A fence or query has not yet completed";
|
||||
|
||||
case VK_TIMEOUT:
|
||||
return "A wait operation has not completed in the specified time";
|
||||
|
||||
case VK_EVENT_SET:
|
||||
return "An event is signaled";
|
||||
|
||||
case VK_EVENT_RESET:
|
||||
return "An event is unsignaled";
|
||||
|
||||
case VK_INCOMPLETE:
|
||||
return "A return array was too small for the result";
|
||||
|
||||
case VK_ERROR_OUT_OF_HOST_MEMORY:
|
||||
return "A host memory allocation has failed";
|
||||
|
||||
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
|
||||
return "A device memory allocation has failed";
|
||||
|
||||
case VK_ERROR_INITIALIZATION_FAILED:
|
||||
return "Initialization of an object could not be completed for implementation-specific reasons";
|
||||
|
||||
case VK_ERROR_DEVICE_LOST:
|
||||
return "The logical or physical device has been lost";
|
||||
|
||||
case VK_ERROR_MEMORY_MAP_FAILED:
|
||||
return "Mapping of the memory object has failed";
|
||||
|
||||
case VK_ERROR_LAYER_NOT_PRESENT:
|
||||
return "A requested layer is not present or could not be loaded";
|
||||
|
||||
case VK_ERROR_EXTENSION_NOT_PRESENT:
|
||||
return "A requested extension is not supported";
|
||||
|
||||
case VK_ERROR_FEATURE_NOT_PRESENT:
|
||||
return "A requested feature is not supported";
|
||||
|
||||
case VK_ERROR_INCOMPATIBLE_DRIVER:
|
||||
return "The requested version of OpenGL is not supported by the driver or is otherwise incompatible for implementation-specific reasons";
|
||||
|
||||
case VK_ERROR_TOO_MANY_OBJECTS:
|
||||
return "Too many objects of the type have already been created";
|
||||
|
||||
case VK_ERROR_FORMAT_NOT_SUPPORTED:
|
||||
return "A requested format is not supported on this device";
|
||||
|
||||
case VK_ERROR_FRAGMENTED_POOL:
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory";
|
||||
|
||||
case VK_ERROR_SURFACE_LOST_KHR:
|
||||
return "A surface is no longer available";
|
||||
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
|
||||
return "The requested window is already connected to a VkSurfaceKHR, or to some other non-OpenGL API";
|
||||
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully";
|
||||
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
return "A surface has changed in such a way that it is no longer compatible with the swapchain, and further presentation requests using the swapchain will fail. Applications must query the new surface properties and recreate their swapchain if they wish to continue presenting to the surface";
|
||||
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
|
||||
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image";
|
||||
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT:
|
||||
return "A validation layer found an error";
|
||||
|
||||
case VK_ERROR_INVALID_SHADER_NV:
|
||||
return "One or more shaders failed to compile or link";
|
||||
|
||||
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
|
||||
return "A requested pool allocation has failed";
|
||||
|
||||
case VK_ERROR_INVALID_EXTERNAL_HANDLE:
|
||||
return "An external handle is not a valid handle of the specified type";
|
||||
|
||||
default:
|
||||
// OpenGL/OpenGL ES error codes
|
||||
case GL_INVALID_ENUM:
|
||||
return "an unacceptable value is specified for an enumerated argument";
|
||||
break;
|
||||
|
||||
case GL_INVALID_VALUE:
|
||||
return "a numeric argument is out of range";
|
||||
break;
|
||||
|
||||
case GL_INVALID_OPERATION:
|
||||
return "the specified operation is not allowed in the current state";
|
||||
break;
|
||||
|
||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||
return "the framebuffer object is not complete";
|
||||
break;
|
||||
|
||||
case GL_OUT_OF_MEMORY:
|
||||
return "there is not enough memory left to execute the command";
|
||||
break;
|
||||
|
||||
// OpenGL error codes
|
||||
case GL_STACK_UNDERFLOW:
|
||||
return "an attempt has been made to perform an operation that would cause an internal stack to underflow.";
|
||||
break;
|
||||
|
||||
case GL_STACK_OVERFLOW:
|
||||
return "an attempt has been made to perform an operation that would cause an internal stack to overflow.";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return "Unknown OpenGL error (0x" + NumberToString(code, 16) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -378,42 +378,7 @@ namespace Nz::GL
|
|||
{
|
||||
hasAnyError = true;
|
||||
|
||||
switch (lastError)
|
||||
{
|
||||
// OpenGL/OpenGL ES error codes
|
||||
case GL_INVALID_ENUM:
|
||||
NazaraError("OpenGL error: an unacceptable value is specified for an enumerated argument");
|
||||
break;
|
||||
|
||||
case GL_INVALID_VALUE:
|
||||
NazaraError("OpenGL error: a numeric argument is out of range");
|
||||
break;
|
||||
|
||||
case GL_INVALID_OPERATION:
|
||||
NazaraError("OpenGL error: the specified operation is not allowed in the current state");
|
||||
break;
|
||||
|
||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||
NazaraError("OpenGL error: the framebuffer object is not complete");
|
||||
break;
|
||||
|
||||
case GL_OUT_OF_MEMORY:
|
||||
NazaraError("OpenGL error: there is not enough memory left to execute the command");
|
||||
break;
|
||||
|
||||
// OpenGL error codes
|
||||
case GL_STACK_UNDERFLOW:
|
||||
NazaraError("OpenGL error: an attempt has been made to perform an operation that would cause an internal stack to underflow.");
|
||||
break;
|
||||
|
||||
case GL_STACK_OVERFLOW:
|
||||
NazaraError("OpenGL error: an attempt has been made to perform an operation that would cause an internal stack to overflow.");
|
||||
break;
|
||||
|
||||
default:
|
||||
NazaraError("OpenGL error: an unknown error was reported (code: " + std::to_string(lastError) + ")");
|
||||
break;
|
||||
}
|
||||
NazaraError("OpenGL error: " + TranslateOpenGLError(lastError));
|
||||
}
|
||||
|
||||
return hasAnyError;
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ namespace Nz
|
|||
|
||||
void ShaderAstSerializerBase::Serialize(ShaderNodes::SwizzleOp& node)
|
||||
{
|
||||
Value(node.componentCount);
|
||||
SizeT(node.componentCount);
|
||||
Node(node.expression);
|
||||
|
||||
for (std::size_t i = 0; i < node.componentCount; ++i)
|
||||
|
|
@ -805,7 +805,7 @@ namespace Nz
|
|||
{
|
||||
m_stream >> val;
|
||||
}
|
||||
|
||||
|
||||
void ShaderAstUnserializer::Variable(ShaderNodes::VariablePtr& var)
|
||||
{
|
||||
Int32 nodeTypeInt;
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ void BufferField::PopulateFieldList(std::size_t structIndex, const std::string&
|
|||
else if constexpr (std::is_same_v<T, std::size_t>)
|
||||
PopulateFieldList(arg, prefix + member.name + ".");
|
||||
else
|
||||
static_assert(AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
static_assert(Nz::AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
},
|
||||
member.type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <Nazara/Shader/ShaderBuilder.hpp>
|
||||
#include <QtWidgets/QDoubleSpinBox>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <stdexcept>
|
||||
|
||||
template<std::size_t ToComponentCount>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ struct VecExpressionTypeHelper<4>
|
|||
static constexpr Nz::ShaderNodes::BasicType ExpressionType = Nz::ShaderNodes::BasicType::Float4;
|
||||
};
|
||||
|
||||
template<std::size_t N> constexpr Nz::ShaderNodes::BasicType VecExpressionType = VecExpressionTypeHelper<N>::template ExpressionType;
|
||||
template<std::size_t N> constexpr Nz::ShaderNodes::BasicType VecExpressionType = VecExpressionTypeHelper<N>::ExpressionType;
|
||||
|
||||
|
||||
struct VecTypeDummy {};
|
||||
|
|
@ -86,7 +86,7 @@ struct VecTypeHelper<4>
|
|||
using Type = Nz::Vector4f;
|
||||
};
|
||||
|
||||
template<std::size_t N> using VecType = typename VecTypeHelper<N>::template Type;
|
||||
template<std::size_t N> using VecType = typename VecTypeHelper<N>::Type;
|
||||
|
||||
constexpr std::array<char, 4> s_vectorComponents = { 'X', 'Y', 'Z', 'W' };
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void ShaderGraph::Load(const QJsonObject& data)
|
|||
if (typeDocRef.isString())
|
||||
memberInfo.type = DecodeEnum<PrimitiveType>(typeDocRef.toString().toStdString()).value();
|
||||
else
|
||||
memberInfo.type = typeDocRef.toInt();
|
||||
memberInfo.type = static_cast<std::size_t>(typeDocRef.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ QJsonObject ShaderGraph::Save()
|
|||
else if constexpr (std::is_same_v<T, std::size_t>)
|
||||
memberDoc["type"] = int(arg);
|
||||
else
|
||||
static_assert(AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
static_assert(Nz::AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
}, member.type);
|
||||
|
||||
memberArray.append(std::move(memberDoc));
|
||||
|
|
@ -651,7 +651,7 @@ Nz::ShaderExpressionType ShaderGraph::ToShaderExpressionType(const std::variant<
|
|||
return s.name;
|
||||
}
|
||||
else
|
||||
static_assert(AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
static_assert(Nz::AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
}, type);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ QString StructEditDialog::GetMemberName(const StructInfo::Member& member)
|
|||
else if constexpr (std::is_same_v<T, std::size_t>)
|
||||
name += QString::fromStdString(m_shaderGraph.GetStruct(arg).name);
|
||||
else
|
||||
static_assert(AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
static_assert(Nz::AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
},
|
||||
member.type);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ StructMemberEditDialog(shaderGraph, parent)
|
|||
else if constexpr (std::is_same_v<T, std::size_t>)
|
||||
m_typeList->setCurrentIndex(static_cast<int>(PrimitiveTypeCount + arg));
|
||||
else
|
||||
static_assert(AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
static_assert(Nz::AlwaysFalse<T>::value, "non-exhaustive visitor");
|
||||
},
|
||||
member.type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,4 +36,7 @@ LIBRARY.Custom = function()
|
|||
|
||||
filter({"architecture:x86", "system:linux"})
|
||||
defines("_POSIX_VER")
|
||||
end
|
||||
|
||||
filter({"architecture:x86_64", "system:macosx"})
|
||||
defines("_MACOSX_VER")
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue