diff --git a/Source/Engine/Renderer/GlobalSurfaceAtlasPass.cpp b/Source/Engine/Renderer/GlobalSurfaceAtlasPass.cpp index 52fa4c9dc..8268f5994 100644 --- a/Source/Engine/Renderer/GlobalSurfaceAtlasPass.cpp +++ b/Source/Engine/Renderer/GlobalSurfaceAtlasPass.cpp @@ -609,7 +609,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co } // Allocate buffer for culled objects (estimated size) - objectsBufferCapacity = Math::AlignUp(objectsBufferCapacity, 4096u); + objectsBufferCapacity = Math::Min(Math::AlignUp(objectsBufferCapacity, 4096u), (uint32)MAX_int32); if (!surfaceAtlasData.CulledObjectsBuffer) surfaceAtlasData.CulledObjectsBuffer = GPUDevice::Instance->CreateBuffer(TEXT("GlobalSurfaceAtlas.CulledObjectsBuffer")); if (surfaceAtlasData.CulledObjectsBuffer->GetSize() < objectsBufferCapacity) diff --git a/Source/Engine/ShadersCompilation/ShaderCompiler.cpp b/Source/Engine/ShadersCompilation/ShaderCompiler.cpp index eba91df76..afca3c4b5 100644 --- a/Source/Engine/ShadersCompilation/ShaderCompiler.cpp +++ b/Source/Engine/ShadersCompilation/ShaderCompiler.cpp @@ -25,7 +25,7 @@ namespace IncludedFiles { String Path; DateTime LastEditTime; - Array Source; + StringAnsi Source; }; CriticalSection Locker; @@ -222,7 +222,7 @@ bool ShaderCompiler::GetIncludedFileSource(ShaderCompilationContext* context, co result = New(); result->Path = path; result->LastEditTime = FileSystem::GetFileLastEditTime(path); - if (File::ReadAllBytes(result->Path, result->Source)) + if (File::ReadAllText(result->Path, result->Source)) { LOG(Error, "Failed to load shader source file '{0}' included in '{1}' (path: '{2}')", String(includedFile), String(sourceFile), path); Delete(result); @@ -234,8 +234,8 @@ bool ShaderCompiler::GetIncludedFileSource(ShaderCompilationContext* context, co context->Includes.Add(path); // Copy to output - source = (const char*)result->Source.Get(); - sourceLength = result->Source.Count() - 1; + source = result->Source.Get(); + sourceLength = result->Source.Length(); return false; }