-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a method to render targets and cameras to retrieve a Metal texture #478
Add a method to render targets and cameras to retrieve a Metal texture #478
Conversation
…tal texture id - These functions provide the Metal equivalent of GLId() and RenderTextureGLId() for OpenGL. - The argument is the address of a pointer to void* as the object required for Metal is an objective-c type id<MTLTexture> which we do not want exposed in the interface - There is a runtime dependency on an upstream change to ogre-next: OGRECave/ogre-next@3b11873 Signed-off-by: Rhys Mainwaring <[email protected]>
- Fix an inconsistent parameter name causing a CI failure. Signed-off-by: Rhys Mainwaring <[email protected]>
- Fix an unused parameter warning causing a CI failure. Signed-off-by: Rhys Mainwaring <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #478 +/- ##
==========================================
- Coverage 53.49% 53.43% -0.06%
==========================================
Files 192 192
Lines 19566 19587 +21
==========================================
+ Hits 10466 10467 +1
- Misses 9100 9120 +20
Continue to review full report at Codecov.
|
Changes look good to me. We'll need to update our ogre 2.2 formula then. Let's get this in I'll think of a workaround to get the metal texture id for Fortress. |
@darksylinc are there any changes you're planning to make in the ogre-next v2-2 branch in the near future? If not, I'll just bump our bottle to be at the latest commit (currently OGRECave/ogre-next@312bf40) from the v2-2 branch |
Nothing major. 2.2 is in bugfixes stage. I am evaluating to see what/if we can backport some of the new VCT stuff to 2.2 but I cannot say for certain right now; and it's not worth waiting for that. |
alright sounds good! |
🎉 New feature
Replaces #477 which targeted the wrong branch.
Relates to: #461 and discussions in #422. It accompanies PR #463 but does not depend upon it.
Summary
This PR provides access to the underlying Metal texture object. The functions
MetalId()
andRenderTextureMetalId()
provide the Metal equivalent of
GLId()
andRenderTextureGLId()
for OpenGL.The functions expect a parameter
void* _texturePtr
which is the address of a pointer tovoid*
as the object required for Metal is an Objective-C typeid<MTLTexture>
which we do not want exposed in the interface (the type is the id for an objectthat implements the
MTLTexture
protocol).Note: the functions do not add a dependency on Objective-C to the ignition rendering libraries, but they are intended to be used in Objective-C code as follows:
The translation unit containing the code should be compiled with ARC enabled and will need to link against the
AppKit
andMetal
frameworks. When usingcmake
this is accomplished byCMakeLists.txt
entries such as:There is a runtime dependency on an upstream change to ogre-next: OGRECave/ogre-next@3b11873. Note that this PR does not require the upstream change to build as the Ogre interface used,
getCustomAttribute
, is available on the base classOgre::TextureGpu
and is used by the OpenGL functions.Test it
These changes have no impact on existing functionality using the OpenGL render system.
To test these functions requires a version of ogre-next v2-2 that includes the change OGRECave/ogre-next@3b11873.
There is work in progress to enable the use of Metal for the example
simple_demo_qml
and forign-gui
andign-gazebo
. They depend upon this PR and provide a means to test the changes:https://github.com/srmainwaring/ign-rendering/tree/feature/ign-rendering6-metal-simple_demo_qml
https://github.com/srmainwaring/ign-gui/tree/feature/ign-gui7-metal
https://github.com/srmainwaring/ign-gazebo/tree/feature/ign-gazebo7-metal
For more detail see comment: #463 (comment)
Checklist
codecheck
passed (See contributing)The SEGFAULTS occur on the tear down of tests using
ogre
(when deleting Ogre::Root) and the failed tests are because macOS does not have OpenGL support forogre2
.Note to maintainers: Remember to use Squash-Merge