From 4cc7ec04617f9afe9a93d1d9667ad0d1d69131bc Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 24 Feb 2021 00:21:02 +0100 Subject: [PATCH] Fix compilation errors on CI --- Source/Engine/Platform/Linux/IncludeX11.h | 4 ++++ Source/Engine/Renderer/AmbientOcclusionPass.cpp | 13 +++++++------ Source/Engine/Tools/TextureTool/TextureTool.stb.cpp | 1 - Source/ThirdParty/stb/stb_image_write.h | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/Engine/Platform/Linux/IncludeX11.h b/Source/Engine/Platform/Linux/IncludeX11.h index c286d4060..df1dcdc86 100644 --- a/Source/Engine/Platform/Linux/IncludeX11.h +++ b/Source/Engine/Platform/Linux/IncludeX11.h @@ -5,6 +5,10 @@ // Hide warning from old headers #define register +// Pre-include X11 required headers +#include + +// Include X11 namespace X11 { #include diff --git a/Source/Engine/Renderer/AmbientOcclusionPass.cpp b/Source/Engine/Renderer/AmbientOcclusionPass.cpp index e72de509b..46027e118 100644 --- a/Source/Engine/Renderer/AmbientOcclusionPass.cpp +++ b/Source/Engine/Renderer/AmbientOcclusionPass.cpp @@ -8,6 +8,7 @@ #include "Engine/Graphics/RenderTask.h" #include "Engine/Graphics/RenderTargetPool.h" #include "Engine/Graphics/RenderBuffers.h" +#include "Engine/Utilities/StringConverter.h" #include "RenderList.h" #include "GBufferPass.h" @@ -86,8 +87,6 @@ bool AmbientOcclusionPass::Init() bool AmbientOcclusionPass::setupResources() { - char nameBuffer[40]; - // Check shader if (!_shader->IsLoaded()) { @@ -122,8 +121,9 @@ bool AmbientOcclusionPass::setupResources() { if (!_psPrepareDepthMip[i]->IsValid()) { - sprintf(nameBuffer, "PS_PrepareDepthMip%d", i + 1); - psDesc.PS = shader->GetPS(nameBuffer); + const auto str = String::Format(TEXT("PS_PrepareDepthMip{0}"), i + 1); + const StringAsANSI<50> strAnsi(*str, str.Length()); + psDesc.PS = shader->GetPS(strAnsi.Get()); if (_psPrepareDepthMip[i]->Init(psDesc)) return true; } @@ -133,8 +133,9 @@ bool AmbientOcclusionPass::setupResources() { if (!_psGenerate[i]->IsValid()) { - sprintf(nameBuffer, "PS_GenerateQ%d", i); - psDesc.PS = shader->GetPS(nameBuffer); + const auto str = String::Format(TEXT("PS_GenerateQ{0}"), i); + const StringAsANSI<50> strAnsi(*str, str.Length()); + psDesc.PS = shader->GetPS(strAnsi.Get()); if (_psGenerate[i]->Init(psDesc)) return true; } diff --git a/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp b/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp index 9d4bdcad8..7cc34813f 100644 --- a/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp +++ b/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp @@ -16,7 +16,6 @@ #define STBI_REALLOC_SIZED(p, oldsz, newsz) AllocatorExt::Realloc(p, oldsz, newsz) #define STBI_FREE(p) Allocator::Free(p) -#define STBI_WRITE_NO_STDIO #define STB_IMAGE_WRITE_IMPLEMENTATION #include diff --git a/Source/ThirdParty/stb/stb_image_write.h b/Source/ThirdParty/stb/stb_image_write.h index a9bf66c14..9e0b38d42 100644 --- a/Source/ThirdParty/stb/stb_image_write.h +++ b/Source/ThirdParty/stb/stb_image_write.h @@ -615,6 +615,7 @@ static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) } } +#ifndef STBI_WRITE_NO_STDIO static void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte) { unsigned char lengthbyte = STBIW_UCHAR(length+128); @@ -753,7 +754,6 @@ STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, return stbi_write_hdr_core(&s, x, y, comp, (float *) data); } -#ifndef STBI_WRITE_NO_STDIO STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data) { stbi__write_context s;