Added utils and types to handle paths

This commit is contained in:
Patedam committed 2026-09-18 18:14:00 -04:00
1 parent f77b7fb901
commit 2fd675cf11
16 files changed
+188 -97

No files matched your search

+3 -3
View File
@@ -236,18 +236,18 @@ void RenderWorldEditorUI(World& world)
static char worldFilePath[256] = "/world.bin";
ImGui::InputText("World File", worldFilePath, sizeof(worldFilePath));
String path = GetAssetPath(temp.Arena, AssetType::JAsset, ConstString(worldFilePath));
Path path = GetAssetPath(temp.Arena, AssetType::JAsset, ConstString(worldFilePath));
if (ImGui::Button("Save World"))
{
Archive data = { .arena = temp.Arena, .loading = false };
Serialize(data, world, path);
Serialize(data, world, path.FullPath);
}
ImGui::SameLine();
if (ImGui::Button("Load World"))
{
Archive data{ .arena = temp.Arena, .loading = true };
Serialize(data, world, path);
Serialize(data, world, path.FullPath);
}
scratch_end(temp);
@@ -9,15 +9,27 @@ enum class AssetType
Config,
};
struct Path
{
String Directories;
String FullPath;
};
JULIET_API bool IsValid(Path path);
// Returns the path to the application directory
JULIET_API String GetBasePath();
JULIET_API Path GetBasePath();
// Path to the /Assets/ folder
JULIET_API String GetAssetBasePath();
JULIET_API Path GetAssetBasePath();
// Builds a full path to an asset file given its filename (e.g. "Triangle.vert.dxil").
JULIET_API String GetAssetPath(NonNullPtr<Arena> arena, AssetType type, String filename);
JULIET_API Path GetAssetPath(NonNullPtr<Arena> arena, AssetType type, String filename);
JULIET_API bool IsAbsolutePath(String path);
JULIET_API String CleanPath(NonNullPtr<Arena> arena, String path);
JULIET_API bool fs_create_directory(String path, bool recursive);
JULIET_API bool fs_path_exists(String path);
+40 -31
View File
@@ -11,9 +11,9 @@
namespace
{
String CachedBasePath = {};
String CachedAssetBasePath = {};
String CachedShaderBasePath = {};
Path CachedBasePath = {};
Path CachedAssetBasePath = {};
Path CachedShaderBasePath = {};
bool DirectoryExists(const char* path)
{
@@ -23,19 +23,24 @@ namespace
}
} // namespace
String GetBasePath()
bool IsValid(Path path)
{
return IsValid(path.Directories) && IsValid(path.FullPath);
}
Path GetBasePath()
{
Assert(IsValid(CachedBasePath));
return CachedBasePath;
}
String GetAssetBasePath()
Path GetAssetBasePath()
{
Assert(IsValid(CachedAssetBasePath));
return CachedAssetBasePath;
return { CachedAssetBasePath };
}
String GetAssetPath(NonNullPtr<Arena> arena, AssetType type, String filename)
Path GetAssetPath(NonNullPtr<Arena> arena, AssetType type, String filename)
{
// ICI on va vouloir 1) avoir une fonction create file path a partir de base + file qui fait un string copy
// On va passer le path au clean path
@@ -48,39 +53,36 @@ String GetAssetPath(NonNullPtr<Arena> arena, AssetType type, String filename)
{
case AssetType::Shader:
{
Assert(IsValid(CachedShaderBasePath));
totalSize = CachedShaderBasePath.Directories.Size + filename.Size + 1;
totalSize = CachedShaderBasePath.Size + filename.Size + 1;
juliet_snprintf(buffer, totalSize, "%s%s", CStr(CachedShaderBasePath), CStr(filename));
juliet_snprintf(buffer, totalSize, "%s%s", CStr(CachedShaderBasePath.Directories), CStr(filename));
}
break;
case AssetType::Config:
{
Assert(IsValid(CachedAssetBasePath));
constexpr char kConfig_str[] = "config/";
constexpr size_t kConfig_size = sizeof(kConfig_str) - 1;
totalSize = CachedAssetBasePath.Size + kConfig_size + filename.Size + 1;
totalSize = CachedAssetBasePath.Directories.Size + kConfig_size + filename.Size + 1;
juliet_snprintf(buffer, totalSize, "%s%s%s", CStr(CachedAssetBasePath), kConfig_str, CStr(filename));
juliet_snprintf(buffer, totalSize, "%s%s%s", CStr(CachedAssetBasePath.Directories), kConfig_str, CStr(filename));
}
break;
case AssetType::JAsset: [[fallthrough]];
default:
{
Assert(IsValid(CachedAssetBasePath));
totalSize = CachedAssetBasePath.Directories.Size + filename.Size + 1;
totalSize = CachedAssetBasePath.Size + filename.Size + 1;
juliet_snprintf(buffer, totalSize, "%s%s", CStr(CachedAssetBasePath), CStr(filename));
juliet_snprintf(buffer, totalSize, "%s%s", CStr(CachedAssetBasePath.Directories), CStr(filename));
}
break;
}
String asset_path = CleanPath(arena, { buffer, totalSize - 1 });
return asset_path;
String directories = asset_path;
directories.Size -= filename.Size;
Path path = { directories, asset_path };
return path;
}
bool IsAbsolutePath(String path)
@@ -97,11 +99,21 @@ String CleanPath(NonNullPtr<Arena> arena, String path)
return Platform::CleanPath(arena, path);
}
bool fs_create_directory(String path, bool recursive)
{
return Platform::fs_create_directory(path, recursive);
}
bool fs_path_exists(String path)
{
return Platform::fs_path_exists(path);
}
void InitFilesystem(NonNullPtr<Arena> arena)
{
CachedBasePath = Platform::GetBasePath(arena);
String basePath = GetBasePath();
Path basePath = GetBasePath();
Assert(IsValid(basePath));
// Probe candidate paths base asset folder
@@ -112,13 +124,13 @@ void InitFilesystem(NonNullPtr<Arena> arena)
for (const char* candidate : kCandidates)
{
char probePath[512];
juliet_snprintf(probePath, sizeof(probePath), "%s%s", CStr(basePath), candidate);
juliet_snprintf(probePath, sizeof(probePath), "%s%s", CStr(basePath.Directories), candidate);
if (DirectoryExists(probePath))
{
// Clean the path first to remove any relative parts
String abs_path = CleanPath(arena, WrapString(probePath));
CachedAssetBasePath = abs_path;
CachedAssetBasePath = { abs_path, abs_path };
Log(LogLevel::Message, LogCategory::Core, "Asset base path: %s", CStr(abs_path));
break;
}
@@ -132,13 +144,13 @@ void InitFilesystem(NonNullPtr<Arena> arena)
for (const char* candidate : kCandidatesShader)
{
char probePath[512];
juliet_snprintf(probePath, sizeof(probePath), "%s%s", CStr(CachedAssetBasePath), candidate);
juliet_snprintf(probePath, sizeof(probePath), "%s%s", CStr(CachedAssetBasePath.Directories), candidate);
if (DirectoryExists(probePath))
{
// Clean the path first to remove any relative parts
String abs_path = CleanPath(arena, WrapString(probePath));
CachedShaderBasePath = abs_path;
CachedShaderBasePath = { abs_path, abs_path };
Log(LogLevel::Message, LogCategory::Core, "Asset base path: %s", CStr(abs_path));
break;
}
@@ -147,10 +159,7 @@ void InitFilesystem(NonNullPtr<Arena> arena)
void ShutdownFilesystem()
{
CachedBasePath.Size = 0;
CachedBasePath.Str = nullptr;
CachedAssetBasePath.Size = 0;
CachedAssetBasePath.Str = nullptr;
CachedShaderBasePath.Size = 0;
CachedShaderBasePath.Str = nullptr;
CachedBasePath = {};
CachedAssetBasePath = {};
CachedShaderBasePath = {};
}
@@ -1,8 +1,12 @@
#pragma once
#include <Core/HAL/Filesystem/Filesystem.h>
namespace Platform
{
String GetBasePath(NonNullPtr<Arena> arena);
Path GetBasePath(NonNullPtr<Arena> arena);
bool IsAbsolutePath(String path);
String CleanPath(NonNullPtr<Arena> arena, String path);
bool fs_create_directory(String path, bool recursive);
bool fs_path_exists(String path);
} // namespace Platform
@@ -4,10 +4,11 @@
#include <Core/Logging/LogManager.h>
#include <Core/Logging/LogTypes.h>
#include <Core/Memory/Allocator.h>
#include <Core/Thread/ThreadContext.h>
namespace Platform
{
String GetBasePath(NonNullPtr<Arena> arena)
Path GetBasePath(NonNullPtr<Arena> arena)
{
// Allocate a buffer that could fit the module size.
// Max Path is a good start but could be bigger if the path include long path prefix
@@ -53,7 +54,8 @@ namespace Platform
Assert(idx > 0 && "Path is not absolute!");
buffer[idx + 1] = '\0'; // Chop chop
return WrapString(buffer);
String result = WrapString(buffer);
return { result, result };
}
bool IsAbsolutePath(String path)
@@ -104,4 +106,78 @@ namespace Platform
return StringCopy(arena, WrapString(clean_path_buffer));
}
bool fs_create_directory(String path, bool recursive)
{
bool result = true;
TempArena temp = scratch_begin(nullptr, 0);
String temp_path = StringCopy(temp.Arena, path);
if (recursive)
{
for (char* c = temp_path.Str; *c != '\0'; c++)
{
if (*c == '\\' || *c == '/')
{
// Found separator, need to skip it in case its "\\NetworkDrive" or "C:\"
if (c == temp_path.Str || *(c - 1) == ':')
{
continue;
}
// Keep pointer to the separator and "end" the string using a \0
char separator = *c;
*c = '\0';
const bool create_result_recursive = CreateDirectoryA(CStr(temp_path), nullptr);
if (!create_result_recursive)
{
const DWORD error = GetLastError();
if (error != ERROR_ALREADY_EXISTS)
{
LogError(LogCategory::Core, "Create directory (parent) failed, error %d", error);
result = false;
}
}
// Restore the string (remove \0)
*c = separator;
}
}
}
// Final folder
if (result)
{
const bool create_result = CreateDirectoryA(CStr(temp_path), nullptr);
if (!create_result)
{
const DWORD error = GetLastError();
if (error != ERROR_ALREADY_EXISTS)
{
LogDebug(LogCategory::Core, "Folder already exists");
result = false;
}
else
{
LogError(LogCategory::Core, "Create directory failed, error %d", error);
result = false;
}
}
}
scratch_end(temp);
return result;
}
bool fs_path_exists(String path)
{
DWORD attribs = GetFileAttributesA(CStr(path));
// If the function fails, the file or directory does not exist (or path is invalid)
bool result = (attribs == INVALID_FILE_ATTRIBUTES);
return result;
}
} // namespace Platform
+1 -1
View File
@@ -13,6 +13,7 @@ IOStream* IOFromFile(NonNullPtr<Arena> arena, String filename, String mode)
Log(LogLevel::Error, LogCategory::Core, "Trying to open IOStream on invalid filename");
return nullptr;
}
if (!IsValid(mode))
{
Log(LogLevel::Error, LogCategory::Core, "Trying to open IOStream with invalid mode");
@@ -220,4 +221,3 @@ bool IOClose(NonNullPtr<IOStream> stream)
}
return result;
}
@@ -225,7 +225,6 @@ namespace Internal
return nullptr;
}
// TODO: Detect when folder is missing and create it if in w or a mode.
HANDLE hFile = CreateFileA(CStr(filename), (canWrite | canRead), (canWrite) ? 0 : FILE_SHARE_READ, nullptr,
(openExisting | createAlways | openAlways), FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
+8 -10
View File
@@ -10,20 +10,19 @@
void InitHotReloadCode(NonNullPtr<Arena> arena, HotReloadCode& code, String dllName, String transientDllName, String lockFilename)
{
// Get the app base path and build the dll path from there.
String basePath = GetBasePath();
size_t basePathLength = StringLength(basePath);
Path basePath = GetBasePath();
size_t basePathLength = basePath.Directories.Size;
// Assign Transient dll path
code.TransientDLLName = transientDllName;
// First allocate all the full path.
// TODO: Add path composition into filesystem + string format + string builder
const size_t dllFullPathLength =
basePathLength + StringLength(dllName) + 1; // Need +1 because snprintf needs 0 terminated strings
const size_t dllFullPathLength = basePathLength + StringLength(dllName) + 1; // Need +1 because snprintf needs 0 terminated strings
code.DLLFullPath.Str = static_cast<char*>(
ArenaPush(arena, dllFullPathLength, alignof(char), true JULIET_DEBUG_PARAM("Hot Reload DLL Path")));
int writtenSize = snprintf(CStr(code.DLLFullPath), dllFullPathLength, "%s%s", CStr(basePath), CStr(dllName));
code.DLLFullPath.Str =
static_cast<char*>(ArenaPush(arena, dllFullPathLength, alignof(char), true JULIET_DEBUG_PARAM("Hot Reload DLL Path")));
int writtenSize = snprintf(CStr(code.DLLFullPath), dllFullPathLength, "%s%s", CStr(basePath.Directories), CStr(dllName));
if (writtenSize < static_cast<int>(dllFullPathLength) - 1)
{
Log(LogLevel::Error, LogCategory::Core, "Cannot create DLL Full Path");
@@ -32,11 +31,10 @@ void InitHotReloadCode(NonNullPtr<Arena> arena, HotReloadCode& code, String dllN
code.DLLFullPath.Size = static_cast<size_t>(writtenSize);
// Lock filename path
const size_t lockPathLength =
basePathLength + StringLength(lockFilename) + 1; // Need +1 because snprintf needs 0 terminated strings
const size_t lockPathLength = basePathLength + StringLength(lockFilename) + 1; // Need +1 because snprintf needs 0 terminated strings
code.LockFullPath.Str = static_cast<char*>(
ArenaPush(arena, lockPathLength, alignof(char), true JULIET_DEBUG_PARAM("Hot Reload Lock File Path")));
writtenSize = snprintf(CStr(code.LockFullPath), lockPathLength, "%s%s", CStr(basePath), CStr(lockFilename));
writtenSize = snprintf(CStr(code.LockFullPath), lockPathLength, "%s%s", CStr(basePath.Directories), CStr(lockFilename));
if (writtenSize < static_cast<int>(lockPathLength) - 1)
{
code.LockFullPath.Size = 0;
@@ -45,8 +45,8 @@ void LoadCode(HotReloadCode& code)
// We'll see for better later.
// Get the app base path and build the dll path from there.
String basePath = GetBasePath();
size_t basePathLength = StringLength(basePath);
Path basePath = GetBasePath();
size_t basePathLength = basePath.Directories.Size;
const size_t tempDllMaxBufferSize =
basePathLength + StringLength(code.TransientDLLName) + /* _ */ 1 + kTempDLLBufferSizeForID + 1 /* \0 */;
@@ -67,8 +67,8 @@ void LoadCode(HotReloadCode& code)
return;
}
int writtenSize = snprintf(tempDllPath, tempDllMaxBufferSize, "%s%s_%s", CStr(basePath), idToStr,
CStr(code.TransientDLLName));
int writtenSize = snprintf(tempDllPath, tempDllMaxBufferSize, "%s%s_%s", CStr(basePath.Directories),
idToStr, CStr(code.TransientDLLName));
if (writtenSize < 0)
{
// Scratch memory, no free needed
+10 -4
View File
@@ -15,14 +15,18 @@ void initialize_user_system()
// User name is basically found in a env variable, if not, the local windows user will be used.
TempArena temp = scratch_begin(nullptr, 0);
String user_system_path = GetAssetPath(temp.Arena, AssetType::Config, ConstString("users.ini"));
ByteBuffer user_file = LoadFile(temp.Arena, user_system_path);
Path user_system_path = GetAssetPath(temp.Arena, AssetType::Config, ConstString("users.ini"));
const bool file_exists = fs_path_exists(user_system_path.FullPath);
String username = os_get_username(temp.Arena);
if (user_file.Size == 0)
if (file_exists)
{
IOStream* stream = IOFromFile(temp.Arena, user_system_path, ConstString("w+"));
fs_create_directory(user_system_path.Directories, true);
Assert(fs_path_exists(user_system_path.Directories), "Couldn't create config folder");
IOStream* stream = IOFromFile(temp.Arena, user_system_path.FullPath, ConstString("w+"));
Archive ar = { .arena = temp.Arena, .loading = false, .stream = stream };
uint8 id = 1;
@@ -32,6 +36,8 @@ void initialize_user_system()
}
else
{
ByteBuffer user_file = LoadFile(temp.Arena, user_system_path.FullPath);
ParsedArchive parsed_archive = tokenize_archive(temp.Arena, user_file);
Archive ar = { .arena = temp.Arena, .loading = true, .base = parsed_archive };
+4 -4
View File
@@ -86,13 +86,13 @@ namespace
TempArena path = scratch_begin(0, 0);
String vertPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Debug.vert.dxil"));
Path vertPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Debug.vert.dxil"));
shaderCI.Stage = ShaderStage::Vertex;
Shader* vertexShader = CreateShader(device, vertPath, shaderCI);
Shader* vertexShader = CreateShader(device, vertPath.FullPath, shaderCI);
String fragPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Debug.frag.dxil"));
Path fragPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Debug.frag.dxil"));
shaderCI.Stage = ShaderStage::Fragment;
Shader* fragmentShader = CreateShader(device, fragPath, shaderCI);
Shader* fragmentShader = CreateShader(device, fragPath.FullPath, shaderCI);
scratch_end(path);
+5 -17
View File
@@ -196,8 +196,7 @@ void SubmitCommandLists(NonNullPtr<CommandList> commandList)
commandListHeader->Device->SubmitCommandLists(commandList);
}
RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, ColorTargetInfo& colorTargetInfo,
DepthStencilTargetInfo* depthStencilTargetInfo)
RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, ColorTargetInfo& colorTargetInfo, DepthStencilTargetInfo* depthStencilTargetInfo)
{
return BeginRenderPass(commandList, &colorTargetInfo, 1, depthStencilTargetInfo);
}
@@ -287,16 +286,15 @@ void DrawPrimitives(NonNullPtr<RenderPass> renderPass, uint32 numVertices, uint3
commandListHeader->Device->DrawPrimitives(commandList, numVertices, numInstances, firstVertex, firstInstance);
}
void DrawIndexedPrimitives(NonNullPtr<RenderPass> renderPass, uint32 numIndices, uint32 numInstances,
uint32 firstIndex, uint32 vertexOffset, uint32 firstInstance)
void DrawIndexedPrimitives(NonNullPtr<RenderPass> renderPass, uint32 numIndices, uint32 numInstances, uint32 firstIndex,
uint32 vertexOffset, uint32 firstInstance)
{
auto* commandList = reinterpret_cast<GPUPass*>(renderPass.Get())->CommandList;
auto* commandListHeader = reinterpret_cast<CommandListHeader*>(commandList);
if (commandListHeader->Device->DrawIndexedPrimitives)
{
commandListHeader->Device->DrawIndexedPrimitives(commandList, numIndices, numInstances, firstIndex,
vertexOffset, firstInstance);
commandListHeader->Device->DrawIndexedPrimitives(commandList, numIndices, numInstances, firstIndex, vertexOffset, firstInstance);
}
}
@@ -324,15 +322,6 @@ Shader* CreateShader(NonNullPtr<GraphicsDevice> device, String filename, ShaderC
{
shaderByteCode = LoadFile(fileArena.Arena, filename);
}
else
{
// TODO: Add path builder in the lib
String base = GetBasePath();
char inplaceBuffer[256];
juliet_snprintf(inplaceBuffer, sizeof(inplaceBuffer), "%s%s", base.Str, filename.Str);
String absolutePath = WrapString(inplaceBuffer);
shaderByteCode = LoadFile(fileArena.Arena, absolutePath);
}
if (!IsValid(shaderByteCode))
{
@@ -371,8 +360,7 @@ bool UpdateGraphicsPipelineShaders(NonNullPtr<GraphicsDevice> device, NonNullPtr
GraphicsBuffer* CreateGraphicsBuffer(NonNullPtr<GraphicsDevice> device, const BufferCreateInfo& createInfo)
{
return device->CreateGraphicsBuffer(device->Driver, createInfo.Size, createInfo.Stride, createInfo.Usage,
createInfo.IsDynamic);
return device->CreateGraphicsBuffer(device->Driver, createInfo.Size, createInfo.Stride, createInfo.Usage, createInfo.IsDynamic);
}
GraphicsTransferBuffer* CreateGraphicsTransferBuffer(NonNullPtr<GraphicsDevice> device, const TransferBufferCreateInfo& createInfo)
+4 -4
View File
@@ -131,13 +131,13 @@ bool ImGuiRenderer_Initialize(GraphicsDevice* device)
TempArena path = scratch_begin(0, 0);
String vertPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("ImGui.vert.dxil"));
Path vertPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("ImGui.vert.dxil"));
shaderCI.Stage = ShaderStage::Vertex;
g_ImGuiState.VertexShader = CreateShader(device, vertPath, shaderCI);
g_ImGuiState.VertexShader = CreateShader(device, vertPath.FullPath, shaderCI);
String fragPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("ImGui.frag.dxil"));
Path fragPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("ImGui.frag.dxil"));
shaderCI.Stage = ShaderStage::Fragment;
g_ImGuiState.FragmentShader = CreateShader(device, fragPath, shaderCI);
g_ImGuiState.FragmentShader = CreateShader(device, fragPath.FullPath, shaderCI);
scratch_end(path);
+6 -6
View File
@@ -81,13 +81,13 @@ bool InitializeMeshRendererGraphics(NonNullPtr<GraphicsDevice> device, NonNullPt
TempArena path = scratch_begin(0, 0);
String shaderPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Triangle.vert.dxil"));
Path shaderPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Triangle.vert.dxil"));
shaderCI.Stage = ShaderStage::Vertex;
Shader* vertexShader = CreateShader(graphicsDevice, shaderPath, shaderCI);
Shader* vertexShader = CreateShader(graphicsDevice, shaderPath.FullPath, shaderCI);
shaderPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("SolidColor.frag.dxil"));
shaderCI.Stage = ShaderStage::Fragment;
Shader* fragmentShader = CreateShader(graphicsDevice, shaderPath, shaderCI);
Shader* fragmentShader = CreateShader(graphicsDevice, shaderPath.FullPath, shaderCI);
scratch_end(path);
@@ -550,13 +550,13 @@ void ReloadMeshRendererShaders()
String entryPoint = WrapString("main");
ShaderCreateInfo shaderCI = {};
shaderCI.EntryPoint = entryPoint;
String shaderPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Triangle.vert.dxil"));
Path shaderPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Triangle.vert.dxil"));
shaderCI.Stage = ShaderStage::Vertex;
Shader* vertexShader = CreateShader(device, shaderPath, shaderCI);
Shader* vertexShader = CreateShader(device, shaderPath.FullPath, shaderCI);
shaderPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("SolidColor.frag.dxil"));
shaderCI.Stage = ShaderStage::Fragment;
Shader* fragmentShader = CreateShader(device, shaderPath, shaderCI);
Shader* fragmentShader = CreateShader(device, shaderPath.FullPath, shaderCI);
scratch_end(path);
+4 -4
View File
@@ -24,15 +24,15 @@ bool InitializeSkyboxRenderer(NonNullPtr<GraphicsDevice> device, NonNullPtr<Wind
ShaderCreateInfo skyboxVSCI = {};
skyboxVSCI.EntryPoint = skyboxVSEntry;
skyboxVSCI.Stage = ShaderStage::Vertex;
String vsPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Skybox.vert.dxil"));
Shader* skyboxVS = CreateShader(graphicsDevice, vsPath, skyboxVSCI);
Path vsPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Skybox.vert.dxil"));
Shader* skyboxVS = CreateShader(graphicsDevice, vsPath.FullPath, skyboxVSCI);
String skyboxFSEntry = WrapString("main");
ShaderCreateInfo skyboxFSCI = {};
skyboxFSCI.EntryPoint = skyboxFSEntry;
skyboxFSCI.Stage = ShaderStage::Fragment;
String fsPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Skybox.frag.dxil"));
Shader* skyboxFS = CreateShader(graphicsDevice, fsPath, skyboxFSCI);
Path fsPath = GetAssetPath(path.Arena, AssetType::Shader, ConstString("Skybox.frag.dxil"));
Shader* skyboxFS = CreateShader(graphicsDevice, fsPath.FullPath, skyboxFSCI);
scratch_end(path);
+1 -2
View File
@@ -84,7 +84,6 @@ static float blueLightColor[3] = { 0.2f, 0.2f, 1.0f };
// TODO : Remove main.h. Useless
// May be remove that Application class, useless too.
namespace
{
using GameShutdown_t = void (*)(void);
@@ -108,7 +107,7 @@ namespace
void JulietApplication::Init(NonNullPtr<Arena> platformArena)
{
Log(LogLevel::Message, LogCategory::Tool, "Initializing Juliet Application...");
Log(LogLevel::Message, LogCategory::Tool, "%s", CStr(GetBasePath()));
Log(LogLevel::Message, LogCategory::Tool, "%s", CStr(GetBasePath().Directories));
GraphicsConfig config;
#if JULIET_DEBUG