title: Is the GLM math library compatible with Apple's metal shading language?
body: <p>I'm about to port an iOS app that utilizes OpenGL written in C++ to Apple's Metal. The goal is to completely get rid of OpenGL and replace it with Metal.</p>
  
  <p>The OpenGL code is layered and I'm attempting to just replace the renderer, i.e. the class that actually calls OpenGL functions. However, the entire code base utilizes the GLM math library to represent vectors and matrices.</p>
  
  <p>For example there is a camera class that provides the view and projection matrix. Both of them are of type <code>glm::mat4</code> and are simply passed to the GLSL vertex shader where they are compatible with the <code>mat4</code> data type given by GLSL. I would like to utilize that camera class as it is to send those matrices to the Metal vertex shader. Now, I'm not sure whether <code>glm::mat4</code> is compatible with Metal's <code>float4x4</code>.</p>
  
  <p>I don't have a working example where I can test this because I literally just started with Metal and can't find anything useful online.</p>
  
  <p>So my questions are as follows:</p>
  
  <ol>
  <li>Are GLM types such as <code>glm::mat4</code> and <code>glm::vec4</code> compatible with Metal's <code>float4x4</code> / <code>float4</code>?</li>
  <li>If the answer to question 1. is yes, am I having any disadvantages if I directly use GLM types in Metal shaders?</li>
  </ol>
  
  <p>The background regarding question 2. is that I came across Apple's SIMD library that provides another set of data types which I would not be able to use in such a case, right?</p>
  
  <p>The app is iOS only, I don't care about running Metal on macOS at all.</p>
  
  <p>Code snippets (preferably Objective-C (yes, no joke))  would be very welcome.</p>