@@ -58,10 +58,48 @@ OpenXRFbCompositionLayerSecureContentExtension::~OpenXRFbCompositionLayerSecureC
5858}
5959
6060void OpenXRFbCompositionLayerSecureContentExtension::_bind_methods () {
61+ ClassDB::bind_method (D_METHOD (" is_enabled" ), &OpenXRFbCompositionLayerSecureContentExtension::is_enabled);
62+
63+ ClassDB::bind_method (D_METHOD (" set_projection_layer_external_output" , " external_output" ), &OpenXRFbCompositionLayerSecureContentExtension::set_projection_layer_external_output);
64+ ClassDB::bind_method (D_METHOD (" get_projection_layer_external_output" ), &OpenXRFbCompositionLayerSecureContentExtension::get_projection_layer_external_output);
65+
66+ ADD_PROPERTY (PropertyInfo (Variant::INT, " projection_layer_external_output" , PROPERTY_HINT_ENUM, " Display,Exclude,Replace" ), " set_projection_layer_external_output" , " get_projection_layer_external_output" );
67+
68+ BIND_ENUM_CONSTANT (EXTERNAL_OUTPUT_DISPLAY);
69+ BIND_ENUM_CONSTANT (EXTERNAL_OUTPUT_EXCLUDE);
70+ BIND_ENUM_CONSTANT (EXTERNAL_OUTPUT_REPLACE);
6171}
6272
6373void OpenXRFbCompositionLayerSecureContentExtension::cleanup () {
6474 fb_composition_layer_secure_content = false ;
75+ projection_layer_external_output = EXTERNAL_OUTPUT_DISPLAY;
76+ }
77+
78+ void OpenXRFbCompositionLayerSecureContentExtension::_on_session_created (uint64_t p_session) {
79+ if (!fb_composition_layer_secure_content) {
80+ return ;
81+ }
82+ get_openxr_api ()->register_projection_layer_extension (this );
83+ }
84+
85+ void OpenXRFbCompositionLayerSecureContentExtension::_on_session_destroyed () {
86+ if (!fb_composition_layer_secure_content) {
87+ return ;
88+ }
89+ get_openxr_api ()->unregister_projection_layer_extension (this );
90+ }
91+
92+ bool OpenXRFbCompositionLayerSecureContentExtension::is_enabled () const {
93+ return fb_composition_layer_secure_content;
94+ }
95+
96+ void OpenXRFbCompositionLayerSecureContentExtension::set_projection_layer_external_output (ExternalOutput p_external_output) {
97+ ERR_FAIL_COND_MSG (!fb_composition_layer_secure_content, " XR_FB_composition_layer_secure_content is not enabled" );
98+ projection_layer_external_output = p_external_output;
99+ }
100+
101+ OpenXRFbCompositionLayerSecureContentExtension::ExternalOutput OpenXRFbCompositionLayerSecureContentExtension::get_projection_layer_external_output () const {
102+ return projection_layer_external_output;
65103}
66104
67105Dictionary OpenXRFbCompositionLayerSecureContentExtension::_get_requested_extensions (uint64_t p_xr_version) {
@@ -73,6 +111,27 @@ Dictionary OpenXRFbCompositionLayerSecureContentExtension::_get_requested_extens
73111 return result;
74112}
75113
114+ uint64_t OpenXRFbCompositionLayerSecureContentExtension::_set_projection_layer_and_get_next_pointer (void *p_next_pointer) {
115+ if (!fb_composition_layer_secure_content) {
116+ return reinterpret_cast <uint64_t >(p_next_pointer);
117+ }
118+
119+ switch (projection_layer_external_output) {
120+ case EXTERNAL_OUTPUT_DISPLAY: {
121+ return reinterpret_cast <uint64_t >(p_next_pointer);
122+ }
123+ case EXTERNAL_OUTPUT_EXCLUDE: {
124+ projection_layer_secure_content.flags = XR_COMPOSITION_LAYER_SECURE_CONTENT_EXCLUDE_LAYER_BIT_FB;
125+ } break ;
126+ case EXTERNAL_OUTPUT_REPLACE: {
127+ projection_layer_secure_content.flags = XR_COMPOSITION_LAYER_SECURE_CONTENT_REPLACE_LAYER_BIT_FB;
128+ } break ;
129+ }
130+
131+ projection_layer_secure_content.next = p_next_pointer;
132+ return reinterpret_cast <uint64_t >(&projection_layer_secure_content);
133+ }
134+
76135uint64_t OpenXRFbCompositionLayerSecureContentExtension::_set_viewport_composition_layer_and_get_next_pointer (const void *p_layer, const Dictionary &p_property_values, void *p_next_pointer) {
77136 if (!fb_composition_layer_secure_content) {
78137 return reinterpret_cast <uint64_t >(p_next_pointer);
0 commit comments