Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Unrecognized preprocessor directive #line!

Discussion in 'WebGL' started by McSwan, Dec 8, 2021.

  1. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    107
    I've upgrade our webgl application form 2018 to 2021.1.23f

    I've fixed most of the issues but theere is one I have no idea how to fix.

    The web app runs but when it tries to load a new scene it crashes about half way through the load.

    I think it has something to do with one of the shaders. We use about 40 different shaders. I force load them in the graphics settings under "always include shaders". Is there any way I can tell what shader is causing this issue if it is a shader? ie can I disable the shaders and see pink materials, and re-enable them, but at least it doesn't crash? Any debug suggestions ?

    Eventually PlayerLoop internal function repeasts - probably due to the exception. Turning off exception handling doesn;t help.

    I'm Running under webgl 2.0.

    PC/editor build run perfectly.

    I couldn't find a "#line" preprocessor directive.

    2021Roames.framework.js:13228 Unrecognized preprocessor directive #line!
    preprocess_c_code @ 2021Roames.framework.js:13228
    _glShaderSource @ 2021Roames.framework.js:13258
    $GlslGpuProgramGLES::CompileProgramImpl(unsigned int&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, ShaderChannelMask&, int, unsigned int, int*, int*) @ 2021Roames.wasm:0xbf53b0
    $GfxDevice::CreateGpuProgram(ShaderGpuProgramType, dynamic_array<unsigned char, 0ul> const&, CreateGpuProgramOutput&) @ 2021Roames.wasm:0xc27e7c
    $ShaderLab::SubProgram::Compile(ShaderLab::CompilationData&) @ 2021Roames.wasm:0xc3029e
    $ShaderLab::program::GetMatchingSubProgram(Shader const*, ShaderLab::pass const*, keywords::LocalKeywordState const&, unsigned int, keywords::LocalKeywordState*, ShaderSnippetResult&, bool, bool, int, int) const @ 2021Roames.wasm:0xc33686
    $ShaderLab::pass::ApplyPass(unsigned int, ShaderPropertySheet const*, ShaderPassContext&, keywords::LocalKeywordState const&, Shader*, int, int, bool*, ShaderLab::GrabPasses const*, ShaderLab::SubPrograms*, DeviceRenderStateBlock const*) @ 2021Roames.wasm:0xc3770e
    $ApplyMaterialPassWithCache(SharedMaterialData const&, ShaderPassContext&, Shader*, ShaderLab::pass*, int, int, bool, ShaderLab::GrabPasses const*, ShaderLab::SubPrograms*, DeviceRenderStateBlock const*) @ 2021Roames.wasm:0xc64a22
    $BatchRenderer::ApplyShaderPass(ShaderPassContext&, SharedMaterialData const*, Shader*, BatchRenderer::passInfo&, BatchingFlags, bool, bool, ShaderLab::GrabPasses const*, DeviceRenderStateBlock const*) @ 2021Roames.wasm:0x1c2833
    $ForwardRenderLoopJob(GfxDeviceAsyncCommand::ArgScratch*, GfxDeviceAsyncCommand::Arg const*) @ 2021Roames.wasm:0x1c75b7
    $GfxDevice::ExecuteAsync(int, void (*)(GfxDeviceAsyncCommand::ArgScratch*, GfxDeviceAsyncCommand::Arg const*), GfxDeviceAsyncCommand::ArgScratch**, GfxDeviceAsyncCommand::Arg const*, JobFence const&) @ 2021Roames.wasm:0xc2de86
    $DoForwardShaderRenderLoop(RenderLoopContext const&, dynamic_array<RenderObjectData, 0ul>&, CullResults const&, bool, bool, bool, Camera::RenderFlag) @ 2021Roames.wasm:0x1cac13
    $Camera::DefaultPerformRenderFunction::eek:perator()(Camera*, RenderingPath, CullResults*) @ 2021Roames.wasm:0x2f7653
    $Camera::CustomRender(CullResults&, ShaderPassContext&, CameraRenderingParams const*, Camera::RenderFlag, Camera::performRenderFunction*, void (*)(), void (*)()) @ 2021Roames.wasm:0x2d85a6
    $RenderManager::RenderCameras(int, void (*)(), void (*)()) @ 2021Roames.wasm:0x2ec446
    $InitPlayerLoopCallbacks()::postLateUpdateFinishFrameRenderingRegistrator::Forward() @ 2021Roames.wasm:0xcf398c
    $ExecutePlayerLoop(NativePlayerLoopSystem*) @ 2021Roames.wasm:0x1648bd
    $MainLoop() @ 2021Roames.wasm:0xbab4d5
    $dynCall_v @ 2021Roames.wasm:0x3e9479b
    (anonymous) @ 2021Roames.framework.js:1036
    browserIterationFunc @ 2021Roames.framework.js:10541
    callUserCallback @ 2021Roames.framework.js:8731
    runIter @ 2021Roames.framework.js:8792
    Browser_mainLoop_runner @ 2021Roames.framework.js:8706
    requestAnimationFrame (async)
    requestAnimationFrame @ 2021Roames.framework.js:9074
    Browser_mainLoop_scheduler_rAF @ 2021Roames.framework.js:8608
    Browser_mainLoop_runner @ 2021Roames.framework.js:8710
    requestAnimationFrame (async)
    requestAnimationFrame @ 2021Roames.framework.js:9074
    Browser_mainLoop_scheduler_rAF @ 2021Roames.framework.js:8608
    Browser_mainLoop_runner @ 2021Roames.framework.js:8696
    requestAnimationFrame (async)
    requestAnimationFrame @ 2021Roames.framework.js:9074
    Browser_mainLoop_scheduler_rAF @ 2021Roames.framework.js:8608
    Browser_mainLoop_runner @ 2021Roames.framework.js:8710


    This requestAnimationFrame & Browser_mainLoop_runner part repeats. I get a new error straight after-

    2021Roames.framework.js:12969 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at defined (2021Roames.framework.js:12969)
    at expandMacros (2021Roames.framework.js:13041)
    at preprocess_c_code (2021Roames.framework.js:13174)
    at _glShaderSource (2021Roames.framework.js:13258)
    at GlslGpuProgramGLES::CompileProgramImpl(unsigned int&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&, ShaderChannelMask&, int, unsigned int, int*, int*) (2021Roames.wasm:0xbf53b0)
    at GfxDevice::CreateGpuProgram(ShaderGpuProgramType, dynamic_array<unsigned char, 0ul> const&, CreateGpuProgramOutput&) (2021Roames.wasm:0xc27e7c)
    at ShaderLab::SubProgram::Compile(ShaderLab::CompilationData&) (2021Roames.wasm:0xc3029e)
    at ShaderLab::program::GetMatchingSubProgram(Shader const*, ShaderLab::pass const*, keywords::LocalKeywordState const&, unsigned int, keywords::LocalKeywordState*, ShaderSnippetResult&, bool, bool, int, int) const (2021Roames.wasm:0xc33686)
    at ShaderLab::pass::ApplyPass(unsigned int, ShaderPropertySheet const*, ShaderPassContext&, keywords::LocalKeywordState const&, Shader*, int, int, bool*, ShaderLab::GrabPasses const*, ShaderLab::SubPrograms*, DeviceRenderStateBlock const*) (2021Roames.wasm:0xc3770e)
    at ApplyMaterialPassWithCache(SharedMaterialData const&, ShaderPassContext&, Shader*, ShaderLab::pass*, int, int, bool, ShaderLab::GrabPasses const*, ShaderLab::SubPrograms*, DeviceRenderStateBlock const*) (2021Roames.wasm:0xc64a22)
    at BatchRenderer::ApplyShaderPass(ShaderPassContext&, SharedMaterialData const*, Shader*, BatchRenderer::passInfo&, BatchingFlags, bool, bool, ShaderLab::GrabPasses const*, DeviceRenderStateBlock const*) (2021Roames.wasm:0x1c2833)
    at ForwardRenderLoopJob(GfxDeviceAsyncCommand::ArgScratch*, GfxDeviceAsyncCommand::Arg const*) (2021Roames.wasm:0x1c75b7)
    at GfxDevice::ExecuteAsync(int, void (*)(GfxDeviceAsyncCommand::ArgScratch*, GfxDeviceAsyncCommand::Arg const*), GfxDeviceAsyncCommand::ArgScratch**, GfxDeviceAsyncCommand::Arg const*, JobFence const&) (2021Roames.wasm:0xc2de86)
    at DoForwardShaderRenderLoop(RenderLoopContext const&, dynamic_array<RenderObjectData, 0ul>&, CullResults const&, bool, bool, bool, Camera::RenderFlag) (2021Roames.wasm:0x1cac13)
    at Camera::DefaultPerformRenderFunction::eek:perator()(Camera*, RenderingPath, CullResults*) (2021Roames.wasm:0x2f7653)
    at Camera::CustomRender(CullResults&, ShaderPassContext&, CameraRenderingParams const*, Camera::RenderFlag, Camera::performRenderFunction*, void (*)(), void (*)()) (2021Roames.wasm:0x2d85a6)
    at RenderManager::RenderCameras(int, void (*)(), void (*)()) (2021Roames.wasm:0x2ec446)
    at InitPlayerLoopCallbacks()::postLateUpdateFinishFrameRenderingRegistrator::Forward() (2021Roames.wasm:0xcf398c)
    at ExecutePlayerLoop(NativePlayerLoopSystem*) (2021Roames.wasm:0x1648bd)
    at MainLoop() (2021Roames.wasm:0xbab4d5)
    at dynCall_v (2021Roames.wasm:0x3e9479b)
    at 2021Roames.framework.js:1036
    at browserIterationFunc (2021Roames.framework.js:10541)
    at callUserCallback (2021Roames.framework.js:8731)
    at Object.runIter (2021Roames.framework.js:8792)
    at Browser_mainLoop_runner (2021Roames.framework.js:8706)


    and finally this error

    2021Roames.framework.js:1848 An abnormal situation has occurred: the PlayerLoop internal function has been called recursively. Please contact Customer Support with a sample project so that we can reproduce the problem and troubleshoot it.

    _JS_Log_Dump @ 2021Roames.framework.js:1848
    $WebGLPrintfConsolev(LogType, char const*, void*) @ 2021Roames.wasm:0xdbf73a
    $InternalErrorConsole(char const*, ...) @ 2021Roames.wasm:0xdc065d
    $DebugStringToFilePostprocessedStacktrace(DebugStringToFileData const&) @ 2021Roames.wasm:0xdc049f
    $DebugStringToFile(DebugStringToFileData const&) @ 2021Roames.wasm:0xdbfc8e
    $MainLoop() @ 2021Roames.wasm:0xbab335
    $MainLoopUpdateFromBackground(void*) @ 2021Roames.wasm:0xba7350
    $dynCall_vi @ 2021Roames.wasm:0x3e947a5
    (anonymous) @ 2021Roames.framework.js:1036
    (anonymous) @ 2021Roames.framework.js:10485
    (anonymous) @ 2021Roames.framework.js:10486
     
  2. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    107
    When I build unity in Linux for webgl I get different errors

    I get a boatloads of these. They don't appear when I build webgl under windows.
    WebGL.framework.js.gz:3 The resource Internal-ErrorShader.shader could not be loaded from the resource file!
    UnityEngine.Canvas:GetDefaultCanvasMaterial()
    UnityEngine.UI.Graphic:get_defaultGraphicMaterial()
    TMPro.TMP_InputField:OnEnable()

    [ line 10571716]
     
  3. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    107
    Disabling the broken shader fixed the issue. Make sure full stack trace is enabled, and it may give you a hint as to what shader is broken.