Skip to content

Commit

Permalink
Add check if shader folder exists
Browse files Browse the repository at this point in the history
  • Loading branch information
edunad committed Aug 1, 2024
1 parent 17ed85b commit 0426151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rawrbox.render/include/rawrbox/render/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ namespace rawrbox {
[[nodiscard]] virtual Diligent::ITextureView* getDepth() const;
[[nodiscard]] virtual Diligent::ITextureView* getColor(bool rt = false) const;

[[nodiscard]] virtual std::string getShadersDirectory() const;
[[nodiscard]] virtual std::filesystem::path getShadersDirectory() const;
[[nodiscard]] virtual const Diligent::RENDER_DEVICE_TYPE& getRenderType() const;

#ifdef _DEBUG
Expand Down
6 changes: 4 additions & 2 deletions rawrbox.render/src/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ namespace rawrbox {
// Setup shader pipeline if not exists
if (rawrbox::SHADER_FACTORY == nullptr) {
auto rootDir = this->getShadersDirectory();
if (!std::filesystem::exists(rootDir)) throw this->_logger->error("Shaders directory '{}' not found!", rootDir.generic_string());

auto dirs = rawrbox::PathUtils::glob(rootDir, true);
auto paths = fmt::format("{}", fmt::join(dirs, ";"));

this->_logger->info("Initializing shader factory (using {}):", fmt::styled(rootDir, fmt::fg(fmt::color::coral)));
this->_logger->info("Initializing shader factory (using {}):", fmt::styled(rootDir.generic_string(), fmt::fg(fmt::color::coral)));
for (const auto& dir : dirs) {
this->_logger->info("\t{}", dir);
}
Expand Down Expand Up @@ -691,7 +693,7 @@ namespace rawrbox {
return rt ? this->_render->getRT() : this->_render->getHandle();
}

std::string RendererBase::getShadersDirectory() const {
std::filesystem::path RendererBase::getShadersDirectory() const {
return "./assets/shaders";
}

Expand Down

0 comments on commit 0426151

Please sign in to comment.