Maintenance
- Added LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG to config.h - Some maintenance
This commit is contained in:
parent
fb4ba5c8bc
commit
42f26ac59e
11 changed files with 82 additions and 17 deletions
|
@ -76,16 +76,24 @@ namespace Light {
|
||||||
//====================================================================== OPERATIONS ======================================================================//
|
//====================================================================== OPERATIONS ======================================================================//
|
||||||
|
|
||||||
//========== ESSENTIAL_HEADERS ==========//
|
//========== ESSENTIAL_HEADERS ==========//
|
||||||
|
/* config */
|
||||||
|
#ifndef LIGHT_CONFIG_H
|
||||||
|
#include "Base/Config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
#ifndef LT_LOGGER_H
|
#ifndef LIGHT_LOGGER_H
|
||||||
#include "Debug/Logger.h"
|
#include "Debug/Logger.h"
|
||||||
#define LT_LOGGER_H
|
|
||||||
#endif
|
#endif
|
||||||
#include "Debug/Exceptions.h"
|
#include "Debug/Exceptions.h"
|
||||||
|
|
||||||
/* portables */
|
/* portables */
|
||||||
|
#ifndef LIGHT_DEBUG_TRAP_H
|
||||||
#include "Base/Portables/DebugTrap.h"
|
#include "Base/Portables/DebugTrap.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* utility */
|
/* utility */
|
||||||
|
#ifndef LIGHT_STRINGIFIER_H
|
||||||
#include "Utility/Stringifier.h"
|
#include "Utility/Stringifier.h"
|
||||||
|
#endif
|
||||||
//========== ESSENTIAL_HEADERS ==========//
|
//========== ESSENTIAL_HEADERS ==========//
|
|
@ -1,5 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifndef LIGHT_CONFIG_H
|
||||||
|
#define LIGHT_CONFIG_H
|
||||||
|
|
||||||
// #todo: add project config stuff
|
//
|
||||||
|
// you can uncomment any of these definitions to config the project to your liking
|
||||||
|
//
|
||||||
|
|
||||||
// #define LIGHT_IGNORE_UNDEFINED_DEBUG_BREAK
|
// suppress undefined debug trap
|
||||||
|
// #define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP
|
||||||
|
|
||||||
|
// log opengl shader compile info
|
||||||
|
// #define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifndef LIGHT_DEBUG_TRAP_H
|
||||||
|
#define LIGHT_DEBUG_TRAP_H
|
||||||
|
|
||||||
// https://github.com/nemequ/portable-snippets/tree/master/debug-trap
|
// https://github.com/nemequ/portable-snippets/tree/master/debug-trap
|
||||||
|
|
||||||
|
@ -80,8 +82,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LT_DEBUG_TRAP)
|
#if !defined(LT_DEBUG_TRAP)
|
||||||
#if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_BREAK)
|
#if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP)
|
||||||
#error "failed to define LT_BREAK, define LIGHT_IGNORE_UNDEFINED_DEBUG_BREAK 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
|
||||||
|
@ -101,3 +103,4 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
|
@ -66,6 +66,7 @@ namespace Light {
|
||||||
{
|
{
|
||||||
// update layers
|
// update layers
|
||||||
LT_PROFILE_SCOPE("GameLoop::Update");
|
LT_PROFILE_SCOPE("GameLoop::Update");
|
||||||
|
LT_PROFILE_SCOPE("GameLoop::Updated");
|
||||||
|
|
||||||
for (auto it = m_LayerStack->begin(); it != m_LayerStack->end(); it++)
|
for (auto it = m_LayerStack->begin(); it != m_LayerStack->end(); it++)
|
||||||
(*it)->OnUpdate(deltaTimer.GetDeltaTime());
|
(*it)->OnUpdate(deltaTimer.GetDeltaTime());
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define DXC(x) if(FAILED(hr = x)) throw dxException(hr, __FILE__, __LINE__)
|
#define DXC(x) DXC_NO_REDIFINITION(x, __LINE__)
|
||||||
|
#define DXC_NO_REDIFINITION(x, line) DXC_NO_REDIFINITION2(x, line)
|
||||||
|
#define DXC_NO_REDIFINITION2(x, line) HRESULT hr##line; if(FAILED(hr##line = x)) throw dxException(hr##line, __FILE__, line)
|
||||||
|
|
||||||
namespace Light {
|
namespace Light {
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,14 @@ namespace Light {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LT_PROFILE_SCOPE(name) InstrumentorTimer timer##__LINE__ (name)
|
/* scope */
|
||||||
|
#define LT_PROFILE_SCOPE(name) LT_PROFILE_SCOPE_NO_REDIFINITION(name, __LINE__)
|
||||||
|
#define LT_PROFILE_SCOPE_NO_REDIFINITION(name, line) LT_PROFILE_SCOPE_NO_REDIFINITION2(name, line)
|
||||||
|
#define LT_PROFILE_SCOPE_NO_REDIFINITION2(name, line) InstrumentorTimer timer##line(name)
|
||||||
|
|
||||||
|
/* function */
|
||||||
#define LT_PROFILE_FUNCTION LT_PROFILE_SCOPE(__FUNCSIG__)
|
#define LT_PROFILE_FUNCTION LT_PROFILE_SCOPE(__FUNCSIG__)
|
||||||
|
|
||||||
|
/* session */
|
||||||
#define LT_PROFILE_BEGIN_SESSION(outputPath) ::Light::Instrumentor::BeginSession(outputPath)
|
#define LT_PROFILE_BEGIN_SESSION(outputPath) ::Light::Instrumentor::BeginSession(outputPath)
|
||||||
#define LT_PROFILE_END_SESSION() ::Light::Instrumentor::EndSession()
|
#define LT_PROFILE_END_SESSION() ::Light::Instrumentor::EndSession()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifndef LIGHT_LOGGER_H
|
||||||
|
#define LIGHT_LOGGER_H
|
||||||
|
|
||||||
#define LT_LOGGER_H
|
|
||||||
#include "Base/Base.h"
|
#include "Base/Base.h"
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
@ -68,3 +69,4 @@ namespace Light {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifndef LIGHT_STRINGIFIER_H
|
||||||
|
#define LIGHT_STRINGIFIER_H
|
||||||
|
|
||||||
#include "Base/Base.h"
|
#include "Base/Base.h"
|
||||||
|
|
||||||
|
@ -19,3 +21,5 @@ namespace Light {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -73,7 +73,6 @@ namespace Light {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// create device and swap chain
|
// create device and swap chain
|
||||||
HRESULT hr;
|
|
||||||
DXC(D3D11CreateDeviceAndSwapChain(nullptr,
|
DXC(D3D11CreateDeviceAndSwapChain(nullptr,
|
||||||
D3D_DRIVER_TYPE_HARDWARE,
|
D3D_DRIVER_TYPE_HARDWARE,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -99,7 +98,6 @@ namespace Light {
|
||||||
// create render target view
|
// create render target view
|
||||||
Microsoft::WRL::ComPtr<ID3D11Resource> backBuffer;
|
Microsoft::WRL::ComPtr<ID3D11Resource> backBuffer;
|
||||||
|
|
||||||
HRESULT hr;
|
|
||||||
DXC(context->GetSwapChain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer));
|
DXC(context->GetSwapChain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer));
|
||||||
DXC(context->GetDevice()->CreateRenderTargetView(backBuffer.Get(), nullptr, &context->GetRenderTargetViewRef()));
|
DXC(context->GetDevice()->CreateRenderTargetView(backBuffer.Get(), nullptr, &context->GetRenderTargetViewRef()));
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,34 @@ namespace Light {
|
||||||
}
|
}
|
||||||
/* #TEMP_HANDLE_SHADER_COMPILE_FAILURE# */
|
/* #TEMP_HANDLE_SHADER_COMPILE_FAILURE# */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
|
||||||
|
{
|
||||||
|
int logLength = 0;
|
||||||
|
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &logLength);
|
||||||
|
if(logLength)
|
||||||
|
{
|
||||||
|
char* infoLog = (char*)alloca(logLength);
|
||||||
|
glGetShaderInfoLog(vertexShader, logLength, &logLength, &infoLog[0]);
|
||||||
|
|
||||||
|
LT_ENGINE_TRACE(infoLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int logLength = 0;
|
||||||
|
glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &logLength);
|
||||||
|
if (logLength)
|
||||||
|
{
|
||||||
|
char* infoLog = (char*)alloca(logLength);
|
||||||
|
glGetShaderInfoLog(fragmentShader, logLength, &logLength, &infoLog[0]);
|
||||||
|
|
||||||
|
LT_ENGINE_TRACE(infoLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// attach shaders
|
// attach shaders
|
||||||
glAttachShader(m_ShaderID, vertexShader);
|
glAttachShader(m_ShaderID, vertexShader);
|
||||||
glAttachShader(m_ShaderID, fragmentShader);
|
glAttachShader(m_ShaderID, fragmentShader);
|
||||||
|
|
|
@ -36,7 +36,9 @@ namespace Light {
|
||||||
|
|
||||||
void SceneHierarchyPanel::DrawNode(Entity entity, const std::string& label)
|
void SceneHierarchyPanel::DrawNode(Entity entity, const std::string& label)
|
||||||
{
|
{
|
||||||
ImGuiTreeNodeFlags flags = (m_SelectionContext == entity ? ImGuiTreeNodeFlags_Selected : NULL) | ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanFullWidth;
|
ImGuiTreeNodeFlags flags = (m_SelectionContext == entity ? ImGuiTreeNodeFlags_Selected : NULL) |
|
||||||
|
ImGuiTreeNodeFlags_OpenOnArrow |
|
||||||
|
ImGuiTreeNodeFlags_SpanFullWidth ;
|
||||||
|
|
||||||
bool expanded = ImGui::TreeNodeEx((void*)(uint64_t)(uint32_t)(entity), flags, label.c_str());
|
bool expanded = ImGui::TreeNodeEx((void*)(uint64_t)(uint32_t)(entity), flags, label.c_str());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue