Cleanup: Proper printing of a string

Print it as a "%s" so that possible percentage symbols in the
error message does not cause issues.

Use proper assert (assert(true) is a no-op).

Also use `empty()` instead of `length()`.

Reviewed with Clement in real life.
This commit is contained in:
Sergey Sharybin 2022-04-13 11:55:37 +02:00
parent 402845744f
commit 3a88f151c4
1 changed files with 4 additions and 4 deletions

View File

@ -283,10 +283,10 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
GPU_debug_group_begin(GPU_DEBUG_SHADER_COMPILATION_GROUP);
std::string error = info.check_error();
if (error.length()) {
printf(error.c_str());
BLI_assert(true);
const std::string error = info.check_error();
if (!error.empty()) {
printf("%s\n", error.c_str());
BLI_assert(false);
}
Shader *shader = GPUBackend::get()->shader_alloc(info.name_.c_str());