Title: [Bug/Enhancement] original EnvironmentDepthManager provider causes 90-100% PC GPU usage in Quest Link, while self-implemented sample-and-hold mode stays at 9-11% · Issue #96 · oculus-samples/Unity-DepthAPI · GitHub
Open Graph Title: [Bug/Enhancement] original EnvironmentDepthManager provider causes 90-100% PC GPU usage in Quest Link, while self-implemented sample-and-hold mode stays at 9-11% · Issue #96 · oculus-samples/Unity-DepthAPI
X Title: [Bug/Enhancement] original EnvironmentDepthManager provider causes 90-100% PC GPU usage in Quest Link, while self-implemented sample-and-hold mode stays at 9-11% · Issue #96 · oculus-samples/Unity-DepthAPI
Description: Unity version 6000.0.40 Where does the issue occur? In Unity Editor In Quest builds Description Summary When running in Unity Editor over Quest Link, enabling EnvironmentDepthManager causes sustained PC GPU 3D usage around 90-100%, even ...
Open Graph Description: Unity version 6000.0.40 Where does the issue occur? In Unity Editor In Quest builds Description Summary When running in Unity Editor over Quest Link, enabling EnvironmentDepthManager causes sustain...
X Description: Unity version 6000.0.40 Where does the issue occur? In Unity Editor In Quest builds Description Summary When running in Unity Editor over Quest Link, enabling EnvironmentDepthManager causes sustain...
Opengraph URL: https://github.com/oculus-samples/Unity-DepthAPI/issues/96
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug/Enhancement] original EnvironmentDepthManager provider causes 90-100% PC GPU usage in Quest Link, while self-implemented sample-and-hold mode stays at 9-11%","articleBody":"### Unity version\n\n6000.0.40\n\n### Where does the issue occur?\n\n- [x] In Unity Editor\n- [ ] In Quest builds\n\n### Description\n\n## Summary\n\nWhen running in Unity Editor over Quest Link, enabling `EnvironmentDepthManager` causes sustained PC GPU 3D usage around 90-100%, even in an almost empty scene with only Passthrough + EnvironmentDepthManager.\n\nThis happens even when `OcclusionShadersMode` is set to `None`, so the issue does not appear to be caused by occlusion shader rendering.\n\nI tested a sample-and-hold workaround where the depth provider is only enabled when a new depth sample is needed, one valid depth texture is acquired, then the provider is disabled again while the last valid depth texture remains cached. With this approach, even at 90Hz sampling, sustained PC GPU 3D usage stays around 9-11%.\n\nThis suggests the abnormal GPU cost may be related to keeping the OpenXR environment depth provider continuously enabled in Quest Link Editor mode, rather than the cost of acquiring depth frames at high frequency.\n\n## Environment\n\n- Unity version: 6000.0.40\n- Meta XR Core SDK version: v85\n- Also tested: v77\n- Device: Quest 3\n- Runtime: Unity Editor over Quest Link\n- GPU: RTX 5090\n- Render pipeline: URP\n- Graphics API: Vulkan\n- Passthrough enabled: yes\n\n\n\n\n\n### Steps to reproduce\n\n## Minimal Reproduction\n\n1. Create an empty Unity scene.\n2. Enable Passthrough.\n3. Add `EnvironmentDepthManager`.\n4. Set `OcclusionShadersMode` to `None`.\n5. Run the scene in Unity Editor over Quest Link.\n6. Observe Windows Task Manager GPU 3D usage.\n\n\n## Observed Result\n\n- Passthrough only: low PC GPU 3D usage.\n- Passthrough + `EnvironmentDepthManager` continuous mode: sustained 90-100% PC GPU 3D usage.\n- Meta XR Core SDK v77: around 80% GPU 3D usage.\n- Meta XR Core SDK v85: around 90%+ GPU 3D usage.\n- The high GPU usage happens even when `OcclusionShadersMode = None`.\n\n## Sample-and-Hold Workaround Result\n\nI tested a workaround that changes the manager behavior from continuous provider enabled to sample-and-hold:\n\n1. Enable the depth provider when a new sample is due.\n2. Acquire one updated depth texture.\n3. Keep the last valid depth texture bound/cached.\n4. Disable the depth provider until the next sample interval.\n\nResults:\n\n| Mode | Sample rate | Sustained PC GPU 3D usage |\n|---|---:|---:|\n| Passthrough only | N/A | low / baseline |\n| EnvironmentDepthManager continuous | per-frame / continuous provider enabled | 90-100% |\n| Sample-and-hold | 8Hz | ~9-11% |\n| Sample-and-hold | 32Hz | ~9-11% |\n| Sample-and-hold | 64Hz | ~9-11% |\n| Sample-and-hold | 90Hz | ~9-11% |\n\nThere may be a short GPU spike when the provider is first enabled, but after that the usage drops and remains around 9-11%.\n\n## Expected Result\n\n`EnvironmentDepthManager` should not cause sustained 90-100% PC GPU 3D usage in Quest Link Editor mode, especially when occlusion shader rendering is disabled.\n\nIf continuous provider mode is expected to be expensive in Quest Link, it would be helpful to expose an official configurable sampling mode or sample-and-hold mode.\n\n## Workaround / Hypothesis\n\nThe sample-and-hold test suggests that the cost is not primarily caused by the frequency of `TryGetUpdatedDepthTexture()` calls. Even at 90Hz sample-and-hold, GPU usage remains low.\n\nThe abnormal sustained GPU usage appears to be related to keeping the OpenXR environment depth provider continuously enabled in Quest Link Editor mode.\n\n## Enhancement Request\n\nPlease consider exposing an official API or inspector option for:\n\n- sample-and-hold depth updates\n- configurable environment depth sampling rate\n- keeping the last valid depth texture cached while temporarily disabling provider acquisition\n- safer provider lifecycle behavior in Unity Editor / Quest Link mode\n\nThis would allow applications that do not need fully continuous per-frame occlusion to use Environment Depth without saturating the PC GPU in Quest Link.\n\n\n\n\n### Logs\n\n```text\nnone\n```\n\n### Additional info\n\n\n```\n//Simplified sample-and-hold workaround\n\nprivate bool providerRunning;\nprivate float nextSampleTime;\nprivate float sampleHz = 90f;\n\nprivate void OnBeforeRender()\n{\n float now = Time.realtimeSinceStartup;\n\n if (!providerRunning \u0026\u0026 now \u003e= nextSampleTime)\n {\n provider.SetDepthEnabled(true, removeHands: false);\n providerRunning = true;\n }\n\n if (!providerRunning)\n {\n return;\n }\n\n if (!provider.TryGetUpdatedDepthTexture(out var depthTexture, frameDescriptors))\n {\n return;\n }\n\n if (depthTexture == null || !depthTexture.IsCreated())\n {\n return;\n }\n\n Shader.SetGlobalTexture(EnvironmentDepthTextureId, depthTexture);\n\n provider.SetDepthEnabled(false, false);\n providerRunning = false;\n\n nextSampleTime = now + 1f / Mathf.Max(1f, sampleHz);\n}\n\n\n```\n\n\n","author":{"url":"https://github.com/changruizhu96","@type":"Person","name":"changruizhu96"},"datePublished":"2026-04-28T23:12:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/96/Unity-DepthAPI/issues/96"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7c495fd7-a992-e025-3c84-52b43b4b40ac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CACC:3F6EBB:269B67:333735:6A4D8A0F |
| html-safe-nonce | 591005f1f38da55a15405a44932f6b8b3184d1f7f0067a107f30d697f7ea9643 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUNDOjNGNkVCQjoyNjlCNjc6MzMzNzM1OjZBNEQ4QTBGIiwidmlzaXRvcl9pZCI6IjUyNTI5NjExNDM1OTY5OTk4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f115a9cfe19e35a3a46a4eb0718acc8322c757665e3594046c13f8a7f00b9471 |
| hovercard-subject-tag | issue:4346833902 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/oculus-samples/Unity-DepthAPI/96/issue_layout |
| twitter:image | https://opengraph.githubassets.com/463704520a3c3fd7cf26866f46b62a0223c18ba3b9081284c6a7ca6c3e0a6d7b/oculus-samples/Unity-DepthAPI/issues/96 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/463704520a3c3fd7cf26866f46b62a0223c18ba3b9081284c6a7ca6c3e0a6d7b/oculus-samples/Unity-DepthAPI/issues/96 |
| og:image:alt | Unity version 6000.0.40 Where does the issue occur? In Unity Editor In Quest builds Description Summary When running in Unity Editor over Quest Link, enabling EnvironmentDepthManager causes sustain... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | changruizhu96 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9f8758a3953dfe943439713a6fa4f90d542a3431f10e861ca03dd7f39009f320 |
| turbo-cache-control | no-preview |
| go-import | github.com/oculus-samples/Unity-DepthAPI git https://github.com/oculus-samples/Unity-DepthAPI.git |
| octolytics-dimension-user_id | 92825639 |
| octolytics-dimension-user_login | oculus-samples |
| octolytics-dimension-repository_id | 696182619 |
| octolytics-dimension-repository_nwo | oculus-samples/Unity-DepthAPI |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 696182619 |
| octolytics-dimension-repository_network_root_nwo | oculus-samples/Unity-DepthAPI |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bffd5484f01713a661b03469b77678f72b6574ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width