baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
9.03k stars 1.35k forks source link

Respect the XDG base directory specification’s environment variables #723

Closed linkmauve closed 6 years ago

linkmauve commented 7 years ago

As of 177d595d4fadfcff72d7dc351647b1726aabc4e6, RenderDoc creates a ~/.local/share/vulkan/implicit_layer.d/renderdoc_capture.json file, no matter the value of $XDG_DATA_HOME.

It should first check the value of $XDG_DATA_HOME, if it’s an absolute path create the file in $XDG_DATA_HOME/vulkan/implicit_layer.d/renderdoc_capture.json, otherwise use the curent path.

See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables for more information.

baldurk commented 7 years ago

This should be fixed on v1.x now - if $XDG_DATA_HOME is set and exists as a path it's used in preference.

Please check this on the latest v1.x nightly build or compile manually from v1.x, and let me know if you have any further issues.

linkmauve commented 7 years ago

I just tested, there is still one issue which is when the user manually sets $XDG_DATA_HOME to a non-existent directory, for testing or for greater separation, it is ignored altogether.

The solution would be to replace FileIO::exists(xdg) with a check that the path is just absolute, since that’s the only requirement.

baldurk commented 7 years ago

Is there anything to clarify explicitly what the behaviour should be? The spec isn't worded well, the only time it mentions directories existing or being created is at the end which seems to only refer to $XDG_RUNTIME_DIR which is a bit different.

It wouldn't be useful to set the dir to something unique or different to any other application, since then the layer wouldn't get picked up by the loader when the vulkan application runs.

baldurk commented 6 years ago

v1.0 has now released, including the change as described above.

nyorain commented 6 years ago

The vulkan shader cache and other files are still stored/expected in ~/.renderdoc. I guess this function would have to change. Probably best to use XDG_CONFIG_HOME since some config files seem to be stored there but then the shader cache would be a bit out of place.

linkmauve commented 6 years ago

Shader cache would have to go into $XDG_CACHE_HOME/renderdoc/ instead.

shmerl commented 5 years ago

I was testing renderdoc 1.2 recently, and it still creates $HOME/.renderdoc/vkshaders.cache. Is it fixed in 1.4? Debian testing is still a bit behind the last version due to freeze.

If XDG variables are not set, the cache should go into $HOME/.cache/renderdoc, config should go to $HOME/.config/renderdoc and runtime data if any in $HOME/.local/share/renderdoc.

astralchan commented 9 months ago

The current code creates ~/.renderdoc. If XDG compliance is desired, it's typically read via:

configPath <- getenv(XDG_CONFIG_HOME)
if configPath is NULL
    configPath <- getenv(HOME) + ".config"

configPath += "renderdoc"

At the moment, that line of code from earlier I linked always does:

rdcstr ret = homedir + "/.renderdoc/";
baldurk commented 9 months ago

Please do not comment on old issues that have been closed.

If you are encountering a bug or are requesting a feature please open a new issue. You can reference this issue if you wish, but opening a new issue prevents any confusion of accidentally linking two unrelated issues and means that each issue can be handled in a clean process.