Skip to content

Commit

Permalink
Fix iOS NativeCamera texture pixel format (#1125)
Browse files Browse the repository at this point in the history
* Turn ARC on in Apple NativeCamera plugin CMake

* Fix ARC compile errors

* Reject unsupported pixel formats

* Set video output pixel format to same as video input pixel format

* Create camera pipeline state

* Get YpCbCr to RGBA conversion shader working

* Rename XRVertex to Vertex

* Change static to constexpr for vertices

* Make CompileShader function static

* Remove typedef from Vertex struct

* Get drawing to output texture working in UpdateCameraTexture

* Redo changes undone in merge

* Release texture ref explicitly if creation from image fails

* Get YpCbCr to RGBA conversion shader working on macOS

* Rename local variable `bestPixelFormat` to `devicePixelFormat`

The "best" prefix in the `bestPixelFormat` local variable name only makes sense for the current iOS implementation. It doesn't make sense on macOS since we're not selecting a "best" device. On macOS we're selecting the default device.

This change updates the local variable name so it makes sense for the current implementation on both iOS and macOS.
  • Loading branch information
docEdub authored Sep 6, 2022
1 parent b35f8a3 commit 235552a
Show file tree
Hide file tree
Showing 3 changed files with 298 additions and 27 deletions.
3 changes: 3 additions & 0 deletions Plugins/NativeCamera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ if(ANDROID)
set(EXTENSIONS AndroidExtensions)
elseif(APPLE)
set(EXTENSIONS "-framework CoreMedia -framework AVFoundation")
set_target_properties(NativeCamera PROPERTIES
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
)
endif()

target_link_to_dependencies(NativeCamera
Expand Down
2 changes: 2 additions & 0 deletions Plugins/NativeCamera/Source/Apple/NativeCameraImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ namespace Babylon::Plugins
std::shared_ptr<ImplData> m_implData;

bool m_overrideCameraTexture{};

CameraDimensions m_cameraDimensions{};
};
}
Loading

0 comments on commit 235552a

Please sign in to comment.