mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
refactor: consolidate duplicate environment variable utility functions
Move envSizeMBOrDefault and envSizeOrDefault from 4 separate rendering modules (character_renderer, m2_renderer, terrain_renderer, wmo_renderer) into shared vk_utils.hpp header as inline functions. Use the most robust version which includes overflow checking for MB-to-bytes conversion. This eliminates 7 identical local function definitions and improves consistency across all rendering modules.
This commit is contained in:
parent
cda703b0f4
commit
b3d8651db9
5 changed files with 22 additions and 65 deletions
|
|
@ -20,17 +20,6 @@
|
|||
namespace wowee {
|
||||
namespace rendering {
|
||||
|
||||
namespace {
|
||||
size_t envSizeMBOrDefault(const char* name, size_t defMb) {
|
||||
const char* raw = std::getenv(name);
|
||||
if (!raw || !*raw) return defMb;
|
||||
char* end = nullptr;
|
||||
unsigned long long mb = std::strtoull(raw, &end, 10);
|
||||
if (end == raw || mb == 0) return defMb;
|
||||
return static_cast<size_t>(mb);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// Matches set 1 binding 7 in terrain.frag.glsl
|
||||
struct TerrainParamsUBO {
|
||||
int32_t layerCount;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue