Skip to content

Commit

Permalink
[Metal] enable loading of the Metal render system for ogre2
Browse files Browse the repository at this point in the history
- Add parameter "metal" and a member variable useMetalRenderSystem to Ogre2RenderEngine
- Modify LoadPlugins to load the Metal render system if enabled
- Modify CreateRenderSystem to select the Metal render system
- Modify RegisterHlms to load the Metal resources
- Add missing Metal shaders for the Terra (from Ogre2)
- Add Metal shader for skybox
- Update skybox material to support universal shaders
- Create subdirectories for GLSL and Metal in media/materials/programs and update Ogre2RenderEngine with new resource locations
- Add Metal and unified shaders to each material
- Add placeholders for a number of shaders to prevent compile errors when running examples
- Minor formatting changes to plain_color, point and skybox Metal shaders.
- Port depth_camera_vs and selection_buffer_fs to Metal
- The mouse_picker, ogre2_demo and transform_control demos now work correctly.
- Shader formatting - replace tabs with whitespace
- Port gaussian_noise vertex and pixel shaders from the GLSL counterparts
- The ogre2_demo and render_pass examples now work correctly.
- Port thermal_camera pixel shader
  - Correct error in thermal material script
  - Port thermal_camera pixel shaders from the GLSL counterparts
  - The thermal_camera examples now runs but further requires testing
- Add stubs for the remaining vertex and pixel shaders to port from GLSL
- Port heat_signature pixel shader
- Initial ports of depth_camera and gpu_rays shaders
  - On Metal the compositor in Ogre2GpuRay has a pixel format exception
  - Texture sampling for depth_camera_final_fs.metal is not using the equivalent of OpenGL's texelFetch
- Fix fragment program specifier in gaussian noise material
  - Unified shader had incorrect specifier
- Fix depth camera vertex shader not found in selection buffer material
  - This is the same issue as fixed in gazebosim#456
- Switch to user RGBA format for internal textures in gpu ray sensor
- Complete port of gpu rays 1st pass shader
  - Complete port of the GPU Rays shader
  - This depends upon the pixel format fix in gazebosim#468
- Add a method to render targets and cameras to retrieve the Metal 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
  - cherry-pick 8fc230c
- Ensure line length limits are adhered to.
- Fix inconsistent parameter name in RenderTextureMetalId
  - Fix an inconsistent parameter name causing a CI failure.
- Fix unused parameter warning in RenderTextureMetalId
  - Fix an unused parameter warning causing a CI failure.

Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Mar 28, 2022
1 parent 8bb21b4 commit 675e7bd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ogre2/include/ignition/rendering/ogre2/Ogre2RenderEngine.hh
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ namespace ignition
/// \brief True to use the current opengl context
private: bool useCurrentGLContext = false;

/// \brief True to use the Metal render system
private: bool useMetalRenderSystem = false;

/// \brief Pointer to private data
private: std::unique_ptr<Ogre2RenderEnginePrivate> dataPtr;

Expand Down
2 changes: 1 addition & 1 deletion ogre2/src/Ogre2RenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void Ogre2RenderEngine::CreateLogger()

// create actual log
this->ogreLogManager = new Ogre::LogManager();
this->ogreLogManager->createLog(logPath, true, false, false);
this->ogreLogManager->createLog(logPath, true, true, false);
}

//////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

// For details and documentation see: depth_camera_fs.glsl

#include <metal_stdlib>
Expand Down
1 change: 0 additions & 1 deletion ogre2/src/media/materials/programs/Metal/point_fs.metal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

#include <metal_stdlib>
using namespace metal;

Expand Down
1 change: 0 additions & 1 deletion ogre2/src/media/materials/programs/Metal/point_vs.metal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

#include <metal_stdlib>
using namespace metal;

Expand Down

0 comments on commit 675e7bd

Please sign in to comment.