From 940e1b33d2b430331ea91fd723cbd84f31735573 Mon Sep 17 00:00:00 2001 From: Atdunbg Date: Sat, 22 Nov 2025 13:44:46 +0800 Subject: [PATCH] fix shader source read in linux --- Prism/src/Prism/Platform/OpenGL/OpenGLShader.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Prism/src/Prism/Platform/OpenGL/OpenGLShader.cpp b/Prism/src/Prism/Platform/OpenGL/OpenGLShader.cpp index a0c833d..eb84dde 100644 --- a/Prism/src/Prism/Platform/OpenGL/OpenGLShader.cpp +++ b/Prism/src/Prism/Platform/OpenGL/OpenGLShader.cpp @@ -65,6 +65,13 @@ namespace Prism while (pos != std::string::npos) { size_t eol = m_ShaderSource.find("\r\n", pos); + if (eol == std::string::npos) { + eol = m_ShaderSource.find('\n', pos); + if (eol == std::string::npos) { + eol = m_ShaderSource.find('\r', pos); + } + } + PM_CORE_ASSERT(eol != std::string::npos, "Syntax error"); size_t begin = pos + typeTokenLength + 1; std::string type = m_ShaderSource.substr(begin, eol - begin);