Linux fix

This commit is contained in:
Light3039 2021-08-03 17:34:45 +04:30
parent 786535bac7
commit f46cf23550
4 changed files with 110 additions and 92 deletions

2
Dependencies/imgui vendored

@ -1 +1 @@
Subproject commit 8e834740f0f1a9422ebb104087e26ad218c50173 Subproject commit 3ee908d0db082aba35decf4f33bec9ec3e1376eb

View file

@ -3,11 +3,12 @@
#define LIGHT_CONFIG_H #define LIGHT_CONFIG_H
// //
// you can uncomment any of these definitions to config the project to your liking // you can uncomment any of these definitions to config the project to your
// liking
// //
// suppress undefined debug trap // suppress undefined debug trap
// #define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP #define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP
// log opengl shader compile info // log opengl shader compile info
// #define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG // #define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG

View file

@ -2,14 +2,19 @@
#ifndef LIGHT_DEBUG_TRAP_H #ifndef LIGHT_DEBUG_TRAP_H
#define LIGHT_DEBUG_TRAP_H #define LIGHT_DEBUG_TRAP_H
#include "Base/Base.h"
// https://github.com/nemequ/portable-snippets/tree/master/debug-trap // https://github.com/nemequ/portable-snippets/tree/master/debug-trap
#ifdef LIGHT_DIST #ifdef LIGHT_DIST
#ifdef _MSC_VER #ifdef _MSC_VER
#define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ #define LT_DEBUG_TRAP() \
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
__FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
#else #else
#define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ ) #define LT_DEBUG_TRAP() \
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
#endif #endif
#endif #endif
@ -45,10 +50,14 @@
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); } static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); }
#elif defined(__aarch64__) #elif defined(__aarch64__)
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xd4200000"); } static inline void LT_DEBUG_TRAP(void) {
__asm__ __volatile__(".inst 0xd4200000");
}
#elif defined(__arm__) #elif defined(__arm__)
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xe7f001f0"); } static inline void LT_DEBUG_TRAP(void) {
__asm__ __volatile__(".inst 0xe7f001f0");
}
#elif defined(__alpha__) && !defined(__osf__) #elif defined(__alpha__) && !defined(__osf__)
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); } static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); }
@ -57,13 +66,18 @@
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); } static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); }
#elif defined(_55_) #elif defined(_55_)
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP"); } static inline void LT_DEBUG_TRAP(void) {
__asm__ __volatile__(
";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP");
}
#elif defined(_64P_) #elif defined(_64P_)
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); } static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); }
#elif defined(_6x_) #elif defined(_6x_)
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("NOP\n .word 0x10000000"); } static inline void LT_DEBUG_TRAP(void) {
__asm__ __volatile__("NOP\n .word 0x10000000");
}
#elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__) #elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__)
#define LT_DEBUG_TRAP() __builtin_trap() #define LT_DEBUG_TRAP() __builtin_trap()
@ -83,22 +97,29 @@
#if !defined(LT_DEBUG_TRAP) #if !defined(LT_DEBUG_TRAP)
#if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP) #if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP)
#error "failed to define LT_BREAK, define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP in Config.h to disable this error" #error \
"failed to define LT_BREAK, define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP in Config.h to disable this error"
#elif defined(LIGHT_DIST) #elif defined(LIGHT_DIST)
#ifdef _MSC_VER #ifdef _MSC_VER
#define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ #define LT_DEBUG_TRAP() \
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
__FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
#else #else
#define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ ) #define LT_DEBUG_TRAP() \
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
#endif #endif
#else /* !defined(LIGHT_DIST) */ #else /* !defined(LIGHT_DIST) */
#ifdef _MSC_VER #ifdef _MSC_VER
#define LT_DEBUG_TRAP() LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ #define LT_DEBUG_TRAP() \
LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
__FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
#else #else
#define LT_DEBUG_TRAP() LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ ) #define LT_DEBUG_TRAP() \
LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
#endif #endif
#endif #endif

View file

@ -1,14 +1,14 @@
#pragma once #pragma once
#include "Entity.h" #include "Scene/Entity.h"
#include "Base/Base.h" #include "Base/Base.h"
namespace Light { namespace Light {
class NativeScript class NativeScript {
{
friend class Scene; friend class Scene;
private: private:
Entity m_Entity; Entity m_Entity;
unsigned int m_UniqueIdentifier = 0; // :#todo unsigned int m_UniqueIdentifier = 0; // :#todo
@ -19,11 +19,7 @@ namespace Light {
inline unsigned int GetUID() const { return m_UniqueIdentifier; } inline unsigned int GetUID() const { return m_UniqueIdentifier; }
template<typename T> template <typename T> T &GetComponent() { return m_Entity.GetComponent<T>(); }
T& GetComponent()
{
return m_Entity.GetComponent<T>();
}
protected: protected:
virtual void OnCreate() {} virtual void OnCreate() {}
@ -31,4 +27,4 @@ namespace Light {
virtual void OnUpdate(float ts) {} virtual void OnUpdate(float ts) {}
}; };
} } // namespace Light