New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shader fails to initialize uniform variable on linux #3737
Comments
So the warning you're seeing is something we will need to fix. But i don't think its actually what's throwing the error that you're seeing in the viewer. Can you check your compatibility with iTwin.js here ? |
Let me know what kind of debugging information you need. I'll be glad to help. |
Please provide the iTwin.js Version you're using |
Hi @aruniverse See my package.json configuration: { |
Thanks for the info @tangytang. This error is most likely the result of your specific graphics card driver having optimized away one of the variables used by a shader program. We compile all of our shaders on Linux, Windows, and macOS without error, but some drivers are smarter about optimizations. We will investigate and fix the shader. |
I am able to reproduce this on my Ubuntu box with GPU enabled. The core-frontend shader compilation tests use software rendering, which does not produce this error. |
Investigation results: the problematic shader's description is "Surface: Opaque-Instanced-Pick". The vertex shader uses u_patternFeatureId to compute g_featureIndex but never forwards the result to the fragment shader, so that all gets optimized away. The fragment shader outputs zero for FragColor1 and FragColor2, instead of outputting the pick data. |
This appears to have been introduced 3 years ago. That PR made it so that for the combination of FeatureMode.Pick and IsEdgeTestNeeded.No (excluding classifiers), the shader computes the feature index but does nothing with it. Presumably we were relying on the compiler to optimize out those unnecessary computations, but the introduction of u_patternFeatureId appears to show that only Linux fully optimizes them, including removal of the uniform. Ideally we would not include those computations in the first place. |
@pmconne @markschlosseratbentley - I looked at the output glsl, the hlsl, and the compiled assembly for Angle for this case and it is fully optimized. The way Angle and D3D work, it does leave the u_patternFeatureId in the uniform table, but marks it as unused (which is why we don't get a uniform error). All references, calculations, texture lookups for calculations, etc. have been removed. I suppose there is the very small CPU overhead of writing the value to this unused location, and ideally we should not generate unused code in glsl (for confusion if nothing else), but with #3754 done, to me fixing this becomes a low priority. |
Closing this because #3754 is merged and fixed the issue. Related issue #3740 has been also closed. I have created #3773 to track any remaining work based on the comments from @DStradley above. |
We also fixed the findDOMNode warning in the console with iTwin/viewer-components-react#283. |
Description of Problem
Unable to get Viewer App started due to error in the console:
Error Code
Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of HeaderRow which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
at div
at t (http://localhost:3000/static/js/vendors~main.chunk.js:517983:89125)
at div
at t (http://localhost:3000/static/js/vendors~main.chunk.js:517983:83671)
at div
at t (http://localhost:3000/static/js/vendors~main.chunk.js:517983:76743)
at div
at div
at t (http://localhost:3000/static/js/vendors~main.chunk.js:517983:57330)
at ElementResizeObserver (http://localhost:3000/static/js/vendors~main.chunk.js:352917:34)
at div
at Table (http://localhost:3000/static/js/vendors~main.chunk.js:95475:9)
at div
at div
at ElementList (http://localhost:3000/static/js/vendors~main.chunk.js:422371:24)
at div
at div
at div
at MultiElementPropertyGrid (http://localhost:3000/static/js/vendors~main.chunk.js:422657:114)
at div
at ScrollableWidgetContent (http://localhost:3000/static/js/vendors~main.chunk.js:23773:72)
at WidgetContent (http://localhost:3000/static/js/vendors~main.chunk.js:69546:20)
at WidgetContentRenderer (http://localhost:3000/static/js/vendors~main.chunk.js:24132:82)
at WidgetContentRenderers (http://localhost:3000/static/js/vendors~main.chunk.js:24119:75)
at div
at WidgetPanelsComponent (http://localhost:3000/static/js/vendors~main.chunk.js:23558:69)
at WidgetPanels (http://localhost:3000/static/js/vendors~main.chunk.js:23552:109)
at WidgetInternals (http://localhost:3000/static/js/vendors~main.chunk.js:69678:133)
at WidgetPanelsFrontstageComponent
at WidgetContentManager (http://localhost:3000/static/js/vendors~main.chunk.js:24054:87)
at CursorTypeProvider (http://localhost:3000/static/js/vendors~main.chunk.js:11285:72)
at DraggedResizeHandleProvider (http://localhost:3000/static/js/vendors~main.chunk.js:10865:19)
at DraggedPanelSideProvider (http://localhost:3000/static/js/vendors~main.chunk.js:10861:27)
at DraggedWidgetIdProvider (http://localhost:3000/static/js/vendors~main.chunk.js:10857:21)
at DragProvider (http://localhost:3000/static/js/vendors~main.chunk.js:10832:69)
at NineZoneProvider (http://localhost:3000/static/js/vendors~main.chunk.js:11205:106)
at NineZone (http://localhost:3000/static/js/vendors~main.chunk.js:11192:13)
at div
at ActiveFrontstageDefProvider (http://localhost:3000/static/js/vendors~main.chunk.js:69816:40)
at WidgetPanelsFrontstage (http://localhost:3000/static/js/vendors~main.chunk.js:69798:112)
at main
at ConfigurableUiContent (http://localhost:3000/static/js/vendors~main.chunk.js:39810:108)
at FrameworkVersion (http://localhost:3000/static/js/vendors~main.chunk.js:48691:86)
at ThemeProvider (http://localhost:3000/static/js/vendors~main.chunk.js:393848:23)
at div
at ThemeManagerComponent (http://localhost:3000/static/js/vendors~main.chunk.js:64240:9)
at ConnectFunction (http://localhost:3000/static/js/vendors~main.chunk.js:552838:75)
at IModelViewer (http://localhost:3000/static/js/vendors~main.chunk.js:428932:25)
at Provider (http://localhost:3000/static/js/vendors~main.chunk.js:552543:20)
at div
at http://localhost:3000/static/js/vendors~main.chunk.js:428716:69
at IModelLoader (http://localhost:3000/static/js/vendors~main.chunk.js:428809:15)
at ErrorBoundary (http://localhost:3000/static/js/vendors~main.chunk.js:354037:9)
at BaseViewer (http://localhost:3000/static/js/vendors~main.chunk.js:428155:23)
at Viewer (http://localhost:3000/static/js/vendors~main.chunk.js:431180:80)
at div
at App (http://localhost:3000/static/js/main.chunk.js:182:89)
The text was updated successfully, but these errors were encountered: