Skip to content

Commit

Permalink
fix(client_core): 🐛 FIx stream on Focus 3 with FFE off (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed Sep 10, 2024
1 parent 015ed7d commit 1dd48ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions alvr/client_core/src/graphics/staging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ impl StagingRenderer {
#[allow(unused_variables)]
pub unsafe fn render(&self, hardware_buffer: *mut c_void) {
let gl = &self.context.gl_context;
self.context.make_current();

self.context.render_ahardwarebuffer_using_texture(
hardware_buffer,
Expand All @@ -112,6 +113,7 @@ impl StagingRenderer {

ck!(gl.active_texture(gl::TEXTURE0));
ck!(gl.bind_texture(GL_TEXTURE_EXTERNAL_OES, Some(self.surface_texture)));
ck!(gl.bind_sampler(0, None));
ck!(gl.draw_arrays(gl::TRIANGLE_STRIP, 0, 4));
},
);
Expand All @@ -121,6 +123,8 @@ impl StagingRenderer {
impl Drop for StagingRenderer {
fn drop(&mut self) {
let gl = &self.context.gl_context;
self.context.make_current();

unsafe {
ck!(gl.delete_program(self.program));
ck!(gl.delete_texture(self.surface_texture));
Expand Down
4 changes: 4 additions & 0 deletions alvr/client_core/src/graphics/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ impl StreamRenderer {

self.context.queue.submit(iter::once(encoder.finish()));
} else {
self.context.make_current();

#[cfg(all(target_os = "android", feature = "use-cpp"))]
super::opengl::renderStreamNative(hardware_buffer, swapchain_indices.as_ptr());
}
Expand All @@ -269,6 +271,8 @@ impl StreamRenderer {

impl Drop for StreamRenderer {
fn drop(&mut self) {
self.context.make_current();

#[cfg(all(target_os = "android", feature = "use-cpp"))]
if self.render_objects.is_none() {
unsafe { super::opengl::destroyStream() };
Expand Down

0 comments on commit 1dd48ca

Please sign in to comment.