0

I am trying to launch my application on iPad pro and getting an error when trying to create a new library with dispatched data as shown in the below image Error on creating new library with existing built .metallib

The library format is not supported or was built with old version of the tools

Here is the .metal code with which I am getting this error:

#include <metal_stdlib>
#include <simd/simd.h>

using namespace metal;


struct VtxIn
{
packed_float2 pos;
packed_float2 uv0;
};

struct VtxOut
{
float4 pos [[position]];
float2 uv0;
};


vertex VtxOut MainVS    (   device VtxIn*   iVtxA   [[ buffer(0) ]],
                        uint            iIdx    [[ vertex_id ]])
{
VtxOut oVtx;

oVtx.pos = float4( iVtxA[iIdx].pos, 0.0, 1.0 );
oVtx.uv0 = iVtxA[iIdx].uv0;

return oVtx;
}

fragment float4 MainPS  (   VtxOut           iVtx       [[ stage_in]],
                        texture2d<float> iTex2D     [[ texture(0) ]],
                        sampler          iSampler2D [[ sampler(0) ]] )
{
    return iTex2D.sample( iSampler2D, iVtx.uv0 );
};
Mattie
  • 2,868
  • 2
  • 25
  • 40
  • How did you build the .metallib? What commands? On what versions of macOS and Xcode? The data object you're using is the verbatim contents of the .metallib file? – Ken Thomases Jul 10 '18 at 16:49
  • @KenThomases to build metal library I am using bin files directly from the Xcode iOS sdk. MacOS 10.13 and Xcode is 9.4. And I am not sure about the verbatim contents – Naveen Kumar Jul 11 '18 at 09:43
  • Show the specific compilation and link commands you're using to create the .metallib file. – Ken Thomases Jul 11 '18 at 11:29
  • @KenThomases Here are the three commands that I am using: 1. xcrun --sdk iphoneos metal -arch air64 -emit-llvm -c -ffast-math -std=ios-metal1.0 "some defines" -o /path/to/out/dir /path/to/source 2. xcrun --sdk iphoneos metal-ar rc /path/to/out/ar/dir /path/to/out/air/dir 3. xcrun --sdk iphoneos metallib -o /path/to/out/lib /path/to/out/air/dir – Naveen Kumar Jul 27 '18 at 10:45
  • Can you try skipping the metal-ar step and directly giving the .air file as an input to metallib? – Danger Ranger Jul 29 '18 at 00:25
  • @danger ranger that I have tried already and it's working fine... Thanks for the suggestion – Naveen Kumar Jul 31 '18 at 09:09

0 Answers0