PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.13k stars 1.22k forks source link

[usdview] Embree is default renderer and can't switch to GL #508

Open AlexSchwank opened 6 years ago

AlexSchwank commented 6 years ago

Description of Issue

I have Embree in my environment and its USD plugin. In usdview, Embree is the default renderer and I'm unable to switch to GL. In 0.8.4, GL was still the default renderer and I was able to switch between the renderers. There's no error message.

Steps to Reproduce

  1. Build usdview with the embree plugin (-DPXR_BUILD_EMBREE_PLUGIN=TRUE)
  2. usdview myTestFile.usd
  3. Try to switch to GL

System Information (OS, Hardware)

centos7

Package Versions

0.8.5

Build Flags

-DPXR_BUILD_EMBREE_PLUGIN=TRUE

c64kernal commented 6 years ago

Hi @AlexSchwank, thanks for reporting this, and apologies for the trouble. The code that picks the default renderer is here:

https://github.com/PixarAnimationStudios/USD/blob/master/pxr/imaging/lib/hdx/rendererPluginRegistry.cpp#L52

The two most likely reasons I can think of why you would get this problem is if somehow the plugin system can't find the GL plugin; or two the plugin->IsSupported() call returns false on the GL plugin. That function for the GL plugin bottoms out here:

https://github.com/PixarAnimationStudios/USD/blob/master/pxr/imaging/lib/hdSt/renderDelegate.cpp#L314

To get some debug output (if you could post it here it would be very useful actuall), you can set TF_DEBUG=GLF_DEBUG_CONTEXT_CAPS in your environment and that should dump the contents of GflContextCaps and hopefully that helps us get to the bottom of the issue for you.

Hope that helps!

jtran56 commented 6 years ago

Filed as internal issue #161154.

AlexSchwank commented 6 years ago

Hi @c64kernal ,

_GLF_DEBUG_CONTEXTCAPS doesn't print anything. This is the whole GLF_* output:

~/dev/usd (feature/apkgToUsd) ➜ export TF_DEBUG="GLF_*"
~/dev/usd (feature/apkgToUsd) ➜ usdview ~/files/usd/twoSimpleMeshes.usda 
[PluginDiscover] Plugin could not be loaded for TfType 'GlfUVTextureStorage'
[PluginDiscover] Plugin could not be loaded for TfType 'GlfArrayTexture'
[PluginDiscover] Plugin discovered 'GlfPtexTexture'
[PluginDiscover] Plugin could not be loaded for TfType 'GlfBaseTexture'
[PluginDiscover] Plugin discovered 'GlfUVTexture'
Creating GLSLFX data from /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/shaders/simpleLightingShader.glslfx
  simpleLightingShader.glslfx : 1 : -- glslfx version 0.1
  simpleLightingShader.glslfx : 33 : -- configuration
  simpleLightingShader.glslfx : 49 : -- glsl LightingOverride.SimpleLighting
 Importing File : /.../usd/0.8.5/.../share/usd/plugins/glf/resources/shaders/pcfShader.glslfx
  pcfShader.glslfx : 1 : -- glslfx version 0.1
  pcfShader.glslfx : 29 : -- glsl PCF.ShadowFilterVertex
  pcfShader.glslfx : 35 : -- glsl PCF.ShadowFilterFragment
  pcfShader.glslfx : 87 : -- glsl PCF.ShadowFilterFragmentOnly
 Importing File : /.../usd/0.8.5/.../share/usd/plugins/glf/resources/shaders/simpleLighting.glslfx
  simpleLighting.glslfx : 1 : -- glslfx version 0.1
  simpleLighting.glslfx : 31 : -- glsl SimpleLighting.GeometryInjection
  simpleLighting.glslfx : 78 : -- glsl SimpleLighting.LightIntegrator
  simpleLighting.glslfx : 316 : -- glsl SimpleLighting.SimpleLighting
    Parsing config for simpleLightingShader.glslfx
Creating GLSLFX data from /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/shaders/renderPassShader.glslfx
  renderPassShader.glslfx : 1 : -- glslfx version 0.1
  renderPassShader.glslfx : 33 : -- configuration
 Importing File : /.../usd/0.8.5/.../share/usd/plugins/hdSt/resources/shaders/renderPass.glslfx
  renderPass.glslfx : 1 : -- glslfx version 0.1
  renderPass.glslfx : 30 : -- glsl RenderPass.Camera
  renderPass.glslfx : 132 : -- glsl RenderPass.ShouldCullFace
  renderPass.glslfx : 155 : -- glsl RenderPass.ApplyClipPlanes
  renderPass.glslfx : 170 : -- glsl RenderPass.RenderColorOutput
 Importing File : /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/shaders/renderPass.glslfx
  renderPass.glslfx : 1 : -- glslfx version 0.1
  renderPass.glslfx : 30 : -- glsl HdxRenderPass.ShouldCullFaceShadows
  renderPass.glslfx : 54 : -- glsl HdxRenderPass.RenderColorShadowsOutput
  renderPass.glslfx : 68 : -- glsl HdxRenderPass.RenderColorOutputWithSelection
  renderPass.glslfx : 349 : -- glsl HdxRenderPass.RenderColorIdOutput
    Parsing config for renderPassShader.glslfx
Creating GLSLFX data from /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/shaders/renderPassIdShader.glslfx
  renderPassIdShader.glslfx : 1 : -- glslfx version 0.1
  renderPassIdShader.glslfx : 33 : -- configuration
 Importing File : /.../usd/0.8.5/.../share/usd/plugins/hdSt/resources/shaders/renderPass.glslfx
  renderPass.glslfx : 1 : -- glslfx version 0.1
  renderPass.glslfx : 30 : -- glsl RenderPass.Camera
  renderPass.glslfx : 132 : -- glsl RenderPass.ShouldCullFace
  renderPass.glslfx : 155 : -- glsl RenderPass.ApplyClipPlanes
  renderPass.glslfx : 170 : -- glsl RenderPass.RenderColorOutput
 Importing File : /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/shaders/renderPass.glslfx
  renderPass.glslfx : 1 : -- glslfx version 0.1
  renderPass.glslfx : 30 : -- glsl HdxRenderPass.ShouldCullFaceShadows
  renderPass.glslfx : 54 : -- glsl HdxRenderPass.RenderColorShadowsOutput
  renderPass.glslfx : 68 : -- glsl HdxRenderPass.RenderColorOutputWithSelection
  renderPass.glslfx : 349 : -- glsl HdxRenderPass.RenderColorIdOutput
    Parsing config for renderPassIdShader.glslfx

And here the output for USDIMAGING_*

~/dev/usd (feature/apkgToUsd) ➜ export TF_DEBUG="USDIMAGING_*"
~/dev/usd (feature/apkgToUsd) ➜ usdview ~/files/usd/twoSimpleMeshes.usda 
[PluginDiscover] Plugin could not be loaded for TfType 'UsdImagingInstanceAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingGLDrawModeAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingGLHydraMaterialAdapter'
[PluginDiscover] Plugin could not be loaded for TfType 'UsdImagingGprimAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingBasisCurvesAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingCapsuleAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingConeAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingCubeAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingCylinderAdapter'
[PluginDiscover] Plugin could not be loaded for TfType 'UsdImagingLightAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingCylinderLightAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingDiskLightAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingDistantLightAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingDomeLightAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingMaterialAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingMeshAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingNurbsPatchAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingPointInstancerAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingPointsAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingRectLightAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingSphereAdapter'
[PluginDiscover] Plugin discovered 'UsdImagingSphereLightAdapter'
[PluginDiscover] Plugin discovered 'UsdSkelImagingSkelRootAdapter'
[Repopulate] Populating </> on stage twoSimpleMeshes.usda
[Repopulate] Root path: </>
[PluginLoad] Unknown prim type ''
[PluginLoad] Unknown prim type 'Xform'
[PluginLoad] Loaded plugin 'Mesh' > 'UsdImagingMeshAdapter'
Looking for "preview" material binding for /root/mesh_0
Looking for "preview" material binding for /root/mesh_0
Looking for "preview" material binding for /root/mesh_1
[Adding Prim Info] </root/mesh_0> adapter=UsdImagingMeshAdapter
[Adding Prim Info] </root/mesh_1> adapter=UsdImagingMeshAdapter
[Repopulate] 2 variability tasks in worker
[Update] Begin update for time (0.000000)
[Repopulate] 0 variability tasks in worker
GetRenderTag /root/mesh_0 -> geometry 
GetRenderTag /root/mesh_1 -> geometry 
[Sync] PREP: </root/mesh_0> dirtyFlags: 0x27f70 [RefineLevel Points Primvar Topology Transform Visibility Normals DoubleSided CullStyle SubdivTags InstanceIndex ]
[Sync] PREP: </root/mesh_1> dirtyFlags: 0x27f70 [RefineLevel Points Primvar Topology Transform Visibility Normals DoubleSided CullStyle SubdivTags InstanceIndex ]
[UpdateForTime] Mesh path: </root/mesh_0>
[UpdateForTime] Mesh path: </root/mesh_1>
[UpdateForTime] Mesh path: </root/mesh_0>
[UpdateForTime] Mesh path: </root/mesh_1>
[Update] Begin update for time (0.000000)
[Update] canceled because time (0.000000) did not change and there were no updates

And for PLUG_* using 0.8.5

~/dev/usd (feature/apkgToUsd) ➜ export TF_DEBUG="PLUG_*"
~/dev/usd (feature/apkgToUsd) ➜ usdview ~/files/usd/twoSimpleMeshes.usda 
Will check plugin info paths
Will read plugin info /.../usd/0.8.5/.../plugin/usd/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../plugin/usd/plugInfo.json
Globbing plugin info path /.../usd/0.8.5/.../share/usd/plugins/*/resources/
Globbing plugin info path /.../usd/0.8.5/.../plugin/usd/*/resources/
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/ar/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdUI/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/hdSt/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/sdf/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../plugin/usd/usdAbc/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdHydra/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usd/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../plugin/usd/hdEmbree/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdLux/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdImaging/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdShade/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdSkel/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdGeom/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdRi/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/hdSt/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../plugin/usd/hdEmbree/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdSkelImaging/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/glf/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usd/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/hdStream/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdUI/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdHydra/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/sdf/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdImaging/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/ar/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/hdx/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdLux/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../plugin/usd/usdAbc/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdShade/resources/plugInfo.json
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/hd/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdSkel/resources/plugInfo.json
Registering shared library plugin 'hdSt' at '/.../usd/0.8.5/.../lib/libhdSt.so'.
Will read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdImagingGL/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/glf/resources/plugInfo.json
Registering shared library plugin 'hdEmbree' at '/.../usd/0.8.5/.../plugin/usd/hdEmbree.so'.
Registering shared library plugin 'usd' at '/.../usd/0.8.5/.../lib/libusd.so'.
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/hdStream/resources/plugInfo.json
Registering shared library plugin 'usdUI' at '/.../usd/0.8.5/.../lib/libusdUI.so'.
Registering shared library plugin 'usdHydra' at '/.../usd/0.8.5/.../lib/libusdHydra.so'.
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdRi/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdGeom/resources/plugInfo.json
Registering shared library plugin 'sdf' at '/.../usd/0.8.5/.../lib/libsdf.so'.
Registering shared library plugin 'usdImaging' at '/.../usd/0.8.5/.../lib/libusdImaging.so'.
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/hd/resources/plugInfo.json
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdSkelImaging/resources/plugInfo.json
Registering shared library plugin 'hdx' at '/.../usd/0.8.5/.../lib/libhdx.so'.
Registering shared library plugin 'usdSkelImaging' at '/.../usd/0.8.5/.../lib/libusdSkelImaging.so'.
Registering shared library plugin 'usdAbc' at '/.../usd/0.8.5/.../plugin/usd/usdAbc.so'.
Did read plugin info /.../usd/0.8.5/.../share/usd/plugins/usdImagingGL/resources/plugInfo.json
Registering shared library plugin 'usdImagingGL' at '/.../usd/0.8.5/.../lib/libusdImagingGL.so'.
Registering shared library plugin 'usdSkel' at '/.../usd/0.8.5/.../lib/libusdSkel.so'.
Registering shared library plugin 'ar' at '/.../usd/0.8.5/.../lib/libar.so'.
Registering shared library plugin 'glf' at '/.../usd/0.8.5/.../lib/libglf.so'.
Registering shared library plugin 'hdStream' at '/.../usd/0.8.5/.../lib/libhdStream.so'.
Registering shared library plugin 'usdRi' at '/.../usd/0.8.5/.../lib/libusdRi.so'.
Registering shared library plugin 'usdGeom' at '/.../usd/0.8.5/.../lib/libusdGeom.so'.
Registering shared library plugin 'hd' at '/.../usd/0.8.5/.../lib/libhd.so'.
Registering shared library plugin 'usdLux' at '/.../usd/0.8.5/.../lib/libusdLux.so'.
Registering shared library plugin 'usdShade' at '/.../usd/0.8.5/.../lib/libusdShade.so'.
Did check plugin info paths
Loading plugin 'usd'.
Loading plugin 'hdStream'.
Loading plugin 'hdEmbree'.
Loading plugin 'usdImaging'.

In contrast, PLUG_* using 0.8.4:

~/dev/usd (feature/apkgToUsd) ➜ export TF_DEBUG="PLUG_*"
~/dev/usd (feature/apkgToUsd) ➜ usdview ~/files/usd/twoSimpleMeshes.usda 
Will check plugin info paths
Will read plugin info /.../usd/0.8.4/.../plugin/usd/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../plugin/usd/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/plugInfo.json
Globbing plugin info path /.../usd/0.8.4/.../plugin/usd/*/resources/
Globbing plugin info path /.../usd/0.8.4/.../share/usd/plugins/*/resources/
Will read plugin info /.../usd/0.8.4/.../plugin/usd/usdAbc/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../plugin/usd/hdEmbree/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../plugin/usd/usdAbc/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../plugin/usd/hdEmbree/resources/plugInfo.json
Registering shared library plugin 'usdAbc' at '/.../usd/0.8.4/.../plugin/usd/usdAbc.so'.
Registering shared library plugin 'hdEmbree' at '/.../usd/0.8.4/.../plugin/usd/hdEmbree.so'.
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdUI/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/ar/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/hdSt/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdLux/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/hdStream/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdHydra/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdImaging/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/glf/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdGeom/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/hdx/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usd/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdImagingGL/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/sdf/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdRi/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/hd/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdSkel/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdShade/resources/plugInfo.json
Will read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdSkelImaging/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdUI/resources/plugInfo.json
Registering shared library plugin 'usdUI' at '/.../usd/0.8.4/.../lib/libusdUI.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdLux/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/ar/resources/plugInfo.json
Registering shared library plugin 'ar' at '/.../usd/0.8.4/.../lib/libar.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/hdSt/resources/plugInfo.json
Registering shared library plugin 'usdLux' at '/.../usd/0.8.4/.../lib/libusdLux.so'.
Registering shared library plugin 'hdSt' at '/.../usd/0.8.4/.../lib/libhdSt.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/hdx/resources/plugInfo.json
Registering shared library plugin 'hdx' at '/.../usd/0.8.4/.../lib/libhdx.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/hdStream/resources/plugInfo.json
Registering shared library plugin 'hdStream' at '/.../usd/0.8.4/.../lib/libhdStream.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usd/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdHydra/resources/plugInfo.json
Registering shared library plugin 'usd' at '/.../usd/0.8.4/.../lib/libusd.so'.
Registering shared library plugin 'usdHydra' at '/.../usd/0.8.4/.../lib/libusdHydra.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/glf/resources/plugInfo.json
Registering shared library plugin 'glf' at '/.../usd/0.8.4/.../lib/libglf.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/hd/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdImaging/resources/plugInfo.json
Registering shared library plugin 'hd' at '/.../usd/0.8.4/.../lib/libhd.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdImagingGL/resources/plugInfo.json
Registering shared library plugin 'usdImaging' at '/.../usd/0.8.4/.../lib/libusdImaging.so'.
Registering shared library plugin 'usdImagingGL' at '/.../usd/0.8.4/.../lib/libusdImagingGL.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/sdf/resources/plugInfo.json
Registering shared library plugin 'sdf' at '/.../usd/0.8.4/.../lib/libsdf.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdSkelImaging/resources/plugInfo.json
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdGeom/resources/plugInfo.json
Registering shared library plugin 'usdSkelImaging' at '/.../usd/0.8.4/.../lib/libusdSkelImaging.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdSkel/resources/plugInfo.json
Registering shared library plugin 'usdGeom' at '/.../usd/0.8.4/.../lib/libusdGeom.so'.
Registering shared library plugin 'usdSkel' at '/.../usd/0.8.4/.../lib/libusdSkel.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdRi/resources/plugInfo.json
Registering shared library plugin 'usdRi' at '/.../usd/0.8.4/.../lib/libusdRi.so'.
Did read plugin info /.../usd/0.8.4/.../share/usd/plugins/usdShade/resources/plugInfo.json
Registering shared library plugin 'usdShade' at '/.../usd/0.8.4/.../lib/libusdShade.so'.
Did check plugin info paths
Loading plugin 'usd'.
Loading plugin 'hdStream'.
Loading plugin 'usdImaging'.

I hope this can help you.

pmolodo commented 6 years ago

So... this could be unrelated, but with a build of the latest dev branch, I'm seeing these errors when I use the try to use the GL renderer:

Warning: in _AdapterLookup at line 257 of /mnt/Samsung/luma/rez-build/usd/dev/src/pxr/usdImaging/lib/usdImaging/delegate.cpp -- Selected hydra renderer doesn't support prim type 'HydraPbsSurface' Warning: in _InitializeGPUComputeEnabled at line 74 of /mnt/Samsung/luma/rez-build/usd/dev/src/pxr/imaging/lib/hdSt/glUtils.cpp -- HD_ENABLE_GPU_COMPUTE can't be enabled (OpenGL 4.3 required).

Similar to Alex, it then won't let me pick the GL renderer, only embree. However, I don't get this when building from the tagged 0.8.5 release. The build also has some custom modifications on top of the stock code, which could be causing this, and I haven't tested yet with a stock pixar build... which is the reason I hadn't reported this yet. However, it sounded similar enough to what Alex is seeing that I thought I'd chime in...

pmolodo commented 6 years ago

In general, though - I don't like the idea of completely disallowing renderer plugins because they don't support certain features / prims within a particular stage. ie, I should be able to use the GL renderer for scenes that contain shaders it can't support, and I should be able to use embree for stages that have a few lights, even though the embree plugin doesn't currently support lighting.

Perhaps there needs to be a distinction between show-stopping incompatibilities - ie, GL requires OpenGL version X.X, and your video card only supports Y.Y - and feature-level incompatibilities?

c64kernal commented 6 years ago

Thanks @elrond79 that is useful to know. It sounds like at least in your case you're getting to the GlfContextCaps initialization, which is then (perhaps erroneously), saying it couldn't find a support glsl version. Though the part about it not letting you pick the GL renderer is disturbing and might be related. In your case, the fact that it seems to only happen in the dev branch is great help!

@AlexSchwank Nothing in those logs jumps out at me. The fact that you're not getting anything from GLF_DEBUG_CONTEXT_CAPS is indicative of a deeper problem maybe. Do you mind adding the following debugging prints in on the following line:

https://github.com/PixarAnimationStudios/USD/blob/master/pxr/imaging/lib/hdx/rendererPluginRegistry.cpp#L66

        std::cout << "plugin id: " << desc.id << " displayName: " <<
            desc.displayName << " priority " << desc.priority;
        if (plugin) {
            std::cout << "  plugin found and is supported = " <<
                plugin->IsSupported() << std::endl;
        } else {
            std::cout << "  plugin not found" << std::endl;
        }

What we should see is that the HdStreamRendererPlugin gets discovered and queried first. The call to IsSupported() is supposed to cause GlfContextCaps::_LoadCaps to run which is suppose to print out the diagnostics when GLF_DEBUG_CONTEXT_CAPS is turned on.

c64kernal commented 6 years ago

@elrond79 Yes! You're totally right about that, and the intention is definitely not to cut off all the GL rendering because the new compute stuff isn't supported -- that's completely unintentional and likely some other bug. Do you mind filing a new issue for that, and we'll track these separately. The fact that yours only started happening in dev, should make it easier to track down hopefully.

pmolodo commented 6 years ago

Will do, once I can confirm I can reproduce on a stock build!

pmolodo commented 6 years ago

Well, looks like one of our changes was causing our error. Please ignore my earlier report!

c64kernal commented 6 years ago

@elrond79 no worries, thanks for checking!

AlexSchwank commented 6 years ago

@c64kernal this is the output:

plugin id: HdStreamRendererPlugin displayName: GL priority 0  plugin found and is supported = 0
plugin id: HdEmbreeRendererPlugin displayName: Embree priority 99  plugin found and is supported = 1
plugin id: HdStreamRendererPlugin displayName: GL priority 0  plugin found and is supported = 0
plugin id: HdEmbreeRendererPlugin displayName: Embree priority 99  plugin found and is supported = 1
c64kernal commented 6 years ago

Thanks @AlexSchwank -- you're really close now. We see that the HdStreamRendererPlugin is loading, but IsSupported() is returning false, and we need to understand why. The code path is this:

HdStreamRendererPlugin::IsSupported() calls HdStRenderDelegate::IsSupported() calls GlfContextCaps::GetInstance() calls GlfContextCaps::_LoadCaps()

This last call is the one that's meant to produce the output we were looking for with TF_DEBUG=GLF_DEBUG_CONTEXT_CAPS

So drilling into why that isn't being called or executed will likely give us the answer about why you're not getting this plugin.

For what it's worth, we're looking for a value of glVersion >= 400.

Hope that helps!

AlexSchwank commented 6 years ago

GL isn't initialized; glGetString(GL_VERSION) in GlfContextCaps::_LoadCaps() returns NULL. Digging into the cause for it now.

AlexSchwank commented 6 years ago

Interesting, the usdview settings seem to cause the issue. Running usdview with --defaultSettings is working. Digging further into it, I was able to reproduce the issue:

  1. rm -rf ~/.usdview
  2. usdview myStage.usd (GL is default and working)
  3. close usdview to serialize the new settings
  4. usdview myAnimatedStage.usd
  5. uncheck "Redraw On Frame Scrub" and close usdview
  6. usdview myStage.usd (Embree is default, GL not working)
  7. usdview --defaultsettings myStage.usd (GL is default and working)

So the redrawOnScrub setting is causing this.

c64kernal commented 6 years ago

Okay thanks @AlexSchwank. Unfortunately I can't reproduce that locally, but we'll keep looking and report back if we find something.

AlexSchwank commented 6 years ago

I'll try to reproduce it on a different system too

NathanBWaters commented 6 years ago

I'm hitting the same problem where usdview is unable to switch from Embree to GL and Embree is the default.
When first building without any extra flags, I was only getting GL as expected. Then I rebuilt with embree flags turned on and now I am unable to switch from Embree to GL. Using --defaultsettings and removing ~/.usdview did not change anything.

Here is the build command used: python build_scripts/build_usd.py --usd-imaging --embree --embree-location /opt/local/include --openimageio /opt/local/USD/

Update 1 It looks like when I try and switch renderers it is doing the following: 1) It tries to use Hydra. 2) It discovers that it can't use Hydra.

From my understanding, it seems there are two different places in the code base for determining if Hydra is enabled/supported and they are conflicting with each other and leaving users in a strange state.

1) In usdImagingGL/gl.cpp

{
    // Make sure there is an OpenGL context when 
    // trying to initialize Hydra/Reference
    GlfGLContextSharedPtr context = GlfGLContext::GetCurrentGLContext();
    if (!context) {
        TF_CODING_ERROR("OpenGL context required, using reference renderer");
        return false;
    }
    if (TfGetenv("HD_ENABLED", "1") != "1") {
        return false;
    }

    // Check to see if we have a default plugin for the renderer
    TfToken defaultPlugin = 
        HdxRendererPluginRegistry::GetInstance().GetDefaultPluginId();

    return !defaultPlugin.IsEmpty();
}

The above function ends up setting Hydra as the engine, despite being on a Mac which supports OpenGL 3.3 and Hydra requiring OpenGL 4.0

2) In UsdImagingGLHdEngine::SetRendererPlugin

else if (!plugin->IsSupported()) {
        // Don't do anything if the plugin isn't supported on the running
        // system, just return that we're not able to set it.
        HdxRendererPluginRegistry::GetInstance().ReleasePlugin(plugin);
        return false;
    }

Not sure if this behavior is intentional. If this is not intentional, I'm happy to create a pull request that prevents users from getting into this state.

A simple workaround is setting the environment variable HD_ENABLED to 0. However, of course, this prevents me from switching to Embree.

When I think about it, the whole requirement that Hydra requires OpenGL 4.0 (perhaps that's not true anymore, just following the doxygen info for Hydra) is odd... because in reality that's only the requirement for Stream.

c64kernal commented 6 years ago

Thanks for digging in @NathanBWaters -- though I'm not sure what you're running into is the same problem as originally reported. Let me describe what I'd expect from the system currently and we can see if what you're running into is a new issue or not.

The way the system is intended to work is that on startup, it will search for all the backends available for Hydra. If it finds any supported ones, it makes the first one the default and switches to "Hydra" mode. If it can't find any supported backends, it will use a default, non-Hydra "reference" (bad name) renderer implemented in GL. This "GL" renderer is not a Hydra backend.

So I'm guessing from your description that when you build USD without embree, you don't have any Hydra backends, and so drop to this reference renderer. When you do have embree compiled, the system finds a compatible backend and puts you in embree mode. Note that there are no other backends that work since hdStream isn't supported on your system, and so there's nothing else to switch to.

If that's indeed what you're seeing, then everything is working as intended so far (but not as desired in the long term).

In the long term, we''d all love nothing more than to get rid of this reference (bad name) engine. For the Mac, we would like to build in more feature back-off support for GL in hdStream, and the currently being-worked-on Metal implementation. The former could help everyone, the latter Macs in particular. And getting rid of the reference renderer will be a boon to all.

Hope that helps and makes things a little clearer.