Opened 3 years ago
Closed 2 years ago
#6033 closed defect (fixed)
Crash in Shader Preprocessor
Reported by: | Asger | Owned by: | Vladislav Belov |
---|---|---|---|
Priority: | Release Blocker | Milestone: | Alpha 26 |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description
Crashed while loading a multiplayer game.
Attachments (4)
Change History (13)
by , 3 years ago
Attachment: | crashlog.txt added |
---|
by , 3 years ago
Attachment: | crashlog.dmp added |
---|
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Summary: | unhandled exception → Crash in Shader Preprocessor |
---|
Old one:
> [Cadre en ligne] pyrogenesis.exe!Ogre::CPreprocessor::Token::operator==(const Ogre::CPreprocessor::Token &) Ligne 175 C++ pyrogenesis.exe!Ogre::CPreprocessor::IsDefined(const Ogre::CPreprocessor::Token & iToken) Ligne 391 C++ pyrogenesis.exe!Ogre::CPreprocessor::ExpandMacro(const Ogre::CPreprocessor::Token & iToken) Ligne 400 C++ pyrogenesis.exe!Ogre::CPreprocessor::GetToken(bool iExpand) Ligne 303 C++ pyrogenesis.exe!Ogre::CPreprocessor::GetExpression(Ogre::CPreprocessor::Token & oResult, int iLine, int iOpPriority) Ligne 469 C++ pyrogenesis.exe!Ogre::CPreprocessor::GetExpression(Ogre::CPreprocessor::Token & oResult, int iLine, int iOpPriority) Ligne 484 C++ pyrogenesis.exe!Ogre::CPreprocessor::GetExpression(Ogre::CPreprocessor::Token & oResult, int iLine, int iOpPriority) Ligne 579 C++ pyrogenesis.exe!Ogre::CPreprocessor::GetValue(const Ogre::CPreprocessor::Token & iToken, long & oValue, int iLine) Ligne 669 C++ pyrogenesis.exe!Ogre::CPreprocessor::GetValueDef(const Ogre::CPreprocessor::Token & iToken, long & oValue, int iLine) Ligne 1055 C++ [Cadre en ligne] pyrogenesis.exe!Ogre::CPreprocessor::HandleIf(Ogre::CPreprocessor::Token &) Ligne 1066 C++ pyrogenesis.exe!Ogre::CPreprocessor::HandleDirective(Ogre::CPreprocessor::Token & iToken, int iLine) Ligne 1210 C++ pyrogenesis.exe!Ogre::CPreprocessor::Parse(const Ogre::CPreprocessor::Token & iSource) Ligne 1318 C++ pyrogenesis.exe!Ogre::CPreprocessor::Parse(const char * iSource, unsigned int iLength, unsigned int & oLength) Ligne 1372 C++ pyrogenesis.exe!CPreprocessorWrapper::Preprocess(const CStr8 & input) Ligne 257 C++ pyrogenesis.exe!CShaderProgramGLSL::Reload() Ligne 466 C++ pyrogenesis.exe!CShaderManager::NewProgram(const char * name, const CShaderDefines & baseDefines, std::shared_ptr<CShaderProgram> & program) Ligne 272 C++ pyrogenesis.exe!CShaderManager::LoadProgram(const char * name, const CShaderDefines & defines) Ligne 69 C++ pyrogenesis.exe!CShaderManager::NewEffect(const char * name, const CShaderDefines & baseDefines, std::shared_ptr<CShaderTechnique> & tech) Ligne 546 C++ pyrogenesis.exe!CShaderManager::LoadEffect(CStrIntern name, const CShaderDefines & defines1, const CShaderDefines & defines2) Ligne 370 C++ pyrogenesis.exe!CPatchRData::RenderBases(const std::vector<CPatchRData *,std::allocator<CPatchRData *>> & patches, const CShaderDefines & context, ShadowMap * shadow, bool isDummyShader, const std::shared_ptr<CShaderProgram> & dummy) Ligne 767 C++ pyrogenesis.exe!TerrainRenderer::RenderTerrainShader(const CShaderDefines & context, int cullGroup, ShadowMap * shadow) Ligne 302 C++ pyrogenesis.exe!CRenderer::RenderPatches(const CShaderDefines & context, int cullGroup) Ligne 765 C++ pyrogenesis.exe!CRenderer::RenderSubmissions(const CBoundingBoxAligned & waterScissor) Ligne 1340 C++ pyrogenesis.exe!CRenderer::RenderScene(Scene & scene) Ligne 1707 C++ pyrogenesis.exe!CGameView::Render() Ligne 240 C++ pyrogenesis.exe!Render() Ligne 240 C++ pyrogenesis.exe!CGame::ReallyStartGame() Ligne 319 C++ pyrogenesis.exe!`anonymous namespace'::StartGame(JS::MutableHandle<JS::Value> attrs) Ligne 94 C++ pyrogenesis.exe!AtlasMessage::fLoadMap(AtlasMessage::mLoadMap * msg) Ligne 190 C++ pyrogenesis.exe!AtlasMessage::fLoadMap_wrapper(AtlasMessage::IMessage * msg) Ligne 170 C++ pyrogenesis.exe!MessagePasserImpl::Add(AtlasMessage::IMessage * msg) Ligne 44 C++ [Code externe] AtlasUI.dll![Les frames ci-dessous sont peut-être incorrects et/ou manquants, aucun symbole chargé pour AtlasUI.dll] Inconnu
by , 3 years ago
Attachment: | userreport_hwdetect.txt added |
---|
by , 3 years ago
Attachment: | system_info.txt added |
---|
comment:4 by , 3 years ago
Milestone: | Alpha 24 → Alpha 25 |
---|
comment:6 by , 3 years ago
Milestone: | Alpha 25 → Alpha 26 |
---|
Won't be fixed for A25, as there is no one to work on it. It's also pretty hard to reproduce it with a debugger attached.
comment:7 by , 2 years ago
Randomly caught for a patched SVN (r26785):
Ogre::CPreprocessor::Token::operator==(const Ogre::CPreprocessor::Token &) Line 175 Ogre::CPreprocessor::IsDefined(const Ogre::CPreprocessor::Token & iToken) Line 391 Ogre::CPreprocessor::HandleIfDef(Ogre::CPreprocessor::Token & iBody, int iLine) Line 1019 Ogre::CPreprocessor::HandleDirective(Ogre::CPreprocessor::Token & iToken, int iLine) Line 1203 Ogre::CPreprocessor::Parse(const Ogre::CPreprocessor::Token & iSource) Line 1318 Ogre::CPreprocessor::Parse(const char * iSource, unsigned int iLength, unsigned int & oLength) Line 1372 CPreprocessorWrapper::Preprocess(const CStr8 & input) Line 259 Renderer::Backend::GL::CShaderProgramGLSL::CShaderProgramGLSL(Renderer::Backend::GL::CDevice * device, const CStr8 & name, const Path & vertexFilePath, const Path & fragmentFilePath, const CShaderDefines & defines, const std::map<CStrIntern,int,std::less<CStrIntern>,std::allocator<std::pair<CStrIntern const ,int> > > & vertexAttribs, int streamflags) Line 422 std::make_unique(Renderer::Backend::GL::CDevice * &) Line 2539 Renderer::Backend::GL::CShaderProgram::ConstructGLSL(Renderer::Backend::GL::CDevice *) Line 1027 Renderer::Backend::GL::CShaderProgram::Create(Renderer::Backend::GL::CDevice * device, const CStr8 & name, const CShaderDefines & baseDefines) Line 990 Renderer::Backend::GL::CDevice::CreateShaderProgram(const CStr8 & name, const CShaderDefines & defines) Line 827 CShaderProgram::Reload() Line 40 CShaderManager::LoadProgram(const CStr8 & name, const CShaderDefines & defines) Line 82 CShaderManager::NewEffect(const CStr8 & name, const CShaderDefines & baseDefines, std::shared_ptr<CShaderTechnique> & tech) Line 395 CShaderManager::LoadEffect(CStrIntern name, const CShaderDefines & defines) Line 122 ShaderModelRenderer::Render(Renderer::Backend::GL::CDeviceCommandContext * deviceCommandContext, const std::shared_ptr<RenderModifier> & modifier, const CShaderDefines & context, int cullGroup, int flags) Line 474 CSceneRenderer::Internals::CallTranspModelRenderers(Renderer::Backend::GL::CDeviceCommandContext * deviceCommandContext, const CShaderDefines & context, int cullGroup, int flags) Line 185 CSceneRenderer::RenderTransparentModels(Renderer::Backend::GL::CDeviceCommandContext * deviceCommandContext, const CShaderDefines & context, int cullGroup, ETransparentMode transparentMode) Line 418 CSceneRenderer::RenderSubmissions(Renderer::Backend::GL::CDeviceCommandContext * deviceCommandContext, const CBoundingBoxAligned & waterScissor) Line 894 CSceneRenderer::RenderScene(Renderer::Backend::GL::CDeviceCommandContext * deviceCommandContext, Scene & scene) Line 1166 CGameView::Render() Line 238 CRenderer::RenderFrameImpl(const bool renderGUI, const bool renderLogger) Line 466 CRenderer::RenderFrame(bool needsPresent) Line 420 Frame() Line 454 RunGameOrAtlas(int argc, const char * * argv) Line 691 SDL_main(int argc, char * * argv) Line 743 main_getcmdline() Line 74 C [External Code] CallStartupWithinTryBlock() Line 363 [External Code]
It seems the problem is in a corrupted Token::Name
inside Macro
in MacroList
.
comment:8 by , 2 years ago
The bug was introduced in r9123 but appeared only in r24553 because before that we didn't have defines in the shaders code.
Explaining:
First of all a CPreprocessorWrapper instance is created and input defines are added. Then we run preprocess for vertex shader code created from its file buffer. The run resolves includes for the source and run the Ogre preprocessor (Ogre::CPreprocessor). After that the processor might contain new macros pointing to a memory inside the source code or the resolved source code (particularly include guards after r24553). Then the original string and the string with resolved includes are deleted. After that we try to preprocess the fragment shader code created from its file buffer. And during that step we crash but rarely. Because highly likely the fragment shader code will be allocated in the freed memory from the vertex step.
Callstack: