New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 846455 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Task
Proj-XR
Proj-XR-VR

Blocking:
issue 837646



Sign in to add a comment

Investigate if we can use fixed foveated rendering in browser UI

Project Member Reported by bshe@chromium.org, May 24 2018

Issue description

This was mentioned briefly in our stand up. It sounds foveated rending could improve performance a lot but may not suitable for browser ui rendering due to the quality of text. We should at least give it a try.
 
Cc: bajones@chromium.org billorr@chromium.org
Labels: -Type-Bug -vr Proj-VR Type-Task
Summary: Investigate if we can use foveated rendering in browser UI (was: Investigate is we can use fovea rendering in browser UI)
Description: Show this description

Comment 3 by klausw@chromium.org, May 24 2018

Summary: Investigate if we can use fixed foveated rendering in browser UI (was: Investigate if we can use foveated rendering in browser UI)
Specifically, this is currently about fixed foveated rendering or lens-matched shading, though similar techniques would also be interesting for any potential future eye-tracked system with dynamic foveation.

For reference, the suggestion was to investigate the Qualcomm extensions:

https://www.khronos.org/registry/OpenGL/extensions/QCOM/QCOM_framebuffer_foveated.txt

https://www.khronos.org/registry/OpenGL/extensions/QCOM/QCOM_texture_foveated.txt


The framebuffer_foveated extension is available for Pixel phones using Android O, but very inflexible. It's not possible to modify attachments on an FBO once it was set as foveated. The texture_foveated extension is more flexible, and available on Pixel phones starting with the Android P preview, and also available on the Mirage standalone device. These newer devices no longer support framebuffer_foveated, so we'd want to go with texture_foveated.

The extension reduces the render cost by adjusting the internal tile resolution while rendering, then interpolating the rendered pixel when resolving into the destination texture.

This mainly saves resources when the fragment shader cost is comparatively high. If that's not the case, it may potentially even slow things down due to extra overhead for maintaining the foveated texture internally.

I agree that it's worth trying, especially since it can be applied just to the background texture while keeping the separately composited content quad at full quality.

Comment 4 by klausw@chromium.org, May 24 2018

Handwavy suggestion for an experiment:

- acquire GVR frame
- get hardware buffer:

https://developers.google.com/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1gaf878e168841607c080e8f41bc39b4e82

  acquired_frame_.BindBuffer(kFramePrimaryBuffer);
  AHardwareBuffer* ahb = static_cast<AHardwareBuffer*>(
      acquired_frame_.GetHardwareBuffer(kFramePrimaryBuffer));

  // or use C API:  gvr_frame_get_hardware_buffer(acquired_frame_.cobj(), kFramePrimaryBuffer));

- bind AHardwarebuffer as GLImage
- bind GLImage as texture
- set foveation on the texture:

  glBindTexture(GL_TEXTURE_2D, shared_buffer_texture_id_);
  glTexParameteri(
      GL_TEXTURE_2D, GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM,
      GL_FOVEATION_ENABLE_BIT_QCOM | GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM);

  // Desired parameters if each eye were its own buffer. Adjusted below
  // for left/right split framebuffer.
  float focal_x = 0.f;
  float focal_y = 0.f;
  float gain_x = 5.f;
  float gain_y = 5.f;
  float fovea_area = 1.4f;

  float focal_x_left = (focal_x - 1.f) / 2.f;
  float focal_x_right = (focal_x + 1.f) / 2.f;
  float gain_x_split = gain_x * 2.f;
  glTextureFoveationParametersQCOM(shared_buffer_texture_id_, 0, 0, focal_x_left,
                                     focal_y, gain_x_split, gain_y, fovea_area);
  glTextureFoveationParametersQCOM(shared_buffer_texture_id_, 0, 1, focal_x_right,
                                     focal_y, gain_x_split, gain_y, fovea_area);


- set up FBO using the texture as color buffer
- draw to FBO
- unbind FBO 
- submit to GVR

See vr_shell_gl's WebVR SharedBuffer code and/or https://cs.chromium.org/chromium/src/chrome/browser/android/vr/arcore_device/ar_image_transport.cc for code examples related to setting up the GLImage, texture, and FBO.

Comment 5 by tiborg@chromium.org, Jun 12 2018

Cc: tiborg@chromium.org vollick@chromium.org cjgrant@chromium.org
Status: Available (was: Untriaged)
Marking this as available for now. Does somebody have plans on working on this? Maybe it could also go on our feature spreadsheet.

Sign in to add a comment