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 ======================================================================//
|
||||
|
||||
//========== ESSENTIAL_HEADERS ==========//
|
||||
/* config */
|
||||
#ifndef LIGHT_CONFIG_H
|
||||
#include "Base/Config.h"
|
||||
#endif
|
||||
|
||||
/* debug */
|
||||
#ifndef LT_LOGGER_H
|
||||
#include "Debug/Logger.h"
|
||||
#define LT_LOGGER_H
|
||||
#ifndef LIGHT_LOGGER_H
|
||||
#include "Debug/Logger.h"
|
||||
#endif
|
||||
#include "Debug/Exceptions.h"
|
||||
|
||||
/* portables */
|
||||
#include "Base/Portables/DebugTrap.h"
|
||||
#ifndef LIGHT_DEBUG_TRAP_H
|
||||
#include "Base/Portables/DebugTrap.h"
|
||||
#endif
|
||||
|
||||
/* utility */
|
||||
#include "Utility/Stringifier.h"
|
||||
#ifndef LIGHT_STRINGIFIER_H
|
||||
#include "Utility/Stringifier.h"
|
||||
#endif
|
||||
//========== ESSENTIAL_HEADERS ==========//
|
|
@ -1,5 +1,15 @@
|
|||
#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
|
||||
#ifndef LIGHT_DEBUG_TRAP_H
|
||||
#define LIGHT_DEBUG_TRAP_H
|
||||
|
||||
// https://github.com/nemequ/portable-snippets/tree/master/debug-trap
|
||||
|
||||
|
@ -80,8 +82,8 @@
|
|||
#endif
|
||||
|
||||
#if !defined(LT_DEBUG_TRAP)
|
||||
#if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_BREAK)
|
||||
#error "failed to define LT_BREAK, define LIGHT_IGNORE_UNDEFINED_DEBUG_BREAK to disable this error"
|
||||
#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"
|
||||
|
||||
#elif defined(LIGHT_DIST)
|
||||
#ifdef _MSC_VER
|
||||
|
@ -100,4 +102,5 @@
|
|||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
|
@ -66,6 +66,7 @@ namespace Light {
|
|||
{
|
||||
// update layers
|
||||
LT_PROFILE_SCOPE("GameLoop::Update");
|
||||
LT_PROFILE_SCOPE("GameLoop::Updated");
|
||||
|
||||
for (auto it = m_LayerStack->begin(); it != m_LayerStack->end(); it++)
|
||||
(*it)->OnUpdate(deltaTimer.GetDeltaTime());
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#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 {
|
||||
|
||||
|
|
|
@ -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__)
|
||||
|
||||
/* session */
|
||||
#define LT_PROFILE_BEGIN_SESSION(outputPath) ::Light::Instrumentor::BeginSession(outputPath)
|
||||
#define LT_PROFILE_END_SESSION() ::Light::Instrumentor::EndSession()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#ifndef LIGHT_LOGGER_H
|
||||
#define LIGHT_LOGGER_H
|
||||
|
||||
#define LT_LOGGER_H
|
||||
#include "Base/Base.h"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
@ -68,3 +69,4 @@ namespace Light {
|
|||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#ifndef LIGHT_STRINGIFIER_H
|
||||
#define LIGHT_STRINGIFIER_H
|
||||
|
||||
#include "Base/Base.h"
|
||||
|
||||
|
@ -18,4 +20,6 @@ namespace Light {
|
|||
static std::string GraphicsAPIToString(GraphicsAPI api);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -73,7 +73,6 @@ namespace Light {
|
|||
#endif
|
||||
|
||||
// create device and swap chain
|
||||
HRESULT hr;
|
||||
DXC(D3D11CreateDeviceAndSwapChain(nullptr,
|
||||
D3D_DRIVER_TYPE_HARDWARE,
|
||||
NULL,
|
||||
|
@ -99,7 +98,6 @@ namespace Light {
|
|||
// create render target view
|
||||
Microsoft::WRL::ComPtr<ID3D11Resource> backBuffer;
|
||||
|
||||
HRESULT hr;
|
||||
DXC(context->GetSwapChain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer));
|
||||
DXC(context->GetDevice()->CreateRenderTargetView(backBuffer.Get(), nullptr, &context->GetRenderTargetViewRef()));
|
||||
|
||||
|
|
|
@ -67,13 +67,41 @@ namespace Light {
|
|||
}
|
||||
/* #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
|
||||
glAttachShader(m_ShaderID, vertexShader);
|
||||
glAttachShader(m_ShaderID, fragmentShader);
|
||||
|
||||
// link shader program
|
||||
glLinkProgram(m_ShaderID);
|
||||
|
||||
|
||||
// delete shaders (free memory)
|
||||
glDeleteShader(vertexShader);
|
||||
glDeleteShader(fragmentShader);
|
||||
|
|
|
@ -36,7 +36,9 @@ namespace Light {
|
|||
|
||||
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());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue