#include "third_party/blink/renderer/modules/xr/xr_webgl_layer.h"
#include <algorithm>
#include <utility>
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/modules/webgl/webgl_framebuffer.h"
#include "third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h"
#include "third_party/blink/renderer/modules/xr/xr_frame_provider.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h"
#include "third_party/blink/renderer/modules/xr/xr_system.h"
#include "third_party/blink/renderer/modules/xr/xr_utils.h"
#include "third_party/blink/renderer/modules/xr/xr_view.h"
#include "third_party/blink/renderer/modules/xr/xr_viewport.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h"
namespace blink {
namespace {
const double kFramebufferMinScale = …;
const uint32_t kCleanFrameWarningLimit = …;
const char kCleanFrameWarning[] = …;
}
XRWebGLLayer* XRWebGLLayer::Create(XRSession* session,
const V8XRWebGLRenderingContext* context,
const XRWebGLLayerInit* initializer,
ExceptionState& exception_state) { … }
XRWebGLLayer::XRWebGLLayer(XRSession* session,
WebGLRenderingContextBase* webgl_context,
scoped_refptr<XRWebGLDrawingBuffer> drawing_buffer,
WebGLFramebuffer* framebuffer,
double framebuffer_scale,
bool ignore_depth_values)
: … { … }
XRWebGLLayer::~XRWebGLLayer() { … }
uint32_t XRWebGLLayer::framebufferWidth() const { … }
uint32_t XRWebGLLayer::framebufferHeight() const { … }
bool XRWebGLLayer::antialias() const { … }
XRViewport* XRWebGLLayer::getViewport(XRView* view) { … }
XRViewport* XRWebGLLayer::GetViewportForEye(device::mojom::blink::XREye eye) { … }
double XRWebGLLayer::getNativeFramebufferScaleFactor(XRSession* session) { … }
void XRWebGLLayer::UpdateViewports() { … }
HTMLCanvasElement* XRWebGLLayer::output_canvas() const { … }
WebGLTexture* XRWebGLLayer::GetCameraTexture() { … }
void XRWebGLLayer::OnFrameStart(
const std::optional<gpu::MailboxHolder>& buffer_mailbox_holder,
const std::optional<gpu::MailboxHolder>& camera_image_mailbox_holder) { … }
uint32_t XRWebGLLayer::GetBufferTextureId(
const std::optional<gpu::MailboxHolder>& buffer_mailbox_holder) { … }
void XRWebGLLayer::BindCameraBufferTexture(
const std::optional<gpu::MailboxHolder>& buffer_mailbox_holder) { … }
void XRWebGLLayer::OnFrameEnd() { … }
void XRWebGLLayer::OnResize() { … }
scoped_refptr<StaticBitmapImage> XRWebGLLayer::TransferToStaticBitmapImage() { … }
void XRWebGLLayer::Trace(Visitor* visitor) const { … }
}