Skip to content

Commit

Permalink
feat: add compiler warnings for debug (#330)
Browse files Browse the repository at this point in the history
* refactor: switch to cpp style cast

* feat: add compiler warnings for debug
  • Loading branch information
alandtse authored Jul 9, 2024
1 parent 0339516 commit 02e0c26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/ShaderCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,8 @@ namespace SIE
cache.AddCompletedShader(shaderClass, shader, descriptor, nullptr);
return nullptr;
}
if (errorBlob)
logger::debug("Shader logs:\n{}", static_cast<char*>(errorBlob->GetBufferPointer()));
logger::debug("Compiled shader {}:{}:{:X}", magic_enum::enum_name(type), magic_enum::enum_name(shaderClass), descriptor);

// strip debug info
Expand Down
4 changes: 2 additions & 2 deletions src/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ namespace Util
}
logger::debug("Compiling {} with {}", str, DefinesToString(macros));
if (FAILED(D3DCompileFromFile(FilePath, macros.data(), D3D_COMPILE_STANDARD_FILE_INCLUDE, Program, ProgramType, flags, 0, &shaderBlob, &shaderErrors))) {
logger::warn("Shader compilation failed:\n\n{}", shaderErrors ? (const char*)shaderErrors->GetBufferPointer() : "Unknown error");
logger::warn("Shader compilation failed:\n\n{}", shaderErrors ? static_cast<char*>(shaderErrors->GetBufferPointer()) : "Unknown error");
return nullptr;
}
if (shaderErrors)
logger::debug("Shader logs:\n{}", (const char*)shaderErrors->GetBufferPointer());
logger::debug("Shader logs:\n{}", static_cast<char*>(shaderErrors->GetBufferPointer()));
if (!_stricmp(ProgramType, "ps_5_0")) {
ID3D11PixelShader* regShader;
device->CreatePixelShader(shaderBlob->GetBufferPointer(), shaderBlob->GetBufferSize(), nullptr, &regShader);
Expand Down

0 comments on commit 02e0c26

Please sign in to comment.