Array of structures in metal shaders on macOS (Intel-GPU?)

I am writing a multi-platform application for macOS and iOS for rendering vector graphics using Metal. In my shader, the vertex identifier is used as an offset into an array of structures (const in the program area, located in a constant address space):

//Simplified!
constant const WrapperStruct directionVectors[] =
{
    //Vertex data (const):
    { float2(-1, -1) },
    { float2(1, -1) },
    { float2(-1, 1) },
    { float2(1, 1) }
};

//...

vertex Vertex vertexShader(const InstanceAttributes attr [[ stage_in ]], const ushort vid [[ vertex_id ]])
{
    Vertex vert;

    vert.position = float4(attr.position + (attr.size * directionVectors[vid].value), 0, 1);
    vert.color = attr.color;

    return vert;
}

//...

This works well:

  • iOS devices
  • MacBook with dedicated GPUs.

But on a particular MacBook Pro (13-inch, 2017, High Sierra, Intel integrated graphics processor) there is a big problem: graphics are not drawn, I get only pure color in the background. No errors are logged, I also do not experience glitches.

"" - float2, . , , ( Intel?).

macOS: .

, instancing. Intel-GPU .

- ? Metal Intel? - / undefined ?

!

gfxCardStatus . , , , Intel:

  • MacBook Pro (Retina, 15 ', 2015):

    • (AMD Radeon R9 M370X):
    • (Intel Iris Pro 1536 ):
  • MacBook Pro (15 , 2017):

    • (Radeon Pro 560 4 ):
    • (Intel HD Graphics 630 1536 ):
  • MacBook Pro (13 , 2017)

    • (Intel Iris Plus Graphics 640 1536 ):
+4

Source: https://habr.com/ru/post/1693915/


All Articles