googlevr / cardboard

Open source Cardboard SDK and samples
Other
1.48k stars 252 forks source link

Pixel Format mismatch error with URP + Linear with Unity iOS #441

Open nbxrconnect opened 10 months ago

nbxrconnect commented 10 months ago

SPECIFIC ISSUE ENCOUNTERED

On iOS with unity plugin when URP is with Linear color space initialisation fails with pixel format mismatch error For color attachment 0, the render pipeline's pixelFormat (MTLPixelFormatBGRA8Unorm) does not match the framebuffer's pixelFormat (MTLPixelFormatBGRA8Unorm_sRGB).

SMARTPHONE (please complete the following information):

STEPS TO REPRODUCE THE ISSUE

I dont have sample app. Assuming will occur with URP+Linear for any app.

EXPECTED BEHAVIOR

Should be able to see the VR view.

VERSIONS USED

What version of Google Cardboard are you using? Cardboard XR Plugin 1.21.0

If you are using Cardboard XR Plugin:

LINK TO A REPOSITORY WITH CODE TO REPRODUCE THE BUG

(This is not mandatory but it allows us to faster reproduce, prioritize, debug and fix the reported issue) [e.g. https://github.com/googlevr/cardboard]

SCREENSHOTS

If applicable, add screenshots to help depict your problem.

ADDITIONAL CONTEXT

Following is from logs Cardboard Setup Initializing XR... 2023-11-03 14:46:39.190066+0530 vrgallery[39897:5256811] [/Users/jballoffet/Documents/cardboard/sdk/unity/xr_unity_plugin/cardboard_display_api.cc : 415] Configured Metal as Graphics API. 2023-11-03 14:46:39.190428+0530 vrgallery[39897:5256811] [/Users/jballoffet/Documents/cardboard/sdk/unity/xr_unity_plugin/cardboard_input_api.cc : 144] Configured viewport orientation as landscape left. [Subsystems] Loading plugin GfxPluginCardboard for subsystem CardboardDisplay... [Subsystems] Cardboard successfully registered Provider for CardboardDisplay [XR] [CardboardXrMain]: Display subsystem successfully loaded. [Subsystems] Cardboard successfully registered Provider for CardboardInput [Subsystems] Cardboard successfully registered Provider for CardboardDisplay [XR] [CardboardXrMain]: Input subsystem successfully loaded. [Subsystems] Loading plugin GfxPluginCardboard for subsystem CardboardInput... [XR] [CardboardXrInputProvider]: Lifecycle initialized [CardboardApi] Device params found. XR initialized. Starting XR... [XR] [CardboardXrInputProvider]: Lifecycle started XR started. [XR] [CardboardXrDisplayProvider]: Initializes Cardboard API. RequestCreateTexture RequestCreateTexture SetupRenderTextureFromXRRequest (id: 1 col: 0x283de6300 d: 0x0 sr: 0x0) RenderTexture::Create (id: 1) IVRDeviceCallback_CreateEyeTextureResources 0x283de6300 SetupRenderTextureFromXRRequest (id: 2 col: 0x283de5c70 d: 0x0 sr: 0x0) RenderTexture::Create (id: 2) IVRDeviceCallback_CreateEyeTextureResources 0x283de5c70 -[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1604: failed assertion `Set Render Pipeline State Validation For color attachment 0, the render pipeline's pixelFormat (MTLPixelFormatBGRA8Unorm) does not match the framebuffer's pixelFormat (MTLPixelFormatBGRA8Unorm_sRGB).

lneumarkt commented 6 months ago

@nbxrconnect Thank you for reaching out and reporting the issue you encountered.

I confirm that I’m able to reproduce the issue. An internal ticket has been added to our backlog and will be prioritized along with other issues.

We'll update this issue once we have some updates about it.

Thanks!

julien-tamade commented 6 months ago

I'm also running into something similar.

[/Users/jballoffet/Documents/cardboard/sdk/unity/xr_unity_plugin/cardboard_display_api.cc : 415] Configured Metal as Graphics API.
[/Users/jballoffet/Documents/cardboard/sdk/unity/xr_unity_plugin/cardboard_input_api.cc : 154] Configured viewport orientation as portrait.
[Subsystems] Loading plugin GfxPluginCardboard for subsystem CardboardDisplay...
[Subsystems] Cardboard successfully registered Provider for CardboardDisplay
[XR] [CardboardXrMain]: Display subsystem successfully loaded.
[Subsystems] Cardboard successfully registered Provider for CardboardInput
[Subsystems] Cardboard successfully registered Provider for CardboardDisplay
[XR] [CardboardXrMain]: Input subsystem successfully loaded.
[Subsystems] Loading plugin GfxPluginCardboard for subsystem CardboardInput...
[XR] [CardboardXrInputProvider]: Lifecycle initialized
Starting XR...
Stacktrace is not supported on this platform.

[XR] [CardboardXrInputProvider]: Lifecycle started
[XR] [CardboardXrDisplayProvider]: Initializes Cardboard API.
No device parameters currently saved.
RequestCreateTexture
RequestCreateTexture
SetupRenderTextureFromXRRequest (id: 1 col: 0x28245c070 d: 0x0 sr: 0x0)
RenderTexture::Create (id: 1)
IVRDeviceCallback_CreateEyeTextureResources 0x28245c070
SetupRenderTextureFromXRRequest (id: 2 col: 0x2824504f0 d: 0x0 sr: 0x0)
RenderTexture::Create (id: 2)
IVRDeviceCallback_CreateEyeTextureResources 0x2824504f0
-[MTLTextureDescriptorInternal validateWithDevice:], line 1357: error 'Texture Descriptor Validation
MTLTextureDescriptor has invalid pixelFormat (0).
'
-[MTLTextureDescriptorInternal validateWithDevice:]:1357: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor has invalid pixelFormat (0).
'

It's causing my application to crash when entering VR. Please help!