Skip to content

Commit

Permalink
changed location of vulkan shader cache and logging to be the applica…
Browse files Browse the repository at this point in the history
…tion directory
  • Loading branch information
turanszkij committed Dec 12, 2024
1 parent f114860 commit c8b84f0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,7 @@ wiShaderdump.h
*.a
*.elf
*.prx

# Others
log.txt
pso_cache_vulkan
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ If you are having trouble getting the applications to run, make sure that you sa

- If you experience crashes, you can try these to find out the problem:
- make sure your environment is up to date, with latest graphics drivers and operating system updates.
- see if there is a wiBackLog.txt in your user temp folder (for example: C:\Users\username\AppData\Local\Temp)
- see if there is a log.txt in the working directory of the application (most likely near the application exe)
- request help on the [Forum](https://wickedengine.net/forum/), [Discord](https://discord.gg/CFjRYmE) or [Github issue](https://github.com/turanszkij/WickedEngine/issues)
- build the engine in Debug mode and try to run it, see where it crashes
- run the engine with the `debugdevice` command argument and post the text from your console output window when the crash happens
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/wiBacklog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace wi::backlog
}
void write_logfile()
{
std::string filename = wi::helper::GetTempDirectoryPath() + "wiBacklog.txt";
static const std::string filename = wi::helper::GetCurrentPath() + "/log.txt";
std::string text = getText(); // will lock mutex
wi::helper::FileWrite(filename, (const uint8_t*)text.c_str(), text.length());
}
Expand Down
17 changes: 7 additions & 10 deletions WickedEngine/wiGraphicsDevice_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace wi::graphics

namespace vulkan_internal
{

// These shifts are made so that Vulkan resource bindings slots don't interfere with each other across shader stages:
// These are also defined in wi::shadercompiler.cpp as hard coded compiler arguments for SPIRV, so they need to be the same
enum
Expand Down Expand Up @@ -630,6 +631,10 @@ namespace vulkan_internal
return VK_FALSE;
}

inline std::string get_shader_cache_path()
{
return wi::helper::GetCurrentPath() + "/pso_cache_vulkan";
}

struct BindingUsage
{
Expand Down Expand Up @@ -1109,11 +1114,6 @@ namespace vulkan_internal
return static_cast<VideoDecoder_Vulkan*>(param->internal_state.get());
}

inline const std::string GetCachePath()
{
return wi::helper::GetCacheDirectoryPath() + "/wiPipelineCache_Vulkan";
}

bool CreateSwapChainInternal(
SwapChain_Vulkan* internal_state,
VkPhysicalDevice physicalDevice,
Expand Down Expand Up @@ -3413,9 +3413,7 @@ using namespace vulkan_internal;
{
// Try to read pipeline cache file if exists.
wi::vector<uint8_t> pipelineData;

std::string cachePath = GetCachePath();
if (!wi::helper::FileRead(cachePath, pipelineData))
if (!wi::helper::FileRead(get_shader_cache_path(), pipelineData))
{
pipelineData.clear();
}
Expand Down Expand Up @@ -3688,8 +3686,7 @@ using namespace vulkan_internal;
assert(res == VK_SUCCESS);

// Write pipeline cache data to a file in binary format
std::string cachePath = GetCachePath();
wi::helper::FileWrite(cachePath, data.data(), size);
wi::helper::FileWrite(get_shader_cache_path(), data.data(), size);

// Destroy Vulkan pipeline cache
vkDestroyPipelineCache(device, pipelineCache, nullptr);
Expand Down
4 changes: 3 additions & 1 deletion WickedEngine/wiLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ namespace wi::lua
TrailRenderer_BindLua::Bind();
Async_BindLua::Bind();

wi::backlog::post("wi::lua Initialized (" + std::to_string((int)std::round(timer.elapsed())) + " ms)");
char text[256] = {};
snprintf(text, arraysize(text), "wi::lua Initialized [Lua %s.%s] (%d ms)", LUA_VERSION_MAJOR, LUA_VERSION_MINOR, (int)std::round(timer.elapsed()));
wi::backlog::post(text);
}

lua_State* GetLuaState()
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/wiVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 628;
const int revision = 629;

const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);

Expand Down

0 comments on commit c8b84f0

Please sign in to comment.