Skip to content

Commit

Permalink
remove spdlog.
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkClinton committed Oct 31, 2023
1 parent 34e9ebc commit 4b032d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 67 deletions.
5 changes: 4 additions & 1 deletion descriptors/root_signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ wrapper::directx12::root_signature wrapper::directx12::root_signature::create(co
auto error = copy_data_to_string(error_blob->GetBufferPointer(), error_blob->GetBufferSize());

if (!error.empty() && error.back() == '\n') error.pop_back();
if (!error.empty()) directx12::error(error);
if (!error.empty())
{
throw std::exception(error.c_str());
}
}

device->CreateRootSignature(0, signature_blob->GetBufferPointer(), signature_blob->GetBufferSize(),
Expand Down
10 changes: 8 additions & 2 deletions extensions/dxc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ namespace wrapper::directx12::extensions
auto error = copy_data_to_string(error_code->GetBufferPointer(), error_code->GetBufferSize());

if (!error.empty() && error.back() == '\n') error.pop_back();
if (!error.empty()) directx12::error(error);
if (!error.empty())
{
throw std::exception(error.c_str());
}

auto code = std::vector<byte>(result_code->GetBufferSize());

Expand Down Expand Up @@ -138,7 +141,10 @@ namespace wrapper::directx12::extensions
auto error = copy_data_to_string(error_code->GetBufferPointer(), error_code->GetBufferSize());

if (!error.empty() && error.back() == '\n') error.pop_back();
if (!error.empty()) directx12::error(error);
if (!error.empty())
{
throw std::exception(error.c_str());
}

auto code = std::vector<byte>(result_code->GetBufferSize());

Expand Down
64 changes: 0 additions & 64 deletions utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,8 @@
#undef max
#undef min

#ifndef __LOG_SPDLOG_IMPLEMENTATION__
#else
#pragma warning(disable : 4275)
#include <spdlog/spdlog.h>
#endif

#ifdef __LOG_SPDLOG_IMPLEMENTATION__
#ifdef __LOG_USER_IMPLEMENTATION__
static_assert(false, "'__LOG_SPDLOG_IMPLEMENTATION__' and '__LOG_USER_IMPLEMENTATION__' can not be defined at the same time.");
#endif
#endif

namespace wrapper::directx12
{

using Microsoft::WRL::ComPtr;

using uint64 = unsigned long long;
Expand All @@ -56,55 +43,4 @@ namespace wrapper::directx12
std::string wide_string_to_multi_bytes_string(const std::wstring& wide_string);

std::wstring multi_bytes_string_to_wide_string(const std::string& string);

template <typename... Args>
void debug(const std::string_view& format, const Args& ... args);

template <typename... Args>
void info(const std::string_view& format, const Args& ... args);

template <typename... Args>
void warn(const std::string_view& format, const Args& ... args);

template <typename... Args>
void error(const std::string_view& format, const Args& ... args);

#ifdef __LOG_SPDLOG_IMPLEMENTATION__
template <typename... Args>
void debug(const std::string_view& format, const Args& ... args) { spdlog::debug(format, args...); }

template <typename... Args>
void info(const std::string_view& format, const Args& ... args) { spdlog::info(format, args...); }

template <typename... Args>
void warn(const std::string_view& format, const Args& ... args) { spdlog::warn(format, args...); }

template <typename... Args>
void error(const std::string_view& format, const Args& ... args) { spdlog::error(format, args...); }
#else
template <typename... Args>
void debug(const std::string_view& format, const Args& ... args)
{
printf(format.data());
}

template <typename... Args>
void info(const std::string_view& format, const Args& ... args)
{
printf(format.data());
}

template <typename... Args>
void warn(const std::string_view& format, const Args& ... args)
{
printf(format.data());
}

template <typename... Args>
void error(const std::string_view& format, const Args& ... args)
{
printf(format.data());
}
#endif

}

0 comments on commit 4b032d3

Please sign in to comment.