tangled
alpha
login
or
join now
matrixfurry.com
/
monado
0
fork
atom
The open source OpenXR runtime
0
fork
atom
overview
issues
pulls
pipelines
c/client: Implement XR_FB_passthrough APIs in client side
dengkail
2 years ago
6c033272
c57976c2
+179
4 changed files
expand all
collapse all
unified
split
src
xrt
compositor
client
comp_d3d11_client.cpp
comp_d3d12_client.cpp
comp_gl_client.c
comp_vk_client.c
+45
src/xrt/compositor/client/comp_d3d11_client.cpp
···
461
461
return XRT_ERROR_ALLOCATION;
462
462
}
463
463
464
464
+
static xrt_result_t
465
465
+
client_d3d11_compositor_passthrough_create(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
466
466
+
{
467
467
+
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
468
468
+
469
469
+
// Pipe down call into native compositor.
470
470
+
return xrt_comp_create_passthrough(&c->xcn->base, info);
471
471
+
}
472
472
+
473
473
+
static xrt_result_t
474
474
+
client_d3d11_compositor_passthrough_layer_create(struct xrt_compositor *xc,
475
475
+
const struct xrt_passthrough_layer_create_info *info)
476
476
+
{
477
477
+
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
478
478
+
479
479
+
// Pipe down call into native compositor.
480
480
+
return xrt_comp_create_passthrough_layer(&c->xcn->base, info);
481
481
+
}
482
482
+
483
483
+
static xrt_result_t
484
484
+
client_d3d11_compositor_passthrough_destroy(struct xrt_compositor *xc)
485
485
+
{
486
486
+
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
487
487
+
488
488
+
// Pipe down call into native compositor.
489
489
+
return xrt_comp_destroy_passthrough(&c->xcn->base);
490
490
+
}
491
491
+
464
492
/*
465
493
*
466
494
* Compositor functions.
···
646
674
}
647
675
648
676
static xrt_result_t
677
677
+
client_d3d11_compositor_layer_passthrough(struct xrt_compositor *xc,
678
678
+
struct xrt_device *xdev,
679
679
+
const struct xrt_layer_data *data)
680
680
+
{
681
681
+
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
682
682
+
683
683
+
assert(data->type == XRT_LAYER_PASSTHROUGH);
684
684
+
685
685
+
// No flip required: D3D11 swapchain image convention matches Vulkan.
686
686
+
return xrt_comp_layer_passthrough(&c->xcn->base, xdev, data);
687
687
+
}
688
688
+
689
689
+
static xrt_result_t
649
690
client_d3d11_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
650
691
{
651
692
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
···
829
870
}
830
871
c->base.base.get_swapchain_create_properties = client_d3d11_compositor_get_swapchain_create_properties;
831
872
c->base.base.create_swapchain = client_d3d11_create_swapchain;
873
873
+
c->base.base.create_passthrough = client_d3d11_compositor_passthrough_create;
874
874
+
c->base.base.create_passthrough_layer = client_d3d11_compositor_passthrough_layer_create;
875
875
+
c->base.base.destroy_passthrough = client_d3d11_compositor_passthrough_destroy;
832
876
c->base.base.begin_session = client_d3d11_compositor_begin_session;
833
877
c->base.base.end_session = client_d3d11_compositor_end_session;
834
878
c->base.base.wait_frame = client_d3d11_compositor_wait_frame;
···
842
886
c->base.base.layer_cylinder = client_d3d11_compositor_layer_cylinder;
843
887
c->base.base.layer_equirect1 = client_d3d11_compositor_layer_equirect1;
844
888
c->base.base.layer_equirect2 = client_d3d11_compositor_layer_equirect2;
889
889
+
c->base.base.layer_passthrough = client_d3d11_compositor_layer_passthrough;
845
890
c->base.base.layer_commit = client_d3d11_compositor_layer_commit;
846
891
c->base.base.destroy = client_d3d11_compositor_destroy;
847
892
+44
src/xrt/compositor/client/comp_d3d12_client.cpp
···
690
690
return XRT_ERROR_ALLOCATION;
691
691
}
692
692
693
693
+
static xrt_result_t
694
694
+
client_d3d12_compositor_passthrough_create(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
695
695
+
{
696
696
+
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
697
697
+
698
698
+
// Pipe down call into native compositor.
699
699
+
return xrt_comp_create_passthrough(&c->xcn->base, info);
700
700
+
}
701
701
+
702
702
+
static xrt_result_t
703
703
+
client_d3d12_compositor_passthrough_layer_create(struct xrt_compositor *xc,
704
704
+
const struct xrt_passthrough_layer_create_info *info)
705
705
+
{
706
706
+
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
707
707
+
708
708
+
// Pipe down call into native compositor.
709
709
+
return xrt_comp_create_passthrough_layer(&c->xcn->base, info);
710
710
+
}
711
711
+
712
712
+
static xrt_result_t
713
713
+
client_d3d12_compositor_passthrough_destroy(struct xrt_compositor *xc)
714
714
+
{
715
715
+
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
716
716
+
717
717
+
// Pipe down call into native compositor.
718
718
+
return xrt_comp_destroy_passthrough(&c->xcn->base);
719
719
+
}
693
720
694
721
/*
695
722
*
···
900
927
}
901
928
902
929
static xrt_result_t
930
930
+
client_d3d12_compositor_layer_passthrough(struct xrt_compositor *xc,
931
931
+
struct xrt_device *xdev,
932
932
+
const struct xrt_layer_data *data)
933
933
+
{
934
934
+
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
935
935
+
936
936
+
assert(data->type == XRT_LAYER_PASSTHROUGH);
937
937
+
938
938
+
// No flip required: D3D12 swapchain image convention matches Vulkan.
939
939
+
return xrt_comp_layer_passthrough(&c->xcn->base, xdev, data);
940
940
+
}
941
941
+
942
942
+
static xrt_result_t
903
943
client_d3d12_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
904
944
{
905
945
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
···
1088
1128
}
1089
1129
c->base.base.get_swapchain_create_properties = client_d3d12_compositor_get_swapchain_create_properties;
1090
1130
c->base.base.create_swapchain = client_d3d12_create_swapchain;
1131
1131
+
c->base.base.create_passthrough = client_d3d12_compositor_passthrough_create;
1132
1132
+
c->base.base.create_passthrough_layer = client_d3d12_compositor_passthrough_layer_create;
1133
1133
+
c->base.base.destroy_passthrough = client_d3d12_compositor_passthrough_destroy;
1091
1134
c->base.base.begin_session = client_d3d12_compositor_begin_session;
1092
1135
c->base.base.end_session = client_d3d12_compositor_end_session;
1093
1136
c->base.base.wait_frame = client_d3d12_compositor_wait_frame;
···
1101
1144
c->base.base.layer_cylinder = client_d3d12_compositor_layer_cylinder;
1102
1145
c->base.base.layer_equirect1 = client_d3d12_compositor_layer_equirect1;
1103
1146
c->base.base.layer_equirect2 = client_d3d12_compositor_layer_equirect2;
1147
1147
+
c->base.base.layer_passthrough = client_d3d12_compositor_layer_passthrough;
1104
1148
c->base.base.layer_commit = client_d3d12_compositor_layer_commit;
1105
1149
c->base.base.destroy = client_d3d12_compositor_destroy;
1106
1150
+47
src/xrt/compositor/client/comp_gl_client.c
···
381
381
}
382
382
383
383
static xrt_result_t
384
384
+
client_gl_compositor_layer_passthrough(struct xrt_compositor *xc,
385
385
+
struct xrt_device *xdev,
386
386
+
const struct xrt_layer_data *data)
387
387
+
{
388
388
+
struct client_gl_compositor *c = client_gl_compositor(xc);
389
389
+
390
390
+
assert(data->type == XRT_LAYER_PASSTHROUGH);
391
391
+
392
392
+
struct xrt_layer_data d = *data;
393
393
+
d.flip_y = !d.flip_y;
394
394
+
395
395
+
return xrt_comp_layer_passthrough(&c->xcn->base, xdev, &d);
396
396
+
}
397
397
+
398
398
+
static xrt_result_t
384
399
client_gl_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
385
400
{
386
401
COMP_TRACE_MARKER();
···
529
544
return XRT_SUCCESS;
530
545
}
531
546
547
547
+
static xrt_result_t
548
548
+
client_gl_compositor_passthrough_create(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
549
549
+
{
550
550
+
struct client_gl_compositor *c = client_gl_compositor(xc);
551
551
+
552
552
+
// Pipe down call into native compositor.
553
553
+
return xrt_comp_create_passthrough(&c->xcn->base, info);
554
554
+
}
555
555
+
556
556
+
static xrt_result_t
557
557
+
client_gl_compositor_passthrough_layer_create(struct xrt_compositor *xc,
558
558
+
const struct xrt_passthrough_layer_create_info *info)
559
559
+
{
560
560
+
struct client_gl_compositor *c = client_gl_compositor(xc);
561
561
+
562
562
+
// Pipe down call into native compositor.
563
563
+
return xrt_comp_create_passthrough_layer(&c->xcn->base, info);
564
564
+
}
565
565
+
566
566
+
static xrt_result_t
567
567
+
client_gl_compositor_passthrough_destroy(struct xrt_compositor *xc)
568
568
+
{
569
569
+
struct client_gl_compositor *c = client_gl_compositor(xc);
570
570
+
571
571
+
// Pipe down call into native compositor.
572
572
+
return xrt_comp_destroy_passthrough(&c->xcn->base);
573
573
+
}
574
574
+
532
575
static void
533
576
client_gl_compositor_destroy(struct xrt_compositor *xc)
534
577
{
···
561
604
562
605
c->base.base.get_swapchain_create_properties = client_gl_compositor_get_swapchain_create_properties;
563
606
c->base.base.create_swapchain = client_gl_swapchain_create;
607
607
+
c->base.base.create_passthrough = client_gl_compositor_passthrough_create;
608
608
+
c->base.base.create_passthrough_layer = client_gl_compositor_passthrough_layer_create;
609
609
+
c->base.base.destroy_passthrough = client_gl_compositor_passthrough_destroy;
564
610
c->base.base.begin_session = client_gl_compositor_begin_session;
565
611
c->base.base.end_session = client_gl_compositor_end_session;
566
612
c->base.base.wait_frame = client_gl_compositor_wait_frame;
···
574
620
c->base.base.layer_cylinder = client_gl_compositor_layer_cylinder;
575
621
c->base.base.layer_equirect1 = client_gl_compositor_layer_equirect1;
576
622
c->base.base.layer_equirect2 = client_gl_compositor_layer_equirect2;
623
623
+
c->base.base.layer_passthrough = client_gl_compositor_layer_passthrough;
577
624
c->base.base.layer_commit = client_gl_compositor_layer_commit;
578
625
c->base.base.destroy = client_gl_compositor_destroy;
579
626
c->context_begin_locked = context_begin_locked;
+43
src/xrt/compositor/client/comp_vk_client.c
···
353
353
return xrt_swapchain_release_image(to_native_swapchain(xsc), index);
354
354
}
355
355
356
356
+
static xrt_result_t
357
357
+
client_vk_compositor_passthrough_create(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
358
358
+
{
359
359
+
struct client_vk_compositor *c = client_vk_compositor(xc);
360
360
+
361
361
+
// Pipe down call into native compositor.
362
362
+
return xrt_comp_create_passthrough(&c->xcn->base, info);
363
363
+
}
364
364
+
365
365
+
static xrt_result_t
366
366
+
client_vk_compositor_passthrough_layer_create(struct xrt_compositor *xc,
367
367
+
const struct xrt_passthrough_layer_create_info *info)
368
368
+
{
369
369
+
struct client_vk_compositor *c = client_vk_compositor(xc);
370
370
+
371
371
+
// Pipe down call into native compositor.
372
372
+
return xrt_comp_create_passthrough_layer(&c->xcn->base, info);
373
373
+
}
374
374
+
375
375
+
static xrt_result_t
376
376
+
client_vk_compositor_passthrough_destroy(struct xrt_compositor *xc)
377
377
+
{
378
378
+
struct client_vk_compositor *c = client_vk_compositor(xc);
379
379
+
380
380
+
// Pipe down call into native compositor.
381
381
+
return xrt_comp_destroy_passthrough(&c->xcn->base);
382
382
+
}
356
383
357
384
/*
358
385
*
···
579
606
}
580
607
581
608
static xrt_result_t
609
609
+
client_vk_compositor_layer_passthrough(struct xrt_compositor *xc,
610
610
+
struct xrt_device *xdev,
611
611
+
const struct xrt_layer_data *data)
612
612
+
{
613
613
+
struct client_vk_compositor *c = client_vk_compositor(xc);
614
614
+
615
615
+
assert(data->type == XRT_LAYER_PASSTHROUGH);
616
616
+
617
617
+
return xrt_comp_layer_passthrough(&c->xcn->base, xdev, data);
618
618
+
}
619
619
+
620
620
+
static xrt_result_t
582
621
client_vk_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
583
622
{
584
623
COMP_TRACE_MARKER();
···
794
833
795
834
c->base.base.get_swapchain_create_properties = client_vk_compositor_get_swapchain_create_properties;
796
835
c->base.base.create_swapchain = client_vk_swapchain_create;
836
836
+
c->base.base.create_passthrough = client_vk_compositor_passthrough_create;
837
837
+
c->base.base.create_passthrough_layer = client_vk_compositor_passthrough_layer_create;
838
838
+
c->base.base.destroy_passthrough = client_vk_compositor_passthrough_destroy;
797
839
c->base.base.begin_session = client_vk_compositor_begin_session;
798
840
c->base.base.end_session = client_vk_compositor_end_session;
799
841
c->base.base.wait_frame = client_vk_compositor_wait_frame;
···
807
849
c->base.base.layer_cylinder = client_vk_compositor_layer_cylinder;
808
850
c->base.base.layer_equirect1 = client_vk_compositor_layer_equirect1;
809
851
c->base.base.layer_equirect2 = client_vk_compositor_layer_equirect2;
852
852
+
c->base.base.layer_passthrough = client_vk_compositor_layer_passthrough;
810
853
c->base.base.layer_commit = client_vk_compositor_layer_commit;
811
854
c->base.base.destroy = client_vk_compositor_destroy;
812
855