1. 소개
이 명세는 WebXR 명세에 `composition` 레이어 지원을 추가합니다. 레이어의 이점은 다음과 같습니다.
-
성능 및 저더: 컴포지션 레이어는 애플리케이션 프레임 레이트가 아니라 컴포지터의 프레임 레이트(즉 HMD의 네이티브 재생률)로 표시됩니다. 애플리케이션이 레이어의 렌더링을 컴포지터의 네이티브 재생률로 업데이트하지 않더라도, 컴포지터는 기존 렌더링을 적절한 포즈로 다시 투영할 수 있습니다. 이는 더 부드러운 렌더링과 더 적은 저더로 이어집니다. 레이어의 또 다른 특징은 각각 다른 해상도를 가질 수 있다는 점입니다. 이를 통해 애플리케이션은 저성능 시스템에서 기본 눈 버퍼 해상도를 낮추면서도, 텍스트나 지도와 같은 필수 정보는 자체 레이어에 더 높은 해상도로 유지할 수 있습니다.
-
가독성/시각적 충실도: 일반 WebXR에서는 눈 버퍼의 해상도가 특히 저성능 시스템에서 비교적 낮은 값으로 줄어들 수 있습니다. 이는 텍스트와 같은 고충실도 콘텐츠를 렌더링하기 어렵게 만듭니다. Composition Layers를 사용하면, 정적인 실린더 또는 사각형 레이어를 한 번 고해상도로 그린 뒤 컴포지터가 한 번만 리샘플링할 수 있습니다. 이는
XRWebGLLayer를 렌더링하는 전통적인 방식과 대조됩니다. 기존 방식에서는 콘텐츠가 장치의 재생률로 생성되고 적어도 두 번 리샘플링됩니다. 한 번은 WebGL 눈 버퍼에 렌더링할 때 (낮은 눈 버퍼 해상도로 인해 세부 정보가 손실될 수 있음), 두 번째는 컴포지터에 의해 수행됩니다. -
전력 소비 / 배터리 수명: 축소된 렌더링 파이프라인, 이중 샘플링의 부재, 그리고 매 프레임마다 레이어의 렌더링을 업데이트할 필요가 없기 때문에, 전력 소비가 개선될 것으로 예상됩니다.
-
지연 시간: 컴포지션 레이어의 포즈 샘플링은 프레임의 매우 마지막에 발생할 수 있으며, 이후 특정 재투영 기법을 사용하여 레이어의 포즈를 최신 HMD 포즈와 일치하도록 업데이트할 수 있습니다. 이는 레이어 렌더링의 유효 지연 시간을 크게 줄일 수 있으며, 결과적으로 전체 경험을 개선할 수 있습니다.
-
더 많은 색상 유형 지원: WebXR은 RGB 값만 지원합니다. 컴포지션 레이어는 색상 유형에 대한 더 넓은 지원을 제공하므로 작성자는 압축 형식이나 sRGB를 사용할 수 있습니다.
1.1. 용어
1.2. 애플리케이션 흐름
작성자가 GL 레이어를 사용하려는 경우, 다음 단계를 거쳐야 합니다.
-
XRProjectionLayer이외의 모든 레이어 유형에 대해서는requiredFeatures또는optionalFeatures를 통해requestSession()에서 지원을 요청합니다. -
XRWebGLBinding또는XRMediaBinding을 생성합니다. -
이 객체들로 레이어를 생성합니다.
-
레이어를
XRRenderStateInit에 추가하고updateRenderState()를 호출합니다. -
WebGL 레이어의 경우
requestAnimationFrame()동안 각 WebGL 레이어에 콘텐츠를 그립니다.
2. 초기화
애플리케이션이 세션 중 XRProjectionLayer
유형 이외의 레이어를 생성하려는 경우,
해당 세션은 적절한 feature
descriptor와 함께 요청되어야 합니다. 문자열 "layers"는
이 모듈에서 WebXR Layers 기능을 위한 새로운 유효한 feature
descriptor로 도입됩니다.
XRProjectionLayer
유형의 레이어는 feature
descriptor가 요청되었는지 여부와 관계없이 항상 지원되어야 합니다.
navigator. xr. requestSession( 'immersive-vr' , { optionalFeatures: [ 'layers' ] }
레이어는 XRSessionMode가 "immersive-vr"
또는 "immersive-ar"인
XRSessions에 대해서만 지원됩니다.
"inline"
세션은 레이어를 지원해서는 안 됩니다.
"layers" feature descriptor는 feature requirement를 가지며, 이는 active immersive session이 있을 때 활성화될 수 없다는 것입니다.
NOTE: 이는 "layers"와 함께 request(permissionDesc)
API를 실행해도 현재 활성 세션에 대한 layers 지원이 활성화되지 않음을 의미합니다.
3. 레이어 유형
3.1. 모노 및 스테레오 레이어
스테레오 레이어는 각 뷰에 대해 렌더링 대상이 되는XRSubImage를
제공해야 합니다.
모노 레이어는 각 뷰에 표시되는 단일 XRSubImage를
제공해야 합니다.
XR Compositor는 레이어가 관찰자에게 스테레오로 올바르게 표시되도록 보장해야 합니다.
3.2. XRLayerLayout
XRLayerLayout
enum은 레이어의 레이아웃을 정의합니다.
enum {XRLayerLayout "default" ,"mono" ,"stereo" ,"stereo-left-right" ,"stereo-top-bottom" };
-
default레이아웃은 레이어가 세션의 list of views의 모든 뷰를 수용할 수 있음을 나타냅니다. -
mono레이아웃은 레이어가 모노임을 나타냅니다. -
stereo레이아웃은 레이어가 스테레오임을 나타냅니다. -
stereo-left-right레이아웃은 레이어가 스테레오이며 왼쪽에서 오른쪽으로 분할됨을 나타냅니다. -
stereo-top-bottom레이아웃은 레이어가 스테레오이며 위에서 아래로 분할됨을 나타냅니다.
NOTE: XRCompositionLayer가
"default"
또는 "stereo"
XRLayerLayout으로
생성되는 경우,
"texture-array"
텍스처 유형으로 할당하는 것을 강력히 권장합니다.
Note: "stereo-left-right"
및 "stereo-top-bottom"
레이아웃은 이미 스테레오인 콘텐츠(예: 스테레오 비디오 또는 이미지)에 대한 draw
호출을 최소화하도록 설계되었습니다. 이러한 자산 유형이 필요하지 않은 경험은
"default"
또는 "stereo"
레이아웃을 사용해야 합니다.
3.3. XRLayerQuality
XRLayerQuality
enum은 레이어의 표시 품질을 정의합니다.
enum {XRLayerQuality "default" ,"text-optimized" ,"graphics-optimized" };
-
default레이아웃은 레이어가 일반 설정으로 표시됨을 나타냅니다. -
text-optimized레이아웃은 XR Compositor가 레이어를 가장 읽기 쉽도록 렌더링하려고 시도함을 나타냅니다. -
graphics-optimized레이아웃은 XR Compositor가 레이어를 추가 선명도로 렌더링하려고 시도함을 나타냅니다.
NOTE: text-optimized
및 graphics-optimized
플래그는 XR Compositor의
추가 처리를 초래할 수 있으며, 이는 성능에 영향을 줄 수 있습니다.
3.4. XRCompositionLayer
XRCompositionLayer는 특정 레이어 유형 전반에 공통되는 속성과 동작의 집합을 정의합니다.[Exposed =Window ]interface :XRCompositionLayer XRLayer {readonly attribute XRLayerLayout layout ;attribute boolean blendTextureSourceAlpha ;attribute boolean forceMonoPresentation ;attribute float opacity ;readonly attribute unsigned long mipLevels ;attribute XRLayerQuality quality ;readonly attribute boolean needsRedraw ;undefined (); };destroy
layout 속성은 레이어의 레이아웃을 반환합니다.
blendTextureSourceAlpha 속성은
레이어의 텍스처 알파 채널을 활성화합니다.
forceMonoPresentation 속성은
오른쪽 눈이 왼쪽 눈과 동일한 레이어 구성을 사용하도록 강제합니다. 이는 XR Compositor에
신호를 보내 이 XRCompositionLayer의
stereo
효과를 제거해야 합니다.
true로 설정해도 mono
레이어에는 아무 효과가 없습니다.
NOTE: 이 속성은 XRSession이
반환하는 다른 정보에는 부수 효과가 없습니다.
이 설정의 영향을 받는 것은 XR Compositor의 동작뿐이며, 경험은 양쪽 눈 모두에 계속 그려야 합니다.
opacity 속성은 레이어의 픽셀에 적용되는
불투명도를 설정합니다. XR Compositor는
각 픽셀(프리멀티플라이드 공간에서)에 이 값을 곱해야 합니다.
opacity의
기본값은 1.0입니다. opacity를
0보다 작은 값으로 설정하면 0으로 설정되고, 1.0보다 큰
값으로 설정하면 1.0으로 설정됩니다.
needsRedraw 속성은 XRCompositionLayer가
다음 XR animation frame에서 다시 렌더링되어야 함을 나타냅니다. 이는 레이어의 기본 리소스가
손실되었거나
XR
Compositor가 더 이상 레이어를 재투영할 수 없을 때 설정될 수 있습니다.
다음 XR animation frame에서
콘텐츠를 다시 그리지 않으면 깜박임이나 기타 부수 효과가 발생할 수 있습니다.
mipLevels 속성은 mip 체인의 깊이를 반환합니다.
이는 mipLevels에서
요청한 값과 같거나 작아야 합니다.
NOTE: 일부 플랫폼은 mip 레벨을 지원하지 않습니다. 작성자는
특정 mip 레벨을 대상으로 할 수 있는지 확인하기 위해 mipLevels를
질의해야 하며, mipLevels에
전달한 값에 의존해서는 안 됩니다.
quality 속성은 XRCompositionLayer의
품질을 설정하고 반환합니다.
default가
초기값입니다.
XRCompositionLayer
layer에 대해
레이어의 기본 리소스가 손실되면,
사용자 에이전트는 다음 단계를 실행해야 합니다.
-
layer의
needsRedraw를true로 설정합니다. -
layer가
XRProjectionLayer가 아닌 경우, layer에서XRLayerEvent를 사용하여redraw라는 이름의 이벤트를 발생시키도록 태스크를 큐에 추가합니다.
destroy()는
기본 attachment를 삭제합니다. attachment가 없으면 이 함수는 아무것도 하지 않습니다.
XRSession
session 및 WebGLRenderingContext
또는 WebGL2RenderingContext
context의 선택적 인스턴스로 컴포지션 레이어를 초기화하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
destroy()를
호출할 때, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
this colorTextures 배열을 빈 배열로 설정합니다.
-
this depthStencilTextures 배열을 빈 배열로 설정합니다.
-
기본 GL attachment를 파기합니다.
각 XRCompositionLayer에는
null 또는 WebGLRenderingContext
또는 WebGL2RenderingContext의
인스턴스인 context 객체와,
null 또는 HTMLVideoElement의
인스턴스인 media
객체가 있습니다.
각 XRCompositionLayer에는
생성될 때 사용된 XRSession인
관련 session이 있습니다.
XRSpace
space 및 XRCompositionLayer
layer로 레이어의
space를 설정할 때, 사용자 에이전트는 space가 유효한지 검증하기 위해 다음 단계를
실행해야 합니다.
XRCompositionLayer에는
작성자가 needsRedraw가
true일 때에만 이 레이어에 그릴 수 있음을 나타내는 내부 불리언
isStatic이 있습니다.
NOTE: isStatic이
true이면 작성자는 생성 후 한 번 또는 redraw 이벤트 후 한 번만 레이어에 그릴 수 있습니다.
이를 통해 UA는 단일 GPU 버퍼만 할당할 수 있습니다.
XRCompositionLayer
또는 그 파생 클래스 중 하나에서 쓰기 가능한 속성이 설정되면,
해당 속성을 읽을 때 그 값을 반환해야 합니다.
requestAnimationFrame()
콜백이 끝날 때, 그 값은
기본 XR
Compositor로 전송되어야 합니다. XR Compositor는
requestAnimationFrame()
콜백에 전달된 XRFrame을
다음에 표시할 때 해당 값을 적용해야 합니다.
NOTE: 이는 XR Compositor가 새
XRFrame을
사용하여 장면을 다시 그릴 때,
colorTexture가
XRCompositionLayer와
관련하여 변경되지 않았거나, 미디어 레이어와 관련된 videoframe이 변경되지 않았더라도 값을 적용해야 함을 의미합니다.
XR
Compositor가 이전 XRFrame의
상태로 장면을 다시 그리는 경우, 새 값을 사용해서는 안 됩니다.
3.5. XRProjectionLayer
XRProjectionLayer는
관찰자의 전체 뷰를 채우는 레이어입니다.
Projection 레이어는 장치의 네이티브 프레임 레이트에 가깝게 새로 고쳐져야 합니다.

[Exposed =Window ]interface :XRProjectionLayer XRCompositionLayer {readonly attribute unsigned long textureWidth ;readonly attribute unsigned long textureHeight ;readonly attribute unsigned long textureArrayLength ;readonly attribute boolean ignoreDepthValues ;attribute float ?fixedFoveation ;attribute XRRigidTransform ?deltaPose ; };
textureWidth 속성은
이 레이어의 colorTextures
텍스처의 너비를 픽셀 단위로 반환합니다.
textureHeight 속성은
이 레이어의 colorTextures
텍스처의 높이를 픽셀 단위로 반환합니다.
textureArrayLength 속성은
XRProjectionLayer가
textureType
"texture-array"로
초기화된 경우, 이 레이어의 colorTextures
텍스처의 레이어 수를 반환합니다.
그렇지 않으면 1을 반환합니다.
fixedFoveation 속성은
XR
Compositor가 사용하는 foveation의 양을 제어합니다. 사용자 에이전트 또는 장치가 이 속성을 지원하지 않는 경우,
getting 시 null을 반환해야 하며, setting은 no-op이어야 합니다.
fixedFoveation을
0보다 작은 값으로 설정하면 0으로 설정되고,
1보다 큰 값으로 설정하면 1로 설정됩니다. 0은 foveation의
최소량을 설정하고,
1은 최대량을 설정합니다. XR Compositor가
이러한 값을 어떻게 해석하는지는 사용자 에이전트에 달려 있습니다.
fixedFoveation
레벨이 변경되면, 이는 다음 XRFrame에서
적용됩니다.
ignoreDepthValues 속성이
true이면,
XR
Compositor가 렌더링 시 depth buffer attachment의 값을 사용해서는 안 됨을 나타냅니다. 속성이
false이면 depth buffer attachment의 콘텐츠가
XR
Compositor에 의해 사용되며, 레이어에 렌더링된 장면을 대표할 것으로 기대됨을 나타냅니다.
deltaPose attribute는
XR Compositor가 사용하는
foveation의 양을 제어합니다. 사용자 에이전트 또는 장치가 이
attribute를 지원하지 않거나
"space-warp" feature
descriptor가 요청되지 않은 경우, getting 시
null을 반환해야 하며, setting은 no-op이어야 합니다. 이 attribute는
view에 영향을 주는, 이전 frame 이후의 incremental application-applied transform이 있다면 이를
설명합니다. artificial
locomotion이 발생하면, experience는 frame 사이에서 전체 world를 하나의 application pose에서 다른 pose로
transform하며,
deltaPose에는
scene의 world position 차이가 채워져야 합니다.
deltaPose는
이전 frame과 현재 XRFrame
사이에 transform이 없을 때 identity이어야 합니다.
3.6. XRQuadLayer
XRQuadLayer는
가상 환경에서 평평한 직사각형 공간을 차지하는 레이어를 렌더링합니다.
레이어의 앞면만 보여야 하며, 뒷면은 XR Compositor가 그려서는 안 됩니다.
XRQuadLayer에는 두께가 없습니다. 이는 3D 공간에 위치하고 방향이 지정된 2차원 객체입니다. quad의 위치는 quad의 중심을 가리킵니다.

[Exposed =Window ]interface :XRQuadLayer XRCompositionLayer {attribute XRSpace space ;attribute XRRigidTransform transform ;attribute float width ;attribute float height ; // Eventsattribute EventHandler onredraw ; };
transform 속성은
space 속성에 대한 상대적 오프셋과 방향을 설정하고 반환합니다.
transform
및 space
속성은
사용자의 물리적 환경 내에서 레이어의 공간적 관계를 설정합니다.
space를
설정할 때는 먼저 레이어의 space를 설정하는 단계를 실행합니다.
width 및 height 속성은
레이어의 너비와 높이를 미터 단위로 설정하고 반환합니다.
XRQuadLayerInit
init으로 XRQuadLayer
layer를 초기화할 때, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
layer의
transform을 다음과 같이 초기화합니다.- init의
transform이 설정된 경우 - layer의
transform을 layer의 relevant realm에서 newXRRigidTransform로 두고, init의transform의position및orientation으로 초기화합니다. - 그렇지 않은 경우
- layer의
transform을 layer의 relevant realm에서 newXRRigidTransform로 두고,DOMPointInitposition{ x: 0.0, y: 0.0, z: 0.0, w: 1.0 }로 초기화합니다.
- init의
onredraw 속성은 redraw
이벤트 유형에 대한 Event handler IDL 속성입니다.
3.7. XRCylinderLayer
XRCylinderLayer는
가상 환경에서 곡면 직사각형 공간을 차지하는 레이어를 렌더링합니다.
레이어의 앞면만 보여야 하며, 뒷면은 XR Compositor가 그려서는 안 됩니다.

XRCylinderLayer에는 두께가 없습니다. 이는 3D 공간에 위치하고 방향이 지정된 2차원 객체입니다. cylinder의 위치는 quad의 중심을 가리킵니다.
[Exposed =Window ]interface :XRCylinderLayer XRCompositionLayer {attribute XRSpace space ;attribute XRRigidTransform transform ;attribute float radius ;attribute float centralAngle ;attribute float aspectRatio ; // Eventsattribute EventHandler onredraw ; };
transform 속성은
space 속성에 대한 상대적 오프셋과 방향을 설정하고 반환합니다.
transform
및 space
속성은
사용자의 물리적 환경 내에서 레이어의 공간적 관계를 설정합니다.
space를
설정할 때는 먼저 레이어의 space를 설정하는 단계를 실행합니다.
radius 속성은 cylinder의 반지름을 미터 단위로
제어합니다.
centralAngle 속성은 cylinder의 보이는 부분의
각도를 라디안 단위로 제어합니다.
이는 0 각도를 중심으로 대칭적으로 커집니다.
aspectRatio 속성은 보이는 cylinder 부분의 비율을
제어합니다. 이는 cylinder의 보이는 부분의 너비를 그 높이로 나눈 비율입니다. 너비는 radius에
centralAngle을
곱하여 계산됩니다.

XRCylinderLayerInit
init으로 XRCylinderLayer
layer를 초기화할 때, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
layer의
centralAngle를 init의centralAngle로 초기화합니다. -
layer의
aspectRatio를 init의aspectRatio로 초기화합니다. -
layer의
transform을 다음과 같이 초기화합니다.- init의
transform이 설정된 경우 - layer의
transform을 layer의 relevant realm에서 newXRRigidTransform로 두고, init의transform의position및orientation으로 초기화합니다. - 그렇지 않은 경우
- layer의
transform을 layer의 relevant realm에서 newXRRigidTransform로 두고,DOMPointInitposition{ x: 0.0, y: 0.0, z: 0.0, w: 1.0 }로 초기화합니다.
- init의
onredraw 속성은 redraw
이벤트 유형에 대한 Event handler IDL 속성입니다.
3.8. XREquirectLayer
XREquirectLayer는
XR
Compositor가 equirectangular 인코딩 데이터를 구의 안쪽에 매핑해야 하는
레이어를 렌더링합니다.

[Exposed =Window ]interface :XREquirectLayer XRCompositionLayer {attribute XRSpace ;space attribute XRRigidTransform transform ;attribute float radius ;attribute float centralHorizontalAngle ;attribute float upperVerticalAngle ;attribute float lowerVerticalAngle ; // Eventsattribute EventHandler onredraw ; };
transform 속성은
space에
대한 상대적 오프셋과 방향을 설정하고 반환합니다.
transform
속성과 space는
사용자의 물리적 환경 내에서 레이어의 공간적 관계를 설정합니다.
radius 속성은 구의 음수가 아닌 반지름을 미터 단위로
나타냅니다. zero 또는 infinity 값은 무한한 구로 취급됩니다.
radius를
0보다 작은 값으로 설정하면 0으로 설정됩니다.
centralHorizontalAngle, upperVerticalAngle
및 lowerVerticalAngle 속성은 텍스처가 구에
매핑되는 방식을 설정하고 반환합니다.
centralHorizontalAngle을
0보다 작은 값으로 설정하면 0으로 설정되고,
2π보다 큰 값으로 설정하면 2π로 설정됩니다.
upperVerticalAngle
또는 lowerVerticalAngle을
-π/2보다 작은 값으로 설정하면
-π/2로 설정되고, π/2보다 큰 값으로 설정하면 π/2로 설정됩니다.

XRSpace를
space
속성에 할당할 때는 먼저 다음 단계를 실행합니다.
XRSpace
space 및 XREquirectLayer
layer로 setting the space on an equirect layer를 수행할 때, 사용자 에이전트는
space가 유효한지 검증하기 위해 다음 단계를 실행해야 합니다.
-
init의
space가XRReferenceSpace유형의 인스턴스가 아니면,TypeError를 throw하고 이 단계를 중단합니다. -
init의
space가"viewer"type을 가지면,TypeError를 throw하고 이 단계를 중단합니다. -
space 및 layer로 레이어의 space를 설정하는 단계를 실행합니다.
XREquirectLayerInit
init으로 XREquirectLayer
layer를 초기화할 때, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
layer의
centralHorizontalAngle를 init의centralHorizontalAngle로 초기화합니다. -
layer의
upperVerticalAngle를 init의upperVerticalAngle로 초기화합니다. -
layer의
lowerVerticalAngle를 init의lowerVerticalAngle로 초기화합니다. -
layer의
transform을 다음과 같이 초기화합니다.- init의
transform이 설정된 경우 - layer의
transform을 layer의 relevant realm에서 newXRRigidTransform로 두고, init의transform의position및orientation으로 초기화합니다. - 그렇지 않은 경우
- layer의
transform을 layer의 relevant realm에서 newXRRigidTransform로 둡니다.
- init의
onredraw 속성은 redraw
이벤트 유형에 대한 Event handler IDL 속성입니다.
3.9. XRCubeLayer
XRCubeLayer는
XR
Compositor가 cubemap에서 직접 렌더링하는 레이어를 렌더링합니다.

[Exposed =Window ]interface :XRCubeLayer XRCompositionLayer {attribute XRSpace space ;attribute DOMPointReadOnly orientation ; // Eventsattribute EventHandler onredraw ; };
orientation 속성은
space 속성에 대한 상대적 방향을 설정하고 반환합니다.
orientation
및 space
속성은
사용자의 물리적 환경 내에서 레이어의 공간적 관계를 설정합니다.
XRCubeLayer를
배치할 때는 space의
방향만 고려됩니다. cube 레이어는 항상
시점이 중심에 있는 상태로 렌더링됩니다.
XRSpace를
space
속성에 할당할 때는 먼저 다음 단계를 실행합니다.
XRSpace
space 및 XRCubeLayer
layer로 setting the space on an cube layer를 수행할 때, 사용자 에이전트는
space가 유효한지 검증하기 위해 다음 단계를 실행해야 합니다.
-
init의
space가XRReferenceSpace유형의 인스턴스가 아니면,TypeError를 throw하고 이 단계를 중단합니다. -
init의
space가"viewer"type을 가지면,TypeError를 throw하고 이 단계를 중단합니다. -
space 및 layer로 레이어의 space를 설정하는 단계를 실행합니다.
onredraw 속성은 redraw
이벤트 유형에 대한 Event handler IDL 속성입니다.
4. 공간
XRProjectionLayer
및 XRWebGLLayer에는
관련 XRSpace가
없습니다. 이들은 전체 프레임에 렌더링하기 때문입니다.
XRCubeLayer
및 XREquirectLayer는
XRReferenceSpaces
중
"viewer"
유형이 아닌 것만 지원해야 합니다.
XRQuadLayer
및 XRCylinderLayer는
모든 XRSpace
유형을 지원해야 합니다.
일반적으로 개발자는 레이어를 안정화하기 위해 "viewer"
space를 사용하지 않는 것이 좋습니다. 이는 거의 항상 위치 또는 회전 재투영을 무력화하여, 월드에 대한 렌더링된
콘텐츠의 안정성을 잃게 하기 때문입니다.
예외는 gaze cursor나 targeting reticle과 같은 작은 UI 요소입니다.
다음은 레이어 유형과 함께 사용할 space에 대한 몇 가지 모범 사례입니다.
-
XRQuadLayerwith"viewer"space: 화면 중앙의 head-locked 고정 크기 reticle. -
XRQuadLayer또는XRCylinderLayerin"local","unbounded"space: 탄성 있는 body-locked UI. -
XRQuadLayer또는XRCylinderLayerin"local","local-floor","unbounded","bounded-floor"또는 anchor space: 사용자가 배치한 world-locked 비디오. -
XREquirectLayer또는XRCubeLayerin"local"space: 360도 비디오 또는 skybox.
5. 렌더링
5.1. XRSubImage
XRSubImage
객체는 GPU 텍스처의 어떤 viewport를 사용할지 나타냅니다.
[Exposed =Window ]interface { [XRSubImage SameObject ]readonly attribute XRViewport viewport ; };
NOTE: 이 클래스는 향후 확장을 수용하도록 설계되었습니다
viewport 속성은 sub image를 렌더링할 때 사용할 XRViewport를
반환합니다.
5.2. XRWebGLSubImage
XRWebGLSubImage
객체는 레이어 렌더링 중에 사용됩니다.
[Exposed =Window ]interface :XRWebGLSubImage XRSubImage { [SameObject ]readonly attribute WebGLTexture colorTexture ; [SameObject ]readonly attribute WebGLTexture ?depthStencilTexture ; [SameObject ]readonly attribute WebGLTexture ?motionVectorTexture ;readonly attribute unsigned long ?imageIndex ;readonly attribute unsigned long colorTextureWidth ;readonly attribute unsigned long colorTextureHeight ;readonly attribute unsigned long ?depthStencilTextureWidth ;readonly attribute unsigned long ?depthStencilTextureHeight ;readonly attribute unsigned long ?motionVectorTextureWidth ;readonly attribute unsigned long ?motionVectorTextureHeight ; };
colorTexture 속성은 XRCompositionLayer에
대한 컬러 opaque texture를 반환합니다.
depthStencilTexture 속성은 XRCompositionLayer에
대한 depth/stencil opaque
texture를 반환합니다.
레이어가 depth/stencil 없이 생성된 경우, 이 속성은 null을 반환합니다.
motionVectorTexture
속성은 XRProjectionLayer에
대한 motion opaque
texture를 반환합니다.
XRSession이
space-warp feature
descriptor 없이 생성되었거나 레이어가 XRProjectionLayer가
아닌 경우,
이 속성은 null을 반환해야 합니다.
imageIndex 속성은
texture array 안의 오프셋을 반환합니다. texture-array로
요청된 레이어에 대해서만 유효합니다.
colorTextureWidth 및 depthStencilTextureHeight
속성은
GL depth attachment의 너비와 높이를 픽셀 단위로 반환합니다
depthStencilTextureWidth 및
colorTextureHeight 속성은
GL color attachment의 너비와 높이를 픽셀 단위로 반환합니다. 레이어가 depth/stencil 없이 생성된 경우,
이 속성은 null을 반환합니다.
motionVectorTextureWidth 및
motionVectorTextureHeight
속성은
GL motion vector attachment의 너비와 높이를 픽셀 단위로 반환합니다.
XRSession이
space-warp feature
descriptor 없이 생성되었거나 레이어가 XRProjectionLayer가
아닌 경우,
이 속성들은 null을 반환해야 합니다.
5.3. XRTextureType
XRTextureType
enum은 어떤 유형의 텍스처가 할당되는지를 정의합니다.
enum {XRTextureType "texture" ,"texture-array" };
-
texture텍스처 유형은XRWebGLSubImage의 텍스처가TEXTURE_2D유형이어야 함을 나타냅니다 -
texture-array텍스처 유형은XRWebGLSubImage의 텍스처가TEXTURE_2D_ARRAY유형이어야 함을 나타냅니다
6. GPU 레이어 및 뷰 생성
6.1. 개요
레이어가 생성되면, 일반적으로 텍스처인 GPU 리소스가 뒷받침하며, 이는 웹 플랫폼의 그래픽 API 중 하나가 제공합니다.
레이어의 GPU 리소스를 제공하는 API를 지정하기 위해 해당 API에 대한 XRWebGLBinding을
생성해야 합니다.
각 그래픽 API에는 레이어 생성에 context를 사용하기 전에 충족되어야 하는 고유한 요구 사항이 있을 수 있습니다.
예를 들어,
WebGLRenderingContext는
XRWebGLBinding
인스턴스의 생성자에 전달되기 전에 xrCompatible 플래그가 설정되어 있어야 합니다.
XRSession과
그래픽 API 사이의 모든 상호작용, 예를 들어 텍스처를 할당하거나 가져오는 동작은 이 XRWebGLBinding
인스턴스를 통해 이루어지며, 상호작용의 정확한 메커니즘은 일반적으로 API별로 다릅니다.
이를 통해 WebXR API의 나머지 부분은 그래픽 API에 구애받지 않으며, 향후 렌더링 기술의 발전에 더 쉽게
적응할 수 있습니다.
XRWebGLBinding
인스턴스를 획득하면, 이를 사용하여 다양한 XRCompositionLayer를
생성할 수 있습니다.
해당 인스턴스가 생성한 모든 레이어는 이후 각 프레임마다 관련 GPU 리소스를 질의할 수 있으며, 이는 일반적으로
네이티브 API의 텍스처 인터페이스일 것으로 예상됩니다.
여러 레이어 유형은 XRWebGLBinding
인스턴스의 create____Layer 계열 메서드로 생성됩니다. depth buffer 또는 alpha channel을 할당할지 여부와 같은
필요한 그래픽 리소스에 대한 정보는 레이어 생성 시 전달되며, 레이어의 수명 동안 변경할 수 없습니다.
이 메서드는 관련 XRCompositionLayer 유형을 반환합니다.
XRSession이
"layers" feature
descriptor로 생성된 경우, 모든 레이어 유형을 지원해야 합니다.
레이어 유형이 지원되지 않으면 해당 생성 메서드는 예외를 throw해야 합니다. XRProjectionLayer는
"layers" feature
descriptor로 생성되었는지 여부와 관계없이, 모든 XRSession에서
지원되어야 합니다.
6.2. Opaque 텍스처
WebXR GPU 레이어를 사용할 때,XRWebGLBinding
객체는 color 및 depth/stencil attachment에 대한 opaque texture 인스턴스를 반환합니다.
opaque texture는
다음 변경 사항을 제외하고 표준 WebGLTexture와
동일하게 동작합니다.
-
opaque texture는 해당 세션의
requestAnimationFrame()콜백 밖에서는 유효하지 않은 것으로 간주됩니다. -
opaque texture는
getSubImage()또는getViewSubImage()호출이 반환하기 전까지는 유효하지 않습니다. -
XR Compositor는 color attachment에 대한 opaque texture가 프리멀티플라이드 알파가 적용된 색상을 포함한다고 가정해야 합니다.
-
requestAnimationFrame()콜백이 끝날 때 텍스처는 unbounded되어야 하며 모든WebGLShader객체에서 분리되어야 합니다. -
opaque texture는 WebGL 1.0 context를 사용하더라도, 적절한 경우 texStorage2D 또는 texStorage3D로 할당된 것처럼 동작해야 합니다.
-
opaque texture를 사용한
deleteTexture호출은INVALID_OPERATION오류를 생성해야 합니다.
opaque
texture에 첨부된 버퍼는
clearOnAccess가
true일 때,
각 XR animation frame에서 getViewSubImage()
또는 getSubImage()의
첫 번째 호출을 처리하는 동안 아래 표의 값으로 지워져야 합니다.
clearOnAccess가
false이면, opaque
texture에 첨부된 버퍼는 처음 접근될 때 지워져야 합니다.
이후 프레임에서의 후속 접근은 버퍼를 지우지 않을 수 있습니다.
| 버퍼 | Clear 값 |
|---|---|
| Color | (0, 0, 0, 0) |
| Depth | 1.0 |
| Stencil | 0 |
opaque texture가
2개 이상의 mipLevels로
생성된 경우, 작성자는 모든 mip 레벨을 채워야 합니다. 사용자 에이전트는 자신이 mip 레벨을 생성해야 한다고 가정해서는
안 됩니다.
NOTE: opaque textures는 레이어가 생성될 때
allocate color
textures 및 allocate depth textures 알고리즘을 사용하여 할당됩니다. 이
사전 할당의 부수 효과는 동일한 매개변수로
getSubImage()
및 getViewSubImage()를
호출하면 항상 동일한 텍스처 객체가 반환된다는 것입니다.
NOTE: opaque textures의 치수나 형식 변경은 허용되지 않습니다. GL 명령은 texel 값과 텍스처 매개변수만 변경할 수 있습니다. WebGLTexture에 다음 명령 중 하나를 사용하면, 치수나 형식에 영향을 주지 않더라도 INVALID_OPERATION 오류가 생성됩니다: TexImage*, CompressedTexImage*, CopyTexImage* 및 TexStorage*. OpenGL ES 3.0 명세의 "Immutable-Format Texture Images" 절은 이러한 제한을 더 자세히 정의합니다.
레이어의 리소스(예: 메모리) 할당은 WebGL과 동일한 메커니즘을 통해 수행되어야 합니다.
XRLayer가
RGBA
또는 RGB
colorFormat으로
할당된 경우, 그 colorTextures는
RGBA
또는 RGB로
WebGLRenderingContext
context에 노출되어야 합니다.
그러나 XR Compositor는 colorTextures의 픽셀을
SRGB8_ALPHA8
또는 SRGB8
colorFormat에
있는 것처럼 취급해야 합니다.
NOTE: 이는 XR Compositor가
colorTextures를 처리할 때 linear
RGBA
또는 RGB에서
어떤 gamma 변환도 수행해서는 안 된다는 의미입니다. 그렇지 않으면 최종 렌더링의 픽셀이 너무 밝게 보이며, 일반
2D WebGLRenderingContext
context에서의 렌더링과 일치하지 않습니다.
6.3. XRProjectionLayerInit
XRProjectionLayerInit
dictionary는 XRProjectionLayer가
어떻게 초기화되는지를 설명하는 구성 가능한 값의 집합을 나타냅니다.
dictionary {XRProjectionLayerInit XRTextureType textureType = "texture";GLenum colorFormat = 0x1908; // RGBAGLenum depthFormat = 0x1902; // DEPTH_COMPONENTdouble scaleFactor = 1.0;boolean clearOnAccess =true ; };
textureType 속성은
레이어가 가질 텍스처의 유형을 정의합니다.
colorFormat 속성은
color texture 데이터의 데이터 유형을 정의합니다.
다음은 XR Compositor가 지원해야 하는 projection 레이어의 color format 목록입니다.
-
SRGB_ALPHA_EXT'EXT_sRGB' extension이 활성화된 context용
WebGL2 context의 경우 다음 추가 형식이 지원됩니다.
depthFormat 속성은
depth texture 데이터의 데이터 유형을 정의합니다.
depthFormat이
0이면 레이어는 depth/stencil texture를 제공하지 않습니다.
다음은 XR Compositor가 지원해야 하는 projection 레이어의 depth format 목록입니다.
'WEBGL_depth_texture'
extension이 활성화된 WebGLRenderingContext
context 또는 WebGL2 context의 경우:
extension이 활성화되지 않은 경우, depth texture 요청은 무시됩니다.
NOTE: 작성자가 depth texture를 기대할 수 있으므로 혼란스러울 수 있습니다. 가능하면 texture가 생성되지 않은 이유를 포함한 경고를 제공하세요.
WebGL2RenderingContext
context의 경우 다음 추가 형식이 지원됩니다.
scaleFactor 속성은
레이어 attachment의 해상도를 결정할 때 session의
recommended WebGL framebuffer resolution에
곱해야 하는 값을 정의합니다.
clearOnAccess 속성은
이 레이어와 관련된 texture가 초기 프레임에서 지워져야 하는지, 또는 매 프레임마다 지워져야 하는지를 정의합니다.
NOTE: XRProjectionLayerInit
dictionary는 XRLayerInit처럼
mipLevels를
구성하는 기능을 지원하지 않습니다.
사용자 에이전트가 projection 레이어에서 mipmapping을 지원하려는 경우, mips가 포함된 texture를 자유롭게 할당할 수 있습니다.
이 경우 모든 mip 레벨을 생성할 책임은 작성자가 아니라 사용자 에이전트에게 있습니다.
6.4. XRLayerInit
XRLayerInit
dictionary는 XRQuadLayer,
XRCylinderLayer,
XREquirectLayer
및 XRCubeLayer에
대한 공통 구성 가능 값의 집합을 나타냅니다.
dictionary {XRLayerInit required XRSpace space ;XRTextureType textureType = "texture";GLenum colorFormat = 0x1908; // RGBAGLenum ?depthFormat ;unsigned long mipLevels = 1;required unsigned long viewPixelWidth ;required unsigned long viewPixelHeight ;XRLayerLayout layout = "mono";boolean =isStatic false ;boolean clearOnAccess =true ; };
space 속성은 사용자의 물리적 환경과의 공간적 관계를
정의합니다.
textureType 속성은 레이어 텍스처의 유형을
정의합니다. XR Compositor는 다음을 지원해야 합니다.
WebGL2RenderingContext의
경우 다음 추가 유형이 지원됩니다.
colorFormat 속성은
color texture 데이터의 데이터 유형을 정의합니다.
다음은 XR Compositor가 지원해야 하는 non-projection 레이어의 color format 목록입니다.
-
SRGB_ALPHA_EXT'EXT_sRGB' extension이 활성화된 context용
WebGL2 context의 경우 다음 추가 형식이 지원됩니다.
'WEBGL_compressed_texture_etc'
extension이 활성화된 context의 경우 다음 추가 형식이 지원됩니다.
'WEBGL_compressed_texture_astc'
extension이 활성화된 context의 경우 해당 extension의 모든 형식이 지원됩니다.
depthFormat 속성은
depth texture 데이터의 데이터 유형을 정의합니다.
depthFormat이
제공되지 않으면 레이어는 depth/stencil texture를 제공하지 않습니다.
다음은 XR Compositor가 지원해야 하는 non-projection 레이어의 depth format 목록입니다.
'WEBGL_depth_texture'
extension이 활성화된 WebGLRenderingContext
context 또는 WebGL2 context의 경우:
WebGL2RenderingContext
context의 경우 다음 추가 형식이 지원됩니다.
mipLevels 속성은 color 및 texture 데이터에서 원하는
mip 레벨 수를 정의합니다.
사용자 에이전트가 요청된 수를 생성할 수 없는 경우 더 적게 생성할 수 있습니다. 작성자는 실제 mip 레벨 수를 확인하기 위해
mipLevels를
질의해야 합니다.
viewPixelWidth 및 viewPixelHeight 속성은
XRCompositionLayer의
직사각형 치수를 정의합니다.
layout 속성은 레이어의 레이아웃을 정의합니다.
clearOnAccess 속성은 이 레이어와 관련된 texture가
초기 프레임에서 지워져야 하는지, 또는 매 프레임마다 지워져야 하는지를 정의합니다.
6.5. XRQuadLayerInit
XRQuadLayerInit
dictionary는 XRQuadLayer가
어떻게 초기화되는지를 설명하는 구성 가능한 값의 집합을 나타냅니다.
dictionary :XRQuadLayerInit XRLayerInit {XRRigidTransform ?;transform float = 1.0;width float = 1.0; };height
6.6. XRCylinderLayerInit
XRCylinderLayerInit
dictionary는 XRCylinderLayer가
어떻게 초기화되는지를 설명하는 구성 가능한 값의 집합을 나타냅니다.
dictionary :XRCylinderLayerInit XRLayerInit {XRRigidTransform ?;transform float = 2.0;radius float = 0.78539;centralAngle float = 2.0; };aspectRatio
centralAngle의
기본값은 π / 4입니다.
6.7. XREquirectLayerInit
XREquirectLayerInit
dictionary는 XREquirectLayer가
어떻게 초기화되는지를 설명하는 구성 가능한 값의 집합을 나타냅니다.
dictionary :XREquirectLayerInit XRLayerInit {XRRigidTransform ?;transform float = 0;radius float = 6.28318;centralHorizontalAngle float = 1.570795;upperVerticalAngle float = -1.570795; };lowerVerticalAngle
centralHorizontalAngle의
기본값은 2π입니다.
upperVerticalAngle의
기본값은 π/2입니다.
lowerVerticalAngle의
기본값은 -π/2입니다.
6.8. XRCubeLayerInit
XRCubeLayerInit
dictionary는 XRCubeLayer가
어떻게 초기화되는지를 설명하는 구성 가능한 값의 집합을 나타냅니다.
dictionary :XRCubeLayerInit XRLayerInit {DOMPointReadOnly ?; };orientation
6.9. XRWebGLBinding
XRWebGLBinding
객체는 GPU 백엔드를 가지는 레이어를 생성하는 데 사용됩니다.
[Exposed =Window ]interface {XRWebGLBinding constructor (XRSession ,session XRWebGLRenderingContext );context readonly attribute double nativeProjectionScaleFactor ;readonly attribute boolean usesDepthValues ;XRProjectionLayer createProjectionLayer (optional XRProjectionLayerInit = {});init XRQuadLayer createQuadLayer (optional XRQuadLayerInit = {});init XRCylinderLayer createCylinderLayer (optional XRCylinderLayerInit = {});init XREquirectLayer createEquirectLayer (optional XREquirectLayerInit = {});init XRCubeLayer createCubeLayer (optional XRCubeLayerInit = {});init XRWebGLSubImage getSubImage (XRCompositionLayer ,layer XRFrame ,frame optional XREye = "none");eye XRWebGLSubImage getViewSubImage (XRProjectionLayer ,layer XRView );view undefined foveateBoundTexture (GLenum ,target float ); };fixed_foveation
init dictionary는 optional이어서는 안 됩니다. 이는 bikeshed issue 1566입니다.
각 XRWebGLBinding에는
XRWebGLRenderingContext
유형의 context 객체가 있으며, 이는
WebGLRenderingContext
또는 WebGL2RenderingContext의
인스턴스입니다.
각 XRWebGLBinding에는
연결된 session이 있으며, 이는 생성 시 사용된
XRSession입니다.
각 XRWebGLBinding에는
내부 WeakSet foveatedTextures가 있으며,
이는 foveateBoundTexture를
호출할 때 지정된 target에 바인딩된 텍스처에 대한 약한 참조를 보관합니다.
NOTE: 둘 이상의 XRWebGLBinding를
생성할 수 있습니다.
XRWebGLBinding
인스턴스로 생성된 모든 레이어는, 둘 다 동일한 session 및 동일한
context로
생성된 경우 다른 XRWebGLBinding
인스턴스와 함께 사용할 수 있습니다.
레이어 또는 XRWebGLSubImage
인스턴스의 수명은 이를 생성한 XRWebGLBinding의
수명에 묶이지 않습니다.
XRWebGLBinding을
통해 생성된 각 XRCompositionLayer에는
color texture에 대한 WebGLTextures의
array인 내부 colorTextures 배열과,
depth/stencil texture에 대한 opaque textures의
array인 내부 depthStencilTextures,
그리고 motion texture에 대한 opaque
textures의
array인 내부 motionVectorTextures가 있습니다.
XRWebGLBinding을
통해 생성된 각 XRProjectionLayer에는
color texture에 대한 opaque
textures의 array인 내부 secondary
view용 colorTextures
배열과, secondary views를 렌더링하는 데 사용되는
depth/stencil texture에 대한 opaque textures의 array인 내부 secondary view용
depthStencilTextures
배열이 있습니다.
XRWebGLBinding(session, context)
constructor는 호출될 때 다음 단계를 수행해야 합니다.
-
binding을 session의 relevant realm 안의 new
XRWebGLBinding으로 둡니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가 lost이면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
session이 immersive session이 아니면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
context의 XR compatible boolean이
false이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
binding의 context를 context로 초기화합니다.
-
binding의 session을 session으로 초기화합니다.
-
binding을 session의 bindings에 추가합니다.
-
binding을 반환합니다.
nativeProjectionScaleFactor
function은 session의 recommended WebGL framebuffer resolution에
곱하여 session의 native WebGL framebuffer resolution을 산출해야 하는
값을 반환합니다.
크기로 인해 레이아웃이 변경되는 경우의
특수한 UA 동작(예: 요청된 너비가 "stereo-left-right"에서
한계를 초과하는 경우)
usesDepthValues 속성이
false이면, depth buffer attachment가 있더라도
XR
Compositor가 값을 사용해서는 안 됨을 나타냅니다. 이 속성이
true이면, depth buffer attachment의 콘텐츠가
XR
Compositor에 의해 사용되며, 레이어에 렌더링된 장면을 대표할 것으로 기대됨을 나타냅니다.
XRTextureType
textureType, XRWebGLRenderingContext
context 및 XRLayerLayout
layout을 사용하여 layout 속성을 결정하려면, 사용자 에이전트는 다음 단계를
실행해야 합니다.
-
context가
WebGL2RenderingContext가 아니고 textureType이"texture-array"이면,TypeError를 throw하고 이 단계를 중단합니다. -
textureType이
"texture-array"이고 session의 list of views 안의 모든 views가 동일한 recommended WebGL color texture resolution을 갖지 않으면,NotSupportedError를 throw하고 이 단계를 중단합니다. -
layout이
"mono"이면, layout을 반환하고 이 단계를 중단합니다. -
layout이
"default"이면, 다음 단계를 실행합니다.-
list of views의 크기가
1이면,"mono"를 반환하고 이 단계를 중단합니다. -
textureType이
"texture-array"이면, layout을 반환하고 이 단계를 중단합니다.
-
-
layout이
"default"또는"stereo"이고 textureType이"texture"이면, 다음 단계를 실행합니다.-
사용자 에이전트가
"stereo-left-right"layout을 선호하면,"stereo-left-right"를 반환하고 이 단계를 중단합니다. -
사용자 에이전트가
"stereo-top-bottom"layout을 선호하면,"stereo-top-bottom"를 반환하고 이 단계를 중단합니다.
-
-
layout을 반환합니다.
XRSession
session, XRWebGLRenderingContext
context 및 XRLayerLayout
layout을 사용하여 최대 scalefactor를 결정하려면, 사용자 에이전트는 다음 단계를
실행해야 합니다.
-
largest width를 secondary views를 제외한 session의 list of views에서 recommended WebGL color texture resolution의 가장 큰 너비로 둡니다.
-
largest height를 secondary views를 제외한 session의 list of views에서 recommended WebGL color texture resolution의 가장 큰 높이로 둡니다.
-
layout이
"stereo-left-right"layout이면, largest width에2를 곱합니다. -
layout이
"stereo-top-bottom"layout이면, largest height에2를 곱합니다. -
largest view dimension을 largest width 또는 largest height 중 더 큰 값으로 둡니다.
-
largest texture dimension을 context가 생성한
WebGLTexture의 가장 큰 치수로 둡니다. -
largest texture dimension을 largest view dimension으로 나눈 값을 반환합니다.
XRProjectionLayer
layer, XRTextureType
textureType, GLenum
textureFormat 및 float scaleFactor를 사용하여 projection 레이어용
color texture를 할당하려면,
사용자 에이전트는 다음 단계를 실행해야 합니다.
-
array를 context의 relevant realm 안의 new array로 둡니다.
-
context를 layer의 context로 둡니다.
-
session을 layer의 session으로 둡니다.
-
numViews를 secondary views를 제외한 session의 list of views의 수로 둡니다.
-
view를 session의 list of views에서 secondary views가 아닌 첫 번째 항목으로 둡니다.
-
width를 view의 recommended WebGL color texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended WebGL color texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
textureFormat이 projection 레이어용 color format 목록에 없으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
layer의
layout이"mono"또는"default"인 경우:- textureType이
"texture-array"인 경우: - secondary views를 제외하고 session의 list of views 안의 모든 views가 동일한 recommended WebGL color texture
resolution을 갖지 않으면,
NotSupportedError를 throw하고 이 단계를 중단합니다.- array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat, width 및 height를 사용하여 numViews 레이어를 가진
TEXTURE_2D_ARRAYtexture로 생성됩니다.- opaque texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다.- array를 반환하고 이 단계를 중단합니다.
- array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat, width 및 height를 사용하여 numViews 레이어를 가진
- 그렇지 않은 경우
-
session의 list of views 안의 각 view에 대해:
-
view가 secondary view이면 계속합니다.
-
width를 view의 recommended WebGL color texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended WebGL color texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는 context, textureFormat, width 및 height를 사용하여
TEXTURE_2Dtexture로 생성됩니다. -
texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
texture를 array에 추가합니다.
- array를 반환하고 이 단계를 중단합니다.
-
- textureType이
-
secondary views를 제외하고 session의 list of views 안의 views가 모두 동일한 recommended WebGL color texture resolution을 갖지 않으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
layer의
layout이stereo-left-right이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat, numViews에 width를 곱한 값 및 height를 사용하여 textureType texture로 생성됩니다. -
layer의
layout이stereo-top-bottom이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat, width 및 numViews에 height를 곱한 값을 사용하여 textureType texture로 생성됩니다. -
opaque texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
array를 반환합니다.
XRProjectionLayer
layer, XRTextureType
textureType, GLenum
textureFormat 및 float scaleFactor를 사용하여 projection 레이어용
depth texture를 할당하려면,
사용자 에이전트는 다음 단계를 실행해야 합니다.
-
array를 context의 relevant realm 안의 new array로 둡니다.
-
context를 layer의 context로 둡니다.
-
session을 layer의 session으로 둡니다.
-
textureFormat이
0이면, array를 반환하고 이 단계를 중단합니다. -
context가
WebGLRenderingContext이고WEBGL_depth_textureextension이 context에서 활성화되어 있지 않으면, array를 반환하고 이 단계를 중단합니다. -
textureFormat이 projection 레이어용 depth format 목록에 없으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
numViews를 secondary views를 제외한 session의 list of views의 수로 둡니다.
-
view를 session의 list of views에서 secondary view가 아닌 첫 번째 항목으로 둡니다.
-
width를 view의 recommended WebGL depth texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended WebGL depth texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
layer의
layout이"mono"또는"default"인 경우:- textureType이
"texture-array"인 경우: - array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat,
stencil, width 및 height를 사용하여 numViews
레이어를 가진
TEXTURE_2D_ARRAYtexture로 생성됩니다.- opaque texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다.- array를 반환하고 이 단계를 중단합니다.
- opaque texture가 어떤 이유로든 생성될 수 없으면,
- 그렇지 않은 경우
-
session의 list of views 안의 각 view에 대해:
-
view가 secondary view이면 계속합니다.
-
width를 view의 recommended WebGL depth texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended WebGL depth texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는 context, textureFormat, stencil, width 및 height를 사용하여
TEXTURE_2Dtexture로 생성됩니다. -
texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
texture를 array에 추가합니다.
- array를 반환하고 이 단계를 중단합니다.
-
- textureType이
-
secondary views를 제외하고 session의 list of views 안의 views가 모두 동일한 recommended WebGL color texture resolution을 갖지 않으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
layer의
layout이stereo-left-right이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat, stencil, numViews에 width를 곱한 값 및 height를 사용하여 textureType texture로 생성됩니다. -
layer의
layout이stereo-top-bottom이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context, textureFormat, stencil, width 및 numViews에 height를 곱한 값을 사용하여 textureType texture로 생성됩니다. -
opaque texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
array를 반환합니다.
XRProjectionLayer
layer를 사용하여 projection 레이어용 motion vector texture를
할당하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
array를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
context를 layer의 context로 둡니다.
-
session을 layer의 session으로 둡니다.
-
session이 "space-warp" feature descriptor로 생성되지 않았다면, array를 반환하고 이 단계를 중단합니다.
-
context가
WebGLRenderingContext이고WEBGL_depth_textureextension이 context에서 활성화되어 있지 않으면, array를 반환하고 이 단계를 중단합니다. -
numViews를 secondary views를 제외한 session의 list of views의 수로 둡니다.
-
view를 session의 list of views에서 secondary view가 아닌 첫 번째 항목으로 둡니다.
-
width를 view의 recommended motion vector texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended motion vector texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
layer의
layout이"mono"또는"default"인 경우:- textureType이
"texture-array"인 경우: - array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context,
RGBA16F, width 및 height를 사용하여 numViews 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다.- opaque texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다.- array를 반환하고 이 단계를 중단합니다.
- opaque texture가 어떤 이유로든 생성될 수 없으면,
- 그렇지 않은 경우
-
session의 list of views 안의 각 view에 대해:
-
view가 secondary view이면 계속합니다.
-
width를 view의 recommended motion vector texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended motion vector texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는 context,
RGBA16F, width 및 height를 사용하여TEXTURE_2Dtexture로 생성됩니다. -
texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
texture를 array에 추가합니다.
- array를 반환하고 이 단계를 중단합니다.
-
- textureType이
-
secondary views를 제외하고 session의 list of views 안의 views가 모두 동일한 recommended motion vector texture resolution을 갖지 않으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
layer의
layout이stereo-left-right이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context,RGBA16F, numViews에 width를 곱한 값 및 height를 사용하여 textureType texture로 생성됩니다. -
layer의
layout이stereo-top-bottom이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context,RGBA16F, width 및 numViews에 height를 곱한 값을 사용하여 textureType texture로 생성됩니다. -
opaque texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
array를 반환합니다.
XRProjectionLayer
layer, XRTextureType
textureType, GLenum
textureFormat 및 float scaleFactor를 사용하여 secondary
view용 color texture를
할당하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
context를 layer의 context로 둡니다.
-
session을 layer의 session으로 둡니다.
-
array를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
textureFormat이 projection 레이어용 color format 목록에 없으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의 list of views 안의 각 view에 대해:
-
view가 secondary view가 아니면 계속합니다.
-
width를 view의 recommended WebGL color texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended WebGL color texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
texture를 다음과 같이 초기화합니다.
- textureType이
"texture-array"인 경우: - texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는
context, textureFormat, width 및
height를 사용하여
TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는
context, textureFormat, width 및
height를 사용하여
TEXTURE_2Dtexture로 생성됩니다.
- textureType이
-
texture가 어떤 이유로든 생성될 수 없으면,
OperationError를 throw하고 이 단계를 중단합니다. -
texture를 array에 추가합니다.
-
-
array를 반환하고 이 단계를 중단합니다.
XRProjectionLayer
layer, XRTextureType
textureType, GLenum
textureFormat 및 float scaleFactor를 사용하여 secondary
view용 depth texture를
할당하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
context를 layer의 context로 둡니다.
-
session을 layer의 session으로 둡니다.
-
textureFormat이
0이면, array를 반환하고 이 단계를 중단합니다. -
context가
WebGLRenderingContext이고WEBGL_depth_textureextension이 context에서 활성화되어 있지 않으면, array를 반환하고 이 단계를 중단합니다. -
textureFormat이 projection 레이어용 depth format 목록에 없으면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
array를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
session의 list of views 안의 각 view에 대해:
-
view가 secondary view가 아니면 계속합니다.
-
width를 view의 recommended WebGL depth texture resolution의 너비에 scaleFactor를 곱한 값으로 둡니다.
-
height를 view의 recommended WebGL depth texture resolution의 높이에 scaleFactor를 곱한 값으로 둡니다.
-
texture를 다음과 같이 초기화합니다.
- textureType이
"texture-array"인 경우: - texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는
context, textureFormat, stencil,
width 및 height를 사용하여
TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- texture를 context의 relevant realm 안의 new opaque texture 인스턴스로 둡니다. 이는
context, textureFormat, stencil,
width 및 height를 사용하여
TEXTURE_2Dtexture로 생성됩니다.
- textureType이
-
texture를 array에 추가합니다.
-
-
array를 반환하고 이 단계를 중단합니다.
scaleFactor는 secondary view용으로 다시 계산되어야 합니다.
XRCompositionLayer
layer, XRTextureType
textureType 및 XRLayerInit
init을 사용하여 color
texture를 할당하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
array를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
context를 layer의 context로 둡니다.
-
init의
colorFormat이 non-projection 레이어용 color format 목록에 없으면,NotSupportedError를 throw하고 이 단계를 중단합니다. -
init의
mipLevels가1보다 작으면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
init의
mipLevels가1보다 크고viewPixelWidth및viewPixelHeight가2의 거듭제곱이 아니면,InvalidStateError를 throw하고 이 단계를 중단합니다 -
- textureType이
"texture-array"인 경우: - array를 이 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의
colorFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 1개의 내부 texture를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의
colorFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_2Dtexture로 생성됩니다.
- textureType이
-
- textureType이
"texture-array"인 경우: - array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의
colorFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 2개 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다.- array를 반환하고 이 단계를 중단합니다.
- 그렇지 않은 경우
- array를 context의 relevant realm 안의 new opaque
texture 인스턴스 2개로 초기화합니다. 이는 context 및 init의
colorFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_2Dtexture로 생성됩니다.- array를 반환하고 이 단계를 중단합니다.
- textureType이
-
layer의
layout이stereo-left-right이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의colorFormat,mipLevels,viewPixelWidth의 두 배 및viewPixelHeight값을 사용하여 textureType texture로 생성됩니다. -
layer의
layout이stereo-top-bottom이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의colorFormat,mipLevels,viewPixelWidth및viewPixelHeight의 두 배 값을 사용하여 textureType texture로 생성됩니다. -
array를 반환합니다.
XRCompositionLayer
layer, XRTextureType
textureType 및 XRLayerInit
init을 사용하여 depth
texture를 할당하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
array를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
context를 layer의 context로 둡니다.
-
init의
depthFormat이 설정되어 있지 않으면, array를 반환하고 이 단계를 중단합니다. -
init의
depthFormat이 non-projection 레이어용 depth format 목록에 없으면,NotSupportedError를 throw하고 이 단계를 중단합니다. -
init의
mipLevels가1보다 작으면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
init의
mipLevels가1보다 크고viewPixelWidth및viewPixelHeight가2의 거듭제곱이 아니면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
- textureType이
"texture-array"인 경우: - array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의
depthFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 1개의 내부 texture를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의
depthFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_2Dtexture로 생성됩니다.
- textureType이
-
- textureType이
"texture-array"인 경우: - array를 context의 relevant realm 안의 new opaque
texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의
depthFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 2개 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다.- array를 반환하고 이 단계를 중단합니다.
- 그렇지 않은 경우
- array를 context의 relevant realm 안의 new opaque
texture 인스턴스 2개로 초기화합니다. 이는 context 및 init의
depthFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_2Dtexture로 생성됩니다.- array를 반환하고 이 단계를 중단합니다.
- textureType이
-
layer의
layout이stereo-left-right이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의depthFormat,mipLevels,viewPixelWidth의 두 배 및viewPixelHeight값을 사용하여 textureType texture로 생성됩니다. -
layer의
layout이stereo-top-bottom이면, array를 context의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의depthFormat,mipLevels,viewPixelWidth및viewPixelHeight의 두 배 값을 사용하여 textureType texture로 생성됩니다. -
array를 반환합니다.
createProjectionLayer(optional XRProjectionLayerInit init)
method는 새 XRProjectionLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
layer를 this의 relevant realm 안의 new
XRProjectionLayer로 둡니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가 lost이면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
session 및 context로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer의 isStatic을
false로 초기화합니다. -
layer의
ignoreDepthValues를 다음과 같이 초기화합니다.- init의
depthFormat이false이고 XR Compositor가 depth 값을 사용할 경우 - layer의
ignoreDepthValues를false로 초기화합니다 - 그렇지 않은 경우
- layer의
ignoreDepthValues를true로 초기화합니다
- init의
-
layer의
fixedFoveation을0으로 초기화합니다. -
layout을 init의
textureType, context 및"default"를 사용하여 layout 속성을 결정한 결과로 둡니다. -
maximum scalefactor를 session, context 및 layout로 최대 scalefactor를 결정한 결과로 둡니다.
-
scaleFactor가 maximum scalefactor보다 크면,scaleFactor를 maximum scalefactor로 설정합니다. -
layer의
layout을 layout으로 초기화합니다. -
layer의
needsRedraw를true로 초기화합니다. -
layer의 colorTextures를 layer, init의
textureType, init의colorFormat및 init의scaleFactor로 projection 레이어용 color texture를 할당한 결과로 둡니다. -
layer의 depthStencilTextures를 layer, init의
textureType, init의depthFormat및 init의scaleFactor로 projection 레이어용 depth texture를 할당한 결과로 둡니다. -
layer의 motionVectorTextures를 layer, init의
depthFormat및 init의scaleFactor로 projection 레이어용 motion vector texture를 할당한 결과로 둡니다. -
secondary view용 colortextures를 다음과 같이 초기화합니다.
- session이 "secondary-views"가 활성화된 상태로 생성된 경우
- secondary view용
colortextures를 layer, init의
textureType, init의colorFormat및 init의scaleFactor로 secondary view용 color texture를 할당한 결과로 둡니다. - 그렇지 않은 경우
- secondary view용
colortextures를
null로 둡니다.
-
secondary view용 depthstenciltextures를 다음과 같이 초기화합니다.
- session이 "secondary-views"가 활성화된 상태로 생성된 경우
- secondary view용
depthstenciltextures를 layer, init의
textureType, init의depthFormat및 init의scaleFactor로 secondary view용 depth texture를 할당한 결과로 둡니다. - 그렇지 않은 경우
- secondary view용
depthstenciltextures를
null로 둡니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
createQuadLayer(XRQuadLayerInit init)
method는 새 XRQuadLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가 lost이면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XRQuadLayer로 둡니다. -
session 및 context로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer 및 init으로 initialize a quad layer를 실행합니다.
-
layout을 init의
textureType, context 및 init의layout을 사용하여 layout 속성을 결정한 결과로 둡니다. -
layer의
layout을 layout으로 초기화합니다. -
layer의
needsRedraw를true로 초기화합니다. -
layer의 colorTextures를 layer, init의
textureType및 init으로 color texture를 할당한 결과로 둡니다. -
layer의 depthStencilTextures를 layer, init의
textureType및 init으로 depth texture를 할당한 결과로 둡니다. -
layer의 motionVectorTextures를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
createCylinderLayer(XRCylinderLayerInit init)
method는 새 XRCylinderLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가 lost이면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XRCylinderLayer로 둡니다. -
session 및 context로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer 및 init으로 initialize a cylinder layer를 실행합니다.
-
layout을 init의
textureType, context 및 init의layout을 사용하여 layout 속성을 결정한 결과로 둡니다. -
layer의
layout을 layout으로 초기화합니다. -
layer의
needsRedraw를true로 초기화합니다. -
layer의 colorTextures를 layer, init의
textureType및 init으로 color texture를 할당한 결과로 둡니다. -
layer의 depthStencilTextures를 layer, init의
textureType및 init으로 depth texture를 할당한 결과로 둡니다. -
layer의 motionVectorTextures를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
createEquirectLayer(XREquirectLayerLayerInit init)
method는 새 XREquirectLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가 lost이면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
init의
space가XRReferenceSpace유형의 인스턴스가 아니면,TypeError를 throw하고 이 단계를 중단합니다. -
init의
space가"viewer"type을 가지면,TypeError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XREquirectLayer로 둡니다. -
session 및 context로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer 및 init으로 initialize a equirect layer를 실행합니다.
-
layout을 init의
textureType, context 및 init의layout을 사용하여 layout 속성을 결정한 결과로 둡니다. -
layer의
layout을 layout으로 초기화합니다. -
layer의
needsRedraw를true로 초기화합니다. -
layer의 colorTextures를 layer, init의
textureType및 init으로 color texture를 할당한 결과로 둡니다. -
layer의 depthStencilTextures를 layer, init의
textureType및 init으로 depth texture를 할당한 결과로 둡니다. -
layer의 motionVectorTextures를 context의 new array로 둡니다. 이 array는 relevant realm 안에 있습니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
createCubeLayer(XRCubeLayerInit init)
method는 새 XRCubeLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가
WebGL2RenderingContextcontext가 아니면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
context가 lost이면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
init의
space가XRReferenceSpace유형의 인스턴스가 아니면,TypeError를 throw하고 이 단계를 중단합니다. -
init의
space가"viewer"type을 가지면,TypeError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XRCubeLayer로 둡니다. -
session 및 context로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer의
orientation을 다음과 같이 초기화합니다.- init의
orientation이 설정된 경우 - layer의
orientation을 init의orientation으로fromPoint를 실행한 결과로 둡니다. - 그렇지 않은 경우
- layer의
orientation을 this의 relevant realm 안의 newDOMPointReadOnly로 둡니다.
- init의
-
layout을 init의
layout으로 둡니다. -
textureType을 init의
textureType으로 둡니다. -
layer의
needsRedraw를true로 초기화합니다. -
layout이
"default"또는"stereo-left-right"또는"stereo-top-bottom"이면,TypeError를 throw하고 이 단계를 중단합니다. -
layer의 colorTextures를 이
XRCubeLayer의 relevant realm 안의 new array로 둡니다. -
layout 값에 따라 layer의 colorTextures를 다음과 같이 초기화합니다.
-
- textureType이
"texture-array"인 경우: - colorTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의colorFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 6개 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- colorTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의colorFormat,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_CUBE_MAPtexture로 생성됩니다.
- textureType이
-
그렇지 않고, layer의
layout이"stereo"인 경우:- textureType이
"texture-array"인 경우: - colorTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의colorFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 12개 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- colorTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 2개로 초기화합니다. 이는 context 및 init의colorFormat,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_CUBE_MAPtexture로 생성됩니다.
- textureType이
-
-
layer의 depthStencilTextures를 이
XRCubeLayer의 relevant realm 안의 new array로 둡니다. -
layer의 motionVectorTextures를 이
XRCubeLayer의 relevant realm 안의 new array로 둡니다. -
init의
depthFormat이 설정되어 있으면, layer의 depthStencilTextures를 다음과 같이 초기화합니다.-
context가
WebGL2RenderingContext가 아니고WEBGL_depth_textureextension이 context에서 활성화되어 있지 않으면,TypeError를 throw하고 이 단계를 중단합니다. -
- textureType이
"texture-array"인 경우: - depthStencilTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의depthFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 6개 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- depthStencilTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의depthFormat,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_CUBE_MAPtexture로 생성됩니다.
- textureType이
-
그렇지 않고, layer의
layout이"stereo"인 경우:- textureType이
"texture-array"인 경우: - depthStencilTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 1개로 초기화합니다. 이는 context 및 init의depthFormat,mipLevels,viewPixelWidth및viewPixelHeight값을 사용하여 12개 레이어를 가진TEXTURE_2D_ARRAYtexture로 생성됩니다. - 그렇지 않은 경우
- depthStencilTextures를 이
XRCubeLayer의 relevant realm 안의 new opaque texture 인스턴스 2개로 초기화합니다. 이는 context 및 init의depthFormat,viewPixelWidth및viewPixelHeight값을 사용하여TEXTURE_CUBE_MAPtexture로 생성됩니다.
- textureType이
-
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
textureType이
"texture-array"인
경우,
XRCubeLayer는
cube map의 각 면을 저장하기 위해 다음 순서로 6개의 texture layer를 사용해야 합니다.
[TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_Z]
textureType이
"texture-array"이고
layout이
"stereo"인
경우, 왼쪽 눈의 콘텐츠는 layer index 0부터 저장되어야 하며 오른쪽 눈의 콘텐츠는
layer index 6부터 저장되어야 합니다.
space는 어떻게 처리해야 하는가. cubemap의 가장자리까지 걸어갈 수 있는가?
orientation의
초기 상태를 결정하세요.
XRCompositionLayer
layer 및 XRFrame
frame 매개변수로 XRWebGLBinding
binding의 XRWebGLSubImage 생성 함수의 상태를
검증하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
frame의
session이 layer의 session과 같지 않으면,false를 반환하고 이 단계를 중단합니다. -
frame의 active boolean이
false이면,false를 반환하고 이 단계를 중단합니다. -
frame의 animationFrame boolean이
false이면,false를 반환하고 이 단계를 중단합니다. -
binding의 session이 layer의 session과 같지 않으면,
false를 반환하고 이 단계를 중단합니다. -
binding의 context가 layer의 context와 같지 않으면,
false를 반환하고 이 단계를 중단합니다. -
layer의 colorTextures array가 비어 있거나 없으면,
false를 반환하고 이 단계를 중단합니다. -
layer의 isStatic이
true이고 layer의needsRedraw가false이면,false를 반환하고 이 단계를 중단합니다. -
true를 반환합니다.
opaque texture
texture, XRLayerLayout
layout, integer offset 및 integer num을 사용하여 XRViewport
viewport의 viewport를
초기화하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
viewport의
x를0으로 설정합니다. -
viewport의
y를0으로 설정합니다. -
viewport의
width를 texture의 픽셀 너비로 설정합니다. -
viewport의
height를 texture의 픽셀 높이로 설정합니다. -
viewport를 다음과 같이 업데이트합니다.
- layout이
"stereo-left-right"인 경우 - viewport의
x를 texture의 픽셀 너비에 offset을 곱하고 num으로 나눈 값으로 설정합니다.- viewport의
width를 subimage의 texture 픽셀 너비를 num으로 나눈 값으로 설정합니다. - viewport의
- 그렇지 않고 layout이
"stereo-top-bottom"인 경우 - viewport의
y를 texture의 픽셀 높이에 offset을 곱하고 num으로 나눈 값으로 설정합니다.- viewport의
height를 subimage의 texture 픽셀 높이를 num으로 나눈 값으로 설정합니다. - viewport의
- layout이
getSubImage(XRCompositionLayer layer, XRFrame frame, optional XREye eye = "none")
method는 새 XRWebGLSubImage를
생성합니다.
이 method가 XRWebGLBinding
binding에서 호출되면, 다음 단계를 실행해야 합니다.
-
subimage를 다음과 같이 초기화합니다.
-
getSubImage()가 이전에 동일한 binding, layer 및 eye로 호출된 경우, 사용자 에이전트는 다음을 할 수 있습니다. - subimage를 동일한 인수로 이전 호출에서 반환된 동일한
XRWebGLSubImage객체로 둡니다. - 그렇지 않은 경우
- subimage를 this의 relevant realm 안의 new
XRWebGLSubImage로 둡니다.- subimage의
viewport를 this의 relevant realm 안의 newXRViewport로 둡니다. - subimage의
-
-
layer가 session의
layersarray 안에 없으면,TypeError를 throw하고 이 단계를 중단합니다. -
layer의 type이
XRProjectionLayer이면,TypeError를 throw하고 이 단계를 중단합니다. -
layer의
layoutattribute가"default"이면,TypeError를 throw하고 이 단계를 중단합니다. -
index를
0으로 둡니다. -
layer의
layoutattribute가"stereo"인 경우:-
eye가
"right"인 경우:- layer가
XRCubeLayertype인 경우 - index를
6으로 설정합니다 - 그렇지 않은 경우
- index를
1로 설정합니다
- layer가
-
layer 및 frame으로 XRWebGLSubImage 생성 함수의 상태를 검증한 결과가
false이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
subimage의
imageIndex를 다음과 같이 초기화합니다.- layer가
"texture-array"textureType으로 생성된 경우 - subimage의
imageIndex를 index로 초기화합니다. - 그렇지 않은 경우
- subimage의
imageIndex를0으로 초기화합니다.
- layer가
-
subimage의
colorTexture를 다음과 같이 초기화합니다.- layer가
"texture"textureType으로 생성된 경우 - subimage의
colorTexture를 layer의 colorTextures array에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않은 경우
- subimage의
colorTexture를 layer의 colorTextures array의 첫 번째 요소로 초기화합니다.
- layer가
-
subimage의
depthStencilTexture를 다음과 같이 초기화합니다.- layer의 depthStencilTextures가 빈 array인 경우
- subimage의
depthStencilTexture를null로 초기화합니다. - 그렇지 않고 layer가
"texture"textureType으로 생성된 경우 - subimage의
depthStencilTexture를 layer의 depthStencilTextures array에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않은 경우
- subimage의
depthStencilTexture를 layer의 depthStencilTextures array의 첫 번째 요소로 초기화합니다.
-
subimage의
motionVectorTexture,motionVectorTextureWidth및motionVectorTextureHeight를null로 초기화합니다. -
subimage의
colorTextureWidth를 subimage의colorTexture의 픽셀 너비로 설정합니다. -
subimage의
colorTextureHeight를 subimage의colorTexture의 픽셀 높이로 설정합니다. -
subimage의
depthStencilTexture가null이 아니면, subimage의depthStencilTextureWidth를depthStencilTexturearray의 첫 번째 texture의 픽셀 너비로 설정합니다. -
subimage의
depthStencilTexture가null이 아니면, subimage의depthStencilTextureHeight를depthStencilTexturearray의 첫 번째 texture의 픽셀 높이로 설정합니다. -
viewsPerTexture를
1로 둡니다. -
layer의
layoutattribute가"stereo-left-right"또는"stereo-top-bottom"이면, viewsPerTexture를2로 설정합니다. -
subimage의
viewport에 대해 subimage의colorTexture, layer의layout, index 및 viewsPerTexture로 viewport를 초기화합니다. -
needsRedraw를false로 설정하기 위해 task를 queue합니다. -
subimage를 반환합니다.
getViewSubImage(XRProjectionLayer layer, XRView view)
method는 새 XRWebGLSubImage를
생성합니다.
이 method가 XRWebGLBinding
binding에서 호출되면, 다음 단계를 실행해야 합니다.
-
subimage를 다음과 같이 초기화합니다.
-
getViewSubImage()가 이전에 동일한 binding, layer 및 view로 호출된 경우, 사용자 에이전트는 다음을 할 수 있습니다. - subimage를 동일한 인수로 이전 호출에서 반환된 동일한
XRWebGLSubImage객체로 둡니다. - 그렇지 않은 경우
- subimage를 this의 relevant realm 안의 new
XRWebGLSubImage로 둡니다.- subimage의
viewport를 this의 relevant realm 안의 newXRViewport로 둡니다. - subimage의
-
-
frame을 view의
frame으로 둡니다. -
layer 및 frame으로 XRWebGLSubImage 생성 함수의 상태를 검증한 결과가
false이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
layer가 session의
layersarray 안에 없으면,TypeError를 throw하고 이 단계를 중단합니다. -
view의 active flag가
false이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
index를 다음과 같이 초기화합니다.
- view가 session의 list of views의 secondary view인 경우
- index를 primary views를 제외한 session의 list of views에서 view의 view의 오프셋으로 둡니다.
- 그렇지 않은 경우
- index를 secondary views를 제외한 session의 list of views에서 view의 view의 오프셋으로 둡니다.
-
subimage의
imageIndex를 다음과 같이 초기화합니다.- layer가
"texture-array"textureType으로 생성된 경우: - subimage의
imageIndex를 index로 초기화합니다. - 그렇지 않은 경우
- subimage의
imageIndex를0으로 초기화합니다.
- layer가
-
subimage의
colorTexture를 다음과 같이 초기화합니다.- view가 session의 list of views의 secondary view인 경우
- subimage의
colorTexture를 layer의 secondary view용 colorTextures에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않고 layer의
layout이"default"이고 layer가"texture"textureType으로 생성된 경우 - subimage의
colorTexture를 layer의 colorTextures array에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않은 경우
- subimage의
colorTexture를 layer의 colorTextures array의 첫 번째 요소로 초기화합니다.
-
subimage의
depthStencilTexture를 다음과 같이 초기화합니다.- layer의 depthStencilTextures가 빈 array인 경우
- subimage의
depthStencilTexture를null로 초기화합니다. - 그렇지 않고 view가 session의 list of views의 secondary view인 경우
- subimage의
colorTexture를 layer의 secondary view용 depthStencilTextures에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않고 layer의
layout이"default"이고 layer가"texture"textureType으로 생성된 경우 - subimage의
depthStencilTexture를 layer의 depthStencilTextures array에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않은 경우
- subimage의
depthStencilTexture를 layer의 depthStencilTextures array의 첫 번째 요소로 초기화합니다.
-
subimage의
motionVectorTexture를 다음과 같이 초기화합니다.- layer의 motionVectorTextures가 빈 array이거나 view가 session의 list of views의 secondary view인 경우
- subimage의
motionVectorTexture를null로 초기화합니다. - 그렇지 않고 layer가
"texture"textureType으로 생성된 경우 - subimage의
motionVectorTexture를 layer의 motionVectorTextures array에서 index 오프셋의 요소로 초기화합니다. - 그렇지 않은 경우
- subimage의
motionVectorTexture를 layer의 motionVectorTextures array의 첫 번째 요소로 초기화합니다.
-
subimage의
colorTextureWidth를 subimage의colorTexture의 픽셀 너비로 설정합니다. -
subimage의
colorTextureHeight를 subimage의colorTexture의 픽셀 높이로 설정합니다. -
subimage의
depthStencilTexture가null이 아니면, subimage의depthStencilTextureWidth를depthStencilTexturearray의 첫 번째 texture의 픽셀 너비로 설정합니다. -
subimage의
depthStencilTexture가null이 아니면, subimage의depthStencilTextureHeight를depthStencilTexturearray의 첫 번째 texture의 픽셀 높이로 설정합니다. -
subimage의
motionVectorTexture가null이 아니면, subimage의motionVectorTextureWidth를motionVectorTexturearray의 첫 번째 texture의 픽셀 너비로 설정합니다. -
subimage의
motionVectorTexture가null이 아니면, subimage의motionVectorTextureHeight를motionVectorTexturearray의 첫 번째 texture의 픽셀 높이로 설정합니다. -
subimage의
viewport에 대해 subimage의colorTexture, layer의layout, index 및 session의 list of views의 수로 viewport를 초기화합니다. -
needsRedraw를false로 설정합니다. -
subimage를 반환합니다
NOTE: 세션은 getSubImage()
및 getViewSubImage()
호출을 경험이 WebGL을 사용하여 그리기를 시작하는 시점까지 지연하려고 해야 합니다.
일반적으로 이는 게임 로직이 실행된 후입니다. 특정 사용자 에이전트에서는 CPU 및
GPU 의존 코드에 대한 별도 단계를 두면 시스템 리소스를 동적으로 최적화할 수 있습니다.
foveateBoundTexture(GLenum target, float fixed_foveation)는
현재 바인딩된 texture 또는 texture array에 foveation을 적용합니다.
이 method가 XRWebGLBinding
binding에서 호출되면, 다음 단계를 실행해야 합니다.
-
target이
TEXTURE_2D또는TEXTURE_2D_ARRAYtype이 아니면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
사용자 에이전트 또는 장치가 foveation을 지원하지 않으면, 이 단계를 중단합니다.
-
fixed_foveation이
0보다 작으면, 이를0으로 설정합니다. -
fixed_foveation이
1보다 크면, 이를1로 설정합니다. -
binding의 context에서 target에 texture가 바인딩되어 있지 않으면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
fixedFoveation과 동일한 알고리즘을 사용하여 binding의 context를 통해 fixed_foveation을 target에 적용합니다. -
binding의 context를 사용하여 target에 바인딩된 texture를 foveatedTextures에 추가합니다.
NOTE: foveation의 효과는 즉시 적용됩니다.
XRLayer가
layers
array의 멤버인 경우, 이전 XR animation
frame 이후 다음 중 하나 이상이 발생했다면, XR animation frame이 완료된 직후
immersive XR
device에 표시되어야 합니다.
-
XRLayer가 이전 XR animation frame 이후layers에 추가되었습니다. -
XRLayer가XRWebGLLayer이고,clear,drawArrays,drawElements, 또는 framebuffer의 color 값에 유사하게 영향을 주는 다른 rendering operation이XRWebGLLayer와 연결된WebGLRenderingContext의 현재 바인딩된 framebuffer가 opaque framebuffer인 동안 호출되었습니다. -
XRLayer가XRCompositionLayer이고getSubImage()또는getViewSubImage()가 호출되었으며,colorTexturetexture의 color 값에 영향을 주는 rendering operation이 호출되었습니다.
opaque framebuffer 또는 colorTexture
texture가 immersive XR device에 표시되기 전에, 사용자 에이전트는 모든 rendering
operation이 flushed되었는지 보장해야 합니다.
7. Video layer 생성
7.1. XRMediaLayerInit
XRMediaLayerInit
dictionary는 video를 포함하는 XRCompositionLayer가
어떻게 초기화되는지를 설명하는 configurable 값들의 집합을 나타냅니다.
dictionary {XRMediaLayerInit required XRSpace space ;XRLayerLayout layout = "mono";boolean invertStereo =false ; };
space attribute는 사용자의 물리적 환경과의 공간적 관계를 정의합니다.
layout attribute는 XRCompositionLayer에서
video의 layout을 정의합니다.
invertStereo attribute는 video에서 각 view의
자연스러운 위치가 반전되어야 하는지를 정의합니다.
7.2. XRMediaQuadLayerInit
XRMediaQuadLayerInit
dictionary는 video를 포함하는 XRQuadLayer가
어떻게 초기화되는지를 설명하는 configurable 값들의 집합을 나타냅니다.
dictionary :XRMediaQuadLayerInit XRMediaLayerInit {XRRigidTransform ?;transform float ?;width float ?; };height
7.3. XRMediaCylinderLayerInit
XRMediaCylinderLayerInit
dictionary는 video를 포함하는 XRCylinderLayer가
어떻게 초기화되는지를 설명하는 configurable 값들의 집합을 나타냅니다.
dictionary :XRMediaCylinderLayerInit XRMediaLayerInit {XRRigidTransform ?;transform float = 2.0;radius float = 0.78539;centralAngle float ?; };aspectRatio
7.4. XRMediaEquirectLayerInit
XRMediaEquirectLayerInit
dictionary는 video를 포함하는 XREquirectLayer가
어떻게 초기화되는지를 설명하는 configurable 값들의 집합을 나타냅니다.
dictionary :XRMediaEquirectLayerInit XRMediaLayerInit {XRRigidTransform ?;transform float = 0.0;radius float = 6.28318;centralHorizontalAngle float = 1.570795;upperVerticalAngle float = -1.570795; };lowerVerticalAngle
7.5. XRMediaBinding
XRMediaBinding
객체는 HTMLVideoElement의
콘텐츠를 표시하는 layer를 생성하는 데 사용됩니다.
[Exposed =Window ]interface {XRMediaBinding constructor (XRSession );session XRQuadLayer createQuadLayer (HTMLVideoElement ,video optional XRMediaQuadLayerInit = {});init XRCylinderLayer createCylinderLayer (HTMLVideoElement ,video optional XRMediaCylinderLayerInit = {});init XREquirectLayer createEquirectLayer (HTMLVideoElement ,video optional XRMediaEquirectLayerInit = {}); };init
init dictionary들은 optional이어서는 안 됩니다. 이는 bikeshed issue 1566입니다.
각 XRMediaBinding에는
연결된 session이 있으며, 이는 생성 시 사용된
XRSession입니다.
NOTE: 둘 이상의 XRMediaBinding를
생성할 수 있습니다. layer의 수명은 이를 생성한 XRMediaBinding의
수명에 묶이지 않습니다.
XRMediaBinding을
통해 생성된 각 layer에는 내부 HTMLVideoElement
media가
있습니다.
layer가 session의 renderState의
일부이면, video의 현재 frame을 표시합니다. layer는 XR device 또는 video 중
더 낮은 native framerate로 update됩니다.
NOTE: layer에는 video frame만 표시됩니다. Video controls는 작성자가 구현해야 하며, 다른 layer에 그려야 합니다.
video가 layer에 어떻게 blit되는지에 대한 더 많은 명확화가 필요합니다.
XRCompositionLayer
layer와 HTMLVideoElement
media를 rendering해야 하는 경우, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
usability를 media에 대해 usability를 확인한 결과로 둡니다.
-
usability가
bad이면, layer를 투명한 검정으로 채우고 이 단계를 중단합니다. -
layer를 media 요소의 콘텐츠로 채웁니다.
drawing을 설명하는 더 나은 알고리즘을 추가하세요.
XRMediaBinding(XRSession session)
constructor는 호출될 때 다음 단계를 수행해야 합니다.
-
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
session이 immersive session이 아니면,
InvalidStateError를 throw하고 이 단계를 중단합니다. -
binding을 session의 relevant realm 안의 new
XRMediaBinding으로 둡니다. -
binding의 session을 session으로 초기화합니다.
-
binding을 반환합니다.
HTMLVideoElement
video와 XRLayerLayout
layout의 aspect
ratio를 계산하려면, 다음 단계를 실행합니다.
-
width를 video의
videoWidth로 둡니다. -
height를 video의
videoHeight로 둡니다. -
layout이
"stereo-left-right"이면, width를2로 나눕니다. -
layout이
"stereo-top-bottom"이면, height를2로 나눕니다. -
width를 height로 나눈 값을 반환합니다.
createQuadLayer(HTMLVideoElement video, XRMediaQuadLayerInit init)
method는 새 XRQuadLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XRQuadLayer로 둡니다. -
session으로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer의 media를 video로 초기화합니다.
-
layer의
needsRedraw를false로 초기화합니다. -
aspectRatio를 video 및 init의
layout으로 aspect ratio를 계산한 결과로 둡니다. -
init의
height가undefined이면,height를width를 aspectRatio로 나눈 값으로 설정합니다. -
init의
width가undefined이면,width를height에 aspectRatio를 곱한 값으로 설정합니다. -
layer 및 init으로 initialize a quad layer를 실행합니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
createCylinderLayer(HTMLVideoElement video, XRMediaCylinderLayerInit init)
method는 새 XRCylinderLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XRCylinderLayer로 둡니다. -
session으로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer의 media를 video로 초기화합니다.
-
layer의
needsRedraw를false로 초기화합니다. -
aspectRatio를 video 및 init의
layout으로 aspect ratio를 계산한 결과로 둡니다. -
init의
aspectRatio가undefined이면,aspectRatio를 aspectRatio로 설정합니다. -
layer 및 init으로 initialize a cylinder layer를 실행합니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
createEquirectLayer(HTMLVideoElement video, XRMediaEquirectLayerInit init)
method는 새 XREquirectLayer
layer를 생성합니다.
이 method가 호출되면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
-
session이 "layers"가 활성화된 상태로 생성되지 않았다면,
NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의
ended값이true이면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
init의
space가XRReferenceSpacetype의 인스턴스가 아니면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
init의
space가"viewer"type을 가지면,InvalidStateError를 throw하고 이 단계를 중단합니다. -
layer를 this의 relevant realm 안의 new
XREquirectLayer로 둡니다. -
session으로 layer에 대해 initialize a composition layer를 실행합니다.
-
layer의 media를 video로 초기화합니다.
-
layer의
needsRedraw를false로 초기화합니다. -
layer 및 init으로 initialize a equirect layer를 실행합니다.
-
XR Compositor가 어떤 이유로든 layer용 리소스를 생성할 수 없다는 것을 알고 있으면,
OperationError를 throw하고 이 단계를 중단합니다. -
layer를 반환합니다.
XREquirectLayer의
매개변수가 video 표시 방식에 어떻게 영향을 주는지 정의하세요.
8. Events
8.1. XRLayerEvent
XRLayerEvent는
XRLayer의
상태 변경을 나타내기 위해 fire됩니다.
[SecureContext ,Exposed =Window ]interface :XRLayerEvent Event {(constructor DOMString ,type XRLayerEventInit ); [eventInitDict SameObject ]readonly attribute XRLayer layer ; };dictionary :XRLayerEventInit EventInit {required XRLayer ; };layer
layer attribute는 event를 생성한 XRLayer를
나타냅니다.
8.2. Event Types
사용자 에이전트는 다음 새 event를 제공해야 합니다. event의 등록 및 firing은 DOM4 Events의 일반적인 동작을 따라야 합니다.
사용자 에이전트는 layer의 underlying resources가
lost되거나
XR
Compositor가 더 이상 layer를 reproject할 수 없을 때, XRLayer
객체에서 redraw event를 fire할 수 있습니다.
작성자는 다음 XR animation
frame에서 layer의 콘텐츠를 다시 그려야 합니다. event는 XRLayerEvent
type이어야 합니다.
9. Layer 간 depth sorting
기본적으로 layers
array는 layer들의 composition 순서를 정의하며, 각 layer는 이전 layer 위에 그려집니다.
애플리케이션이 depth로 정렬되는 layer를 가지려면, "depth-sorted-layers" feature
descriptor를 사용하여 session을 요청해야 합니다.
XRSession이
"depth-sorted-layers" feature
descriptor로 생성되면, XRProjectionLayer,
XRQuadLayer
및 XRCylinderLayer
layer는 layers
array에서의 위치가 아니라 depth에 기반하여 표시되어야 합니다.
다른 layer type은 이전처럼 계속 정렬되어야 합니다.
XRQuadLayer
및 XRCylinderLayer
layer는 그 dimensions(예: width
또는 centralAngle),
transform 및 space에 따라 정렬되어야 합니다.
XRProjectionLayer
layer는 해당 depthStencilTexture의
값에 따라 정렬되어야 합니다.
이는 또한 "depth-sorted-layers"가 활성화된 경우, XR Compositor가 depth values를 사용해야 하며 ignoreDepthValues
및 usesDepthValues가
`true`로 설정되어야 함을 의미합니다.
10. Space warp
Space warp는
XR Compositor의 reprojection을 향상시키는 기술입니다.
motionVectorTexture를
depthStencilTexture와
함께 제출함으로써, XR Compositor는 고품질 frame extrapolation 및
reprojection을 수행할 수 있으며, 이를 통해 사용자 에이전트는 낮은 framerate로 실행하면서도 사용자에게
부드러운 경험을 제공할 수 있습니다.
space warp를 활성화하려면 XRSession이
"space-warp" feature
descriptor로 생성되어야 합니다.
"space-warp"가 활성화되면, XR Compositor는
depth values를 사용해야 하며, ignoreDepthValues는
`false`로 설정되어야 하고 usesDepthValues는
`true`로 설정되어야 합니다.
motionVectorTexture는
RGBA16F
format이어야 합니다. 작성자는 이 texture의 RGB components를 해당 영역의 초당 미터 단위 속도로 채워야 하며,
red pixel은 x axis, green은 y axis, blue는 z axis에 대응합니다.
11. WebXR Device API 통합
11.1. XRRenderState 변경 사항
이 module은XRRenderStateInit
및 XRRenderState
interfaces를 layers라는
새 optional array로 확장하며, 이 array는
XRLayer
인스턴스를 포함합니다.
[SecureContext ,Exposed =Window ]partial interface XRRenderState {readonly attribute FrozenArray <XRLayer >layers ; };
layers attribute는 XR Compositor가 표시하는
XRLayer
인스턴스를 포함하는 array를 반환합니다.
기본적으로 layers
array는 layer들의 composition 순서를 정의합니다. XR Compositor는
source-over blending을 사용하여 array 내 위치 순서대로
각 layer를 그려야 합니다. "depth-sorted-layers" feature
descriptor가 활성화되어 있지 않은 한, XR Compositor는 layer에 어떠한 depth sorting도 적용해서는 안 됩니다.
NOTE: 이는 각 layer가 이전 layer들이 viewer에 가상적으로 더 가까운지 여부와 관계없이 이전 layer들을 잠재적으로 덮어쓸 수 있음을 의미합니다.
XRRenderState
객체 state가 XRSession
session에 대해 생성될 때, 사용자 에이전트는 다음 단계를 실행하여
render state를 초기화해야 합니다.
-
render state를 초기화하는 원래 단계를 실행하여 state를 초기화합니다.
-
state의
layers를 session의 relevant realm 안의 new empty array로 초기화합니다.
11.2. updateRenderState 변경 사항
이 module은 WebXR specification의 "update the pending layers state"에 주어진 단계를
대체합니다. 대신 사용자 에이전트가 XRSession
session 및 XRRenderStateInit
newState로 pending layers state를 update하려는 경우, 다음 단계를
실행해야 합니다.
-
newState의
baseLayer및 newState의layers가 모두 설정되어 있으면,NotSupportedError를 throw하고 이 단계를 중단합니다. -
activeState를 session의 active render state로 둡니다.
-
newState의
baseLayer가 설정되어 있으면:-
session의 pending render state가
null이면, 이를 activeState의 copy로 설정합니다. -
session의 pending render state의
layers를null로 설정합니다.
-
-
newState의
layers가 설정되어 있으면:-
session이 "layers"가 활성화된 상태로 생성되지 않았고 newState의
layers가1개보다 많은 인스턴스를 포함하면,NotSupportedError를 throw하고 이 단계를 중단합니다. -
newState의
layers가maxRenderLayers보다 많은 entries를 포함하면,NotSupportedError를 throw하고 이 단계를 중단합니다. -
session의 pending render state가
null이면, 이를 activeState의 copy로 설정합니다. -
newState의
layers가 duplicate instances를 포함하면,TypeError를 throw하고 이 단계를 중단합니다. -
newState의
layers의 각 layer에 대해:-
layer가
XRCompositionLayer이고 layer의 session이 session과 다르면,TypeError를 throw하고 이 단계를 중단합니다. -
layer가
XRWebGLLayer이고 layer의 session이 session과 다르면,TypeError를 throw하고 이 단계를 중단합니다.
-
-
session의 pending render state의
baseLayer를null로 설정합니다. -
session의 pending render state의
layers를 newState의layers로 설정합니다.
-
11.3. XRCompositor 변경 사항
XR Compositor는layers
array의 모든 XRLayer
인스턴스가 동시에 composited되도록 확장되어야 합니다. WebXR에 대한 다른 모든
요구사항은 계속 적용되어야 합니다.
XR
Compositor가 "none"의
XREye를
가진 view로
rendering하고 있으며, XRProjectionLayer가
아니고 layout이
"mono"가
아닌 XRCompositionLayer를
drawing하는 경우, XR Compositor는 그 layer를 view가 "left"의
XREye를
가진 것처럼 render해야 합니다.
NOTE: 이는 layer의 오른쪽 눈에 대한 쪽이 무시된다는 의미입니다. 이를 통해 작성자는 stereoscopic 및 monoscopic device에 동일한 assets를 사용할 수 있습니다.
11.4. XRView 변경 사항
각 view는 view를 포함하기에 충분히 큰 WebGL texture resolution의 최선의 추정치를 나타내는 recommended WebGL color texture resolution을 정의해야 합니다.XRSession이
"space-warp" feature
descriptor로 생성된 경우, 각 view는 recommended WebGL color texture
resolution에 기반한 recommended motion vector texture resolution을
정의해야 합니다.
각 view는 또한 recommended WebGL color texture resolution 및 recommended motion vector texture resolution에 기반한 recommended WebGL depth texture resolution도 정의해야 합니다. 사용자 에이전트는 "space-warp"가 활성화된 경우 recommended WebGL depth texture resolution을 줄이기로 결정할 수 있습니다.
"depth-sorted-layers" feature descriptor가 활성화된 경우, recommended WebGL depth texture resolution은 recommended WebGL color texture resolution과 같아야 합니다.
11.5. Animation frames 변경 사항
renderState
state로 layers
state를 check하려면, 사용자 에이전트는 다음 단계를 실행해야 합니다.
11.6. XRSession 변경 사항
이 module은 XRSession interface에 다음을 확장 및 추가합니다.[SecureContext ,Exposed =Window ]partial interface XRSession {readonly attribute unsigned long maxRenderLayers ; };
maxRenderLayers는 compositor가 처리해야 하는
최대 layer 수, 따라서 모든 XRRenderStateInit의
layers
array의 최대 크기를 나타냅니다. 주어진 시점에 이 수보다 많은 layer를 생성할 수 있어야 합니다.
NOTE: 이 guidance는 Allocation of layers에 설명된 것처럼 사용자 에이전트가 할당할 수 있는 layer 수에
대한 제한을 제공하려는 것이 아닙니다. User Agents는 예를 들어 20개의 layer 생성을 허용하면서도,
updateRenderState()를
통해 한 번에 설정할 수 있는 수는 10개로 제한할 수 있습니다.
또한 서로 다른 layer가 서로 다른 양의 backend power 또는 objects를 요구할 수 있기 때문에,
user agents는 적어도 그만큼 많은 layer가 render될 수 있도록 `maxRenderLayers` 값을 설정하는 데
일정한 재량을 가진다는 점도 주목할 만합니다. 그러나 user agents는 여전히 더 많은 layer가 전달될 때는
reject해야 하며, updateRenderState에 더 적은 layer가 전달될 때는 reject할 수 없습니다.
각 XRSession에는
그 session으로 생성된 각 XRWebGLBinding에
대한 약한 참조를 보관하는 내부 WeakSet bindings가 있습니다.
이 module은 WebXR specification의 "shut down the session"에 단계를 추가합니다. 목록에 다음을 추가하세요:
-
session|의 bindings 안의 각 binding에 대해:
-
binding의 foveatedTextures 안의 각 texture에 대해:
-
texture에서 foveation을 제거합니다.
-
12. 보안 및 개인정보 보호 고려사항
12.1. Composition의 timing
Composition timing은 rendering되는 콘텐츠와 독립적이어야 합니다. 또한 layer 안의 콘텐츠는 다른 layer에서 observable해서는 안 됩니다.
가능하다면 layer의 composition은 timing attack 또는 기타 보안 취약점의 위험을 줄이기 위해 브라우저 밖에서 발생해야 합니다.
12.2. Layer 할당
사용자 에이전트는 GPU hardware의 식별 가능성을 줄이기 위해 최대 pixel size 또는 layer 수와 같은 모든 resource allocation에 제한을 둘 수 있습니다.
변경 사항
2020년 12월 3일 최초 공개 작업 초안 이후 변경 사항
새 기능:
-
XRCompositionLayer에 opacity 지원 추가 (GitHub #284
-
Layer 간 depth testing 지원 추가 (GitHub #271)
-
XRWebGLBinding에 usesDepthValues 지원 추가 (GitHub #269)
-
context에서 depth support가 활성화되지 않은 경우에도 projection layer 생성을 허용 (GitHub #250)
-
생성된 mip level 수를 반환하는 지원 추가 (GitHub #245)
-
mipmapping 지원 추가 (GitHub #243)
-
Texture size attributes (GitHub #241)
변경 사항:
-
layout 알고리즘 및 opaque textures clearing의 작은 issue 수정 (GitHub #257)
-
aspectratio 명확화 (GitHub #256)
-
layer memory allocation에 대한 일부 문구 추가 (GitHub #255)
-
layer 생성에서 synchronous GPU allocation 제거 + getsubimage/getviewsubimage에 validation 추가 (GitHub #254)
-
getSubImage 및 getViewSubImage의 일부 수정 (GitHub #253)
-
side-by-side textures 처리 누락에 대한 수정 (GitHub #251)
-
optional dictionary arguments에 default value {} 추가 (GitHub #248)
-
foveation을 projection layer로 이동 (GitHub #247)
-
textureLayers를 textureArrayLength로 이름 변경 (GitHub #242)
-
opaque textures가 frame 시작 시 항상 초기화된다는 점 명확화 (GitHub #234)