cpichard / usdtweak

Universal Scene Description standalone editor
Apache License 2.0
230 stars 23 forks source link

USDtweak crashes/doesn't render scene when opening a USD #16

Closed ChubbyQuark closed 1 month ago

ChubbyQuark commented 1 month ago

USDtweak crashes when opening any USD file, the console repeatedly puts out the error below:

**Installed usdtweak using the windows installer

Windows 11

OpenUSD v24.05**

Link called without any attached shader objects.

Coding Error: in Execute at line 585 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hdx\colorCorrectionTask.cpp -- Failed verification: ' _CreateShaderResources() ' Coding Error: in CompositeToInterop at line 310 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiInterop\opengl.cpp -- Failed verification: ' glGetError() == GL_NO_ERROR ' Runtime Error: in HgiGLPostPendingGLErrors at line 91 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\diagnostic.cpp -- GL error: invalid enum, reported from cdecl pxrInternal_v0_22pxrReserved::HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder(void) Runtime Error: in HgiGLPostPendingGLErrors at line 91 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\diagnostic.cpp -- GL error: invalid enum, reported from cdecl pxrInternal_v0_22pxrReserved::HgiGL_ScopedStateHolder::~HgiGL_ScopedStateHolder(void) Runtime Error: in HgiGLPostPendingGLErrors at line 91 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\diagnostic.cpp -- GL error: invalid enum, reported from cdecl pxrInternal_v0_22pxrReserved::HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder(void) Runtime Error: in HgiGLPostPendingGLErrors at line 91 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\diagnostic.cpp -- GL error: invalid enum, reported from cdecl pxrInternal_v0_22pxrReserved::HgiGL_ScopedStateHolder::~HgiGL_ScopedStateHolder(void) Coding Error: in HgiGLShaderProgram at line 52 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\shaderProgram.cpp -- Failed verification: ' id>0 ' -- Invalid shader provided to program Coding Error: in HgiGLShaderProgram at line 52 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\shaderProgram.cpp -- Failed verification: ' id>0 ' -- Invalid shader provided to program Runtime Error: in HgiGLPostPendingGLErrors at line 91 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\diagnostic.cpp -- GL error: invalid value, reported from cdecl pxrInternal_v0_22pxrReserved::HgiGLShaderProgram::HgiGLShaderProgram(const struct pxrInternal_v0_22pxrReserved__::HgiShaderProgramDesc &) Coding Error: in _CreateShaderResources at line 296 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hdx\colorCorrectionTask.cpp -- Failed to create color correction shader ERROR: 0:21: 'double' : syntax error syntax error

cpichard commented 1 month ago

Hi @ChubbyQuark , thanks for the crash report. It looks like this is an OpenGL issue as glGetError() == GL_NO_ERROR fails. Does your machine have one dedicated graphic card ? like nvidia/amd or does it have several cards ? If there are several cards you might want to assign usdtweak to the dedicated graphic card, there is a similar issue here https://github.com/cpichard/usdtweak/issues/15 , and the explanation to do it here: https://nvidia.custhelp.com/app/answers/detail/a_id/2615/%7E/how-do-i-customize-optimus-profiles-and-settings this The next usdtweak version will normally select automatically the dedicated graphic card.

ChubbyQuark commented 1 month ago

Hi, great work on the app, looks really promising. Unfortunately my test machine only has an integrated card, I can forward the full spec. if of use? Usdview runs OK, albeit with smaller models.

On Tue, 9 Jul 2024, 07:32 cpichard, @.***> wrote:

Hi @ChubbyQuark https://github.com/ChubbyQuark , thanks for the crash report. It looks like this is an OpenGL issue as glGetError() == GL_NO_ERROR fails. Does your machine have one dedicated graphic card ? like nvidia/amd or does it have several cards ? If there are several cards you might want to assign usdtweak to the dedicated graphic card, there is a similar issue here #15 https://github.com/cpichard/usdtweak/issues/15 , and the explanation to do it here: https://nvidia.custhelp.com/app/answers/detail/a_id/2615/%7E/how-do-i-customize-optimus-profiles-and-settings this The next usdtweak version will normally select automatically the dedicated graphic card.

— Reply to this email directly, view it on GitHub https://github.com/cpichard/usdtweak/issues/16#issuecomment-2216694621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKCHL5MGFG7HJEUJPMJ4PLZLN7XDAVCNFSM6AAAAABKRCK4VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJWGY4TINRSGE . You are receiving this because you were mentioned.Message ID: @.***>

cpichard commented 1 month ago

Hi, it could be that your graphic card doesn't support opengl 4.0, and that would be consistent with the glsl compilation error which doesn't understand 'double' (double was supported starting opengl 4.0) Would you have the usdtweak startup log ? it normally shows the opengl version selected. Also, you are using usdview coming with which package ? precompiled nvidia usd ? vanilla usd compiled by yourself ? houdini ? maya ? Thanks

ChubbyQuark commented 1 month ago

OK, I'll check the start up log later this morning and send them on. I'm using usdview compiled from the Pixar repository. Will send more info shortly.

On Wed, 10 Jul 2024, 07:12 cpichard, @.***> wrote:

Hi, it could be that your graphic card doesn't support opengl 4.0, and that would be consistent with the glsl compilation error which doesn't understand 'double' (double was supported starting opengl 4.0) Would you have the usdtweak startup log ? it normally shows the opengl version selected. Also, you are using usdview coming with which package ? precompiled nvidia usd ? vanilla usd compiled by yourself ? houdini ? maya ? Thanks

— Reply to this email directly, view it on GitHub https://github.com/cpichard/usdtweak/issues/16#issuecomment-2219641427, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKCHLYTBHDKNW3UIFMBXALZLTGDFAVCNFSM6AAAAABKRCK4VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGY2DCNBSG4 . You are receiving this because you were mentioned.Message ID: @.***>

ChubbyQuark commented 1 month ago

You were right, opengl version is too low on my machine, I'll see if I can upgrade it and re-try.

Intel Intel(R) Iris(R) Xe Graphics OpenGL 3.2.0 - Build 31.0.101.4314 GLSL 1.50 - Build 31.0.101.4314 USD 2211 Warning: in operator () at line 75 of C:\Users\cpich\installs\USD-22.11\pxr\imaging\hgiGL\hgi.cpp -- HgiGL minimum OpenGL requirements not met. Please ensure that OpenGL is initialized and supports version 4.5. Hydra enabled PXR_PLUGINPATH_NAME:

ChubbyQuark commented 1 month ago

This is odd; the startup log for usdtweak shows a different version to the opengl extension viewer, any ideas how to target the latest version?

image
ChubbyQuark commented 1 month ago

Update: I've uninstalled the version from the pre built windows installer and built from cloning the repository. The app. now opens and functions well but I'm still seeing the wrong version of opengl when starting usdtweak (geometry isn't being rendered in the viewport)

cpichard commented 1 month ago

Hi @ChubbyQuark , I think I know what is happening. usdtweak uses glfw to initialize open gl and it gives a hint on the minimal version required here: https://github.com/cpichard/usdtweak/blob/5c9fc303a18ea846e310d3a562355b4c45f6e3dd/src/main.cpp#L103

It is set to 3.2 for various past reasons that might not apply anymore. Normally the opengl driver will use the highest version, that's what I have seen in the past, but it looks like in your case it chooses the one specified by the hint. For the record there is a discussion here about it https://stackoverflow.com/questions/27762349/why-am-i-not-getting-a-forward-compatible-opengl-context-with-glfw.

So unless there is a way to tell the driver to always use the maximum opengl version, we need to change the minimum version in usdtweak. From usd 20.11 onwards it's Opengl 4.5 on linux+windows and 4.1 on mac. Since you already compiled usdtweak, to you want to make the change locally and double check ? it should look like : glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);

ChubbyQuark commented 1 month ago

ok, thanks. I'll try that. Also noted that USD built with an earlier version, this is from the build log:

-- Found OpenGL: opengl32
-- Found OpenSubdiv: C:/USD/include (found suitable version "3.6.0", minimum required is "3") Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'PySide6' -- Found PySide2: with C:/Users/user/AppData/Local/Programs/Python/Python39/python.exe, will use C:/Users/user/AppData/Local/Programs/Python/Python39/Scripts/pyside2-uic.exe for pyside-uic binary -- Found PySide: True
-- Found PyOpenGL -- Found PyOpenGL: True
-- C++ namespace configured to (external) pxr, (internal) pxrInternal_v0_24 -- Skipping validation of gf generated code because PXR_VALIDATE_GENERATED_CODE=OFF -- Skipping validation of sdf generated code because PXR_VALIDATE_GENERATED_CODE=OFF CMake Warning at pxr/usd/usd/CMakeLists.txt:198 (message): Skipping building usdGenSchema due to missing dependency: Jinja2

ChubbyQuark commented 1 month ago

Adjusted, getting 4.5 on startup, but still getting errors, I wonder if it's connected to the pixar issue?

https://github.com/PixarAnimationStudios/OpenUSD/issues/2756

Intel(R) Iris(R) Xe Graphics OpenGL 4.5.0 - Build 31.0.101.4314 GLSL 4.50 - Build 31.0.101.4314 USD 2405 PXR_PLUGINPATH_NAME: Reading blueprints Blueprints ready Runtime Error: in GlfPostPendingGLErrors at line 84 of C:\Users\user\OpenUSD\pxr\imaging\glf\diagnostic.cpp -- GL error: invalid enum, reported from void cdecl pxrInternal_v0_24pxrReserved__::GlfDrawTarget::Unbind(void)

cpichard commented 1 month ago

Hi, it is still an opengl error, but different than the original one, I don't know if we can consider that as progress, but it's a change. I am wondering, the build of the drivers seems different from the one displayed by usdtweak (31.0.101.4314) and the one on the system (31.0.101.5592), did you reinstall the drivers after compiling usd ? may be there are several opengl libs/drivers interfering ? but it's unlikely to be the issue to be honest. I would probably try forcing 4.6 just to double check hydra doesn't need 4.6. I'll ask around if someone has a laptop with an Iris xe graphics that I can borrow, see if I can reproduce the issue. Which processor do you have ?

ChubbyQuark commented 1 month ago

I did update the the drivers after building OpenUSD, I'll try rebuilding with the current drivers, just in case.

Forcing 4.6 but no change, same console error.

Processor is an intel Gen13 i5 1340P

Thanks for your help troubleshoot this.

On Fri, 12 Jul 2024, 07:51 cpichard, @.***> wrote:

Hi, it is still an opengl error, but different than the original one, I don't know if we can consider that as progress, but it's a change. I am wondering, the build of the drivers seems different from the one displayed by usdtweak (31.0.101.4314) and the one on the system (31.0.101.5592), did you reinstall the drivers after compiling usd ? may be there are several opengl libs/drivers interfering ? but it's unlikely to be the issue to be honest. I would probably try forcing 4.6 just to double check hydra doesn't need 4.6. I'll ask around if someone has a laptop with an Iris xe graphics that I can borrow, see if I can reproduce the issue. Which processor do you have ?

— Reply to this email directly, view it on GitHub https://github.com/cpichard/usdtweak/issues/16#issuecomment-2224938892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKCHL6OMV2A6HYLIAN24MTZL54HXAVCNFSM6AAAAABKRCK4VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUHEZTQOBZGI . You are receiving this because you were mentioned.Message ID: @.***>

ChubbyQuark commented 1 month ago

Rebuilt with current drivers but no change. Drivers now match the usdtweak displayed drivers:

image

I'll re-build with PySide6, no idea if that will make any difference...

ChubbyQuark commented 1 month ago

Rebuilt with PySide6, getting a similar error:

Runtime Error: in HgiGLPostPendingGLErrors at line 91 of C:\Users\user\OpenUSD\pxr\imaging\hgiGL\diagnostic.cpp -- GL error: invalid enum, reported from cdecl pxrInternal_v0_24pxrReserved__::HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder(void)

cpichard commented 1 month ago

Thanks a lot for all those tests, this is really helpful. I managed to get a laptop with an intel card, and got the same initial error as you, the driver returns the minimum version required, so 3.2 which is not enough. By setting to 4.5, it does creates new errors as you had, and I found out it's because of the line with GLFW_FORWARD_COMPAT which should be removed to get the compatibility downward. After removing the line, on my laptop, there are no more errors but, for some unknown reason, storm doesn't render in the framebuffer, I just see the grid and the manipulators. Still investigating.

cpichard commented 1 month ago

If you still get opengl errors, you can add the environment variable HGIGL_DEBUG to pinpoint the issue.

ChubbyQuark commented 1 month ago

Sounds like progress, I'm getting the same in the viewport, just the grid. The stage outliner has populated the prims and hierarchy, they're just not visible. I'll try running with the HGIGL_DEBUG.

cpichard commented 1 month ago

Hi @ChubbyQuark , it's progressing indeed. I didn't get much chance to chase the bug yesterday as I ran into compilation issues with boost, python and the latest msvc2022. But I finally managed to compile a debug version without python. I'll hopefully go back to bug hunting next week-end when I'll get some free time. I compiled usd with embree and the embree render delegate does work. So it could be a storm bug on intel drivers, or something usdtweak is not doing right. Does storm render correctly in usdview for you ? Thanks

ChubbyQuark commented 1 month ago

Yes, storm renderer works with usdview, it does throw some errors but I think these are issues with the USD files, viewport displays as expected. Let me know if you need me to check anything, re-building OpenUSD with Embree may be beyond my knowledge, but happy to give it a try when I get time.

On Mon, Jul 15, 2024 at 7:22 AM cpichard @.***> wrote:

Hi @ChubbyQuark https://github.com/ChubbyQuark , it's progressing indeed. I didn't get much chance to chase the bug yesterday as I ran into compilation issues with boost, python and the latest msvc2022. But I finally managed to compile a debug version without python. I'll hopefully go back to bug hunting next week-end when I'll get some free time. I compiled usd with embree and the embree render delegate does work. So it could be a storm bug on intel drivers, or something usdtweak is not doing right. Does storm render correctly in usdview for you ? Thanks

— Reply to this email directly, view it on GitHub https://github.com/cpichard/usdtweak/issues/16#issuecomment-2227774475, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKCHLZO5TDUAV64CWRPRR3ZMNTD3AVCNFSM6AAAAABKRCK4VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXG43TINBXGU . You are receiving this because you were mentioned.Message ID: @.***>

cpichard commented 1 month ago

Hi, thanks @ChubbyQuark ! Just checking, are you testing with the usdview coming from the version 24.05 you compiled ? Normally usdtweak and usdview work pretty much the same way, so it's a bit puzzling to me. Also there are similar issues with usdview https://forum.aousd.org/t/usdview-does-not-render-anything/1534 or https://github.com/PixarAnimationStudios/OpenUSD/issues/3009 I'll try the patch they did this weekend, hopefully that will solve it, otherwise testing with older USD versions, I remember 23.08 used to work with intel gpus, that would be good to test. For info, if you know how to compile usd with the build script, adding embree is very simple, you just have to add --embree to the command line python build_script.py --embree /my/usd/source /my/usd/installation Cheers,

ChubbyQuark commented 1 month ago

@cpichard Yes, using usdview from compile 2405. Re-built with embree, usdview now renders with both OpenGL and Embree, is there a way to change the renderer in usd tweak?

I'll try the earlier build 2308.

cpichard commented 1 month ago

Thanks for confirming. In usdtweak's viewport there should be a GL button, if you click on it you'll have the option to use embree normally.

ChubbyQuark commented 1 month ago

Got it, I think it was squeezed in the UI. Embree is available but no change to the viewprt, just the grid shown. Also noticed the mouse doesn't seem to interact with the viewports (pan, tilt zoom etc.), do you think this is linked to the GL issue?

ChubbyQuark commented 1 month ago

Rebuilt with an ealier version of OpenUSD and forced OpenGL 4.5, noticed there were multiple errors when building usdtweak, not sure if it's relevant:

C:\Users\user\Repos\usdtweak\src\ImGuiHelpers.h(32,30): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [C:\Program Files\usdtweak\usdtweak.vcxproj]

Intel(R) Iris(R) Xe Graphics OpenGL 4.5.0 - Build 31.0.101.4314 GLSL 4.50 - Build 31.0.101.4314 USD 2308

cpichard commented 1 month ago

Hi @ChubbyQuark , The mouse should alway be interacting with the viewport, this is very unexpected that it does not, at first glance I don't see a situation where it should not, I'll investigate tomorrow. The errors you are seeing are just warnings, some come from usdtweak, other from usd, I should fix them at some point. Does it work better with 2308 ? Thanks

ChubbyQuark commented 1 month ago

Ah ok, good they're just warnings. Behaviour is identical when built with

  1. What is the best way to remove an old build, just delete the directory OpenUSD was built into and start again? I'm wondering if there are any old files that could be causing issues?

On Fri, Jul 19, 2024 at 7:48 AM cpichard @.***> wrote:

Hi @ChubbyQuark https://github.com/ChubbyQuark , The mouse should alway be interacting with the viewport, this is very unexpected that it does not, at first glance I don't see a situation where it should not, I'll investigate tomorrow. The errors you are seeing are just warnings, some come from usdtweak, other from usd, I should fix them at some point. Does it work better with 2308 ? Thanks

— Reply to this email directly, view it on GitHub https://github.com/cpichard/usdtweak/issues/16#issuecomment-2238480333, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKCHL2EYHEPHRPVRAKD4PLZNCZFFAVCNFSM6AAAAABKRCK4VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZYGQ4DAMZTGM . You are receiving this because you were mentioned.Message ID: @.***>

cpichard commented 1 month ago

Hi @ChubbyQuark , you can delete the directory, that will do. So I have tested with several usd versions (23.05, 23.08, 23.11, 24.05) and it turns out that the reason the viewport was blank was a display driver bug, after updating it to the latest (31.101.2115 for this particular gpu), storm is now rendering correctly with all usd versions. I am testing a different hardawre configuration than yours, I have an intel HD 515 graphic card, way older. Regarding the mouse viewport interaction, I really don't see what could be happening, except if the file is still loading may be ? but the rest of the UI would be hanging as well. Would you be able to post a short video grab ?

I'll try to build a new release this week-end with the fixes you helped discover. Cheers

ChubbyQuark commented 1 month ago

Great, glad you found the driver bug. I can can try a different set of drivers for the iGPU or is it best to wait until you've updated and re-released.

Sure, will post a video later. Pretty sure the scene has loaded, prims can be selected in the outliner, moved with the gizmos and saved out. Edits can then be verified usdview.

On Sat, 20 Jul 2024, 10:21 cpichard, @.***> wrote:

Hi @ChubbyQuark https://github.com/ChubbyQuark , you can delete the directory, that will do. So I have tested with several usd versions (23.05, 23.08, 23.11, 24.05) and it turns out that the reason the viewport was blank was a display driver bug, after updating it to the latest (31.101.2115 for this particular gpu), storm is now rendering correctly with all usd versions. I am testing a different hardawre configuration than yours, I have an intel HD 515 graphic card, way older. Regarding the mouse viewport interaction, I really don't see what could be happening, except if the file is still loading may be ? but the rest of the UI would be hanging as well. Would you be able to post a short video grab ?

I'll try to build a new release this week-end with the fixes you helped discover. Cheers

— Reply to this email directly, view it on GitHub https://github.com/cpichard/usdtweak/issues/16#issuecomment-2241057242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKCHL4YEYSIH7IPYDEQFJ3ZNIT2VAVCNFSM6AAAAABKRCK4VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGA2TOMRUGI . You are receiving this because you were mentioned.Message ID: @.***>

ChubbyQuark commented 1 month ago

Here's the screen grab. I've tried multiple different USD files, all with the same result.

Ignore the mouse interaction comment, it is working I had the wrong mouse key combo.

https://github.com/user-attachments/assets/657f5bdc-60bc-49db-b39d-3af7c84d7874

cpichard commented 1 month ago

Thanks a lot for the screen grab @ChubbyQuark . Great to know that the viewport manipulation is working. It really looks like Storm is not rendering. I created a new release and had a friend test it on his intel machine, it was behaving exactly as yours. But after installing the most recent intel driver then Storm was rendering correctly. The release is there if you want to test it: https://github.com/cpichard/usdtweak/releases/tag/2024.07.20-prealpha

ChubbyQuark commented 1 month ago

@cpichard Good news! It's rendering and performance is great with the Animal Logic test scene, over 30fps even with the laptop I'm using. Thank you for getting this fixed, I'll have a good explore of the app now it's rendering.

image
cpichard commented 1 month ago

Great news ! Happy that it is working now. If you have any questions don't hesitate to open a new issue. Cheers,