more fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
$texturecPath = ".\cmake-build\texturec.exe"
|
$texturecPath = "..\tools\texturec.exe"
|
||||||
$textureAssetDir = "..\assets\textures"
|
$textureAssetDir = "..\assets\textures"
|
||||||
$outputBaseDir = ".\textures"
|
$outputBaseDir = ".\textures"
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,8 @@ namespace Game
|
|||||||
LOG_ERROR("Can't resize to more than previous size!");
|
LOG_ERROR("Can't resize to more than previous size!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOG("Resizing last allocation from %llu to %llu", arena.LastAllocSize, newByteCount);
|
|
||||||
arena.Used -= arena.LastAllocSize;
|
arena.Used -= arena.LastAllocSize;
|
||||||
arena.Used += newByteCount;
|
arena.Used += newByteCount;
|
||||||
LOG("New total: %llu", arena.Used);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ namespace Game
|
|||||||
uint8_t DebugCardRotation = 0;
|
uint8_t DebugCardRotation = 0;
|
||||||
bool ShortenLogFileNames = true;
|
bool ShortenLogFileNames = true;
|
||||||
bool ShowStats = true;
|
bool ShowStats = true;
|
||||||
|
bool ShowArenaUsage = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GameInstance
|
struct GameInstance
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "Tools.h"
|
#include "Tools.h"
|
||||||
|
|
||||||
#include "bx/filepath.h"
|
#include "bx/filepath.h"
|
||||||
|
#include "bx/string.h"
|
||||||
#include "bx/timer.h"
|
#include "bx/timer.h"
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <tracy/Tracy.hpp>
|
#include <tracy/Tracy.hpp>
|
||||||
@@ -121,6 +122,50 @@ namespace Tools
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr const char* UnitStrings[]{
|
||||||
|
"b",
|
||||||
|
"kb",
|
||||||
|
"mb",
|
||||||
|
"gb",
|
||||||
|
};
|
||||||
|
const char* GetUnitString(uint64_t byteCount, uint64_t& outCount)
|
||||||
|
{
|
||||||
|
outCount = byteCount;
|
||||||
|
int32_t strIdx = 0;
|
||||||
|
for (int32_t i = 0; i < BX_COUNTOF(UnitStrings); ++i)
|
||||||
|
{
|
||||||
|
if (outCount < 1024) break;
|
||||||
|
++strIdx;
|
||||||
|
outCount /= 1024;
|
||||||
|
}
|
||||||
|
return UnitStrings[strIdx];
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressBar(const char* title, uint64_t current, uint64_t max)
|
||||||
|
{
|
||||||
|
ImGui::PushID(title);
|
||||||
|
float percent = static_cast<double>(current) / static_cast<double>(max);
|
||||||
|
ImVec2 startPos = ImGui::GetCursorScreenPos();
|
||||||
|
char content[128]{0};
|
||||||
|
|
||||||
|
uint64_t currentUnit = 0;
|
||||||
|
const char* currentUnitStr = GetUnitString(current, currentUnit);
|
||||||
|
uint64_t maxUnit = 0;
|
||||||
|
const char* maxUnitStr = GetUnitString(max, maxUnit);
|
||||||
|
|
||||||
|
bx::snprintf(content,
|
||||||
|
sizeof(content),
|
||||||
|
"%s: %u %s/%u %s (%.2f%%)",
|
||||||
|
title,
|
||||||
|
currentUnit,
|
||||||
|
currentUnitStr,
|
||||||
|
maxUnit,
|
||||||
|
maxUnitStr,
|
||||||
|
percent);
|
||||||
|
ImGui::Text("%s", content);
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
bool TransformUI(Gen::Transform& transform)
|
bool TransformUI(Gen::Transform& transform)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
@@ -420,6 +465,23 @@ namespace Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
if (ImGui::Begin("Debug"))
|
||||||
|
{
|
||||||
|
ImGui::Checkbox("Arenas", &debug.ShowArenaUsage);
|
||||||
|
ImGui::Checkbox("ImGui Demo", &debug.ShowImguiDemo);
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
if (debug.ShowArenaUsage)
|
||||||
|
{
|
||||||
|
if (ImGui::Begin("Arenas", &debug.ShowArenaUsage))
|
||||||
|
{
|
||||||
|
ProgressBar("Permanent", shared.Game.PermanentArena.Used, shared.Game.PermanentArena.MaxSize);
|
||||||
|
ProgressBar("Entity", shared.Game.EntityArena.Used, shared.Game.EntityArena.MaxSize);
|
||||||
|
ProgressBar("Transient", shared.Game.TransientArena.Used, shared.Game.TransientArena.MaxSize);
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (debug.ShowStats)
|
if (debug.ShowStats)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -235,8 +235,18 @@ namespace Game
|
|||||||
*_orientation = imageContainer.m_orientation;
|
*_orientation = imageContainer.m_orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bgfx::Memory* mem =
|
// We're working with ktx textures, so the size should be in front of the actual data
|
||||||
bgfx::makeRef(data->data + imageContainer.m_offset, data->size - imageContainer.m_offset);
|
const uint32_t* texSizePtr = reinterpret_cast<uint32_t*>(data->data + imageContainer.m_offset);
|
||||||
|
uint8_t* dataPtr = data->data + imageContainer.m_offset + sizeof(uint32_t);
|
||||||
|
uint32_t dataSize = data->size - imageContainer.m_offset - sizeof(uint32_t);
|
||||||
|
|
||||||
|
// Extra sanity check
|
||||||
|
if (*texSizePtr != dataSize)
|
||||||
|
{
|
||||||
|
LOG_WARN("Texture size sanity check failed! %u != %u", texSizePtr, dataSize);
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
const bgfx::Memory* mem = bgfx::makeRef(dataPtr, dataSize);
|
||||||
|
|
||||||
if (NULL != _info)
|
if (NULL != _info)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user