The Compiler was not able to Preload your Buffer

Hi,


When doing a GPU frame capture we have the following warning on lot of setRenderPipelineState:


The Compiler was not able to Preload your Buffer (Issue) The compiler was not able to preload your buffer. Simplify your memory access pattern by using a constant address space, a struct or a descriptor.


It happened on XCode 9.1.


If anyone could share some insight on what's going on. What could be the reason of that warning. In our case, we are interleaving the attributes and push most of the vertex atttributes one after the others to maximize caching. We are using persistent buffer for the generated geometry, the geometry is generated on the fly CPU side on all frames. In that particular case, it's for the user interface but other warning appear for models too that have static geometry.


Following is one of the vertex and fragment pair on which we received that warning.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Vertex shader
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <metal_stdlib>
#include <metal_geometric>
using namespace metal;

struct attributes_t
{
    float4 Position [[attribute(0)]];
    float2 TexCoord0 [[attribute(1)]];
    half4 Color0 [[attribute(2)]];
};

struct uniforms_t
{
    float4x4 WorldViewProjectionMatrix;
};

struct outputs_t
{
    float4 Position [[position]];
    float2 TexCoord0;
    half4 Color0;
};

#include <metal_stdlib>
using namespace metal;

vertex outputs_t VS(attributes_t attributes [[stage_in]], constant uniforms_t& uniforms [[buffer(0)]])
{
    outputs_t out;
    out.Position = uniforms.WorldViewProjectionMatrix * attributes.Position;
    out.TexCoord0 = attributes.TexCoord0;
    out.Color0 = attributes.Color0;
    return out;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Fragment shader
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <metal_stdlib>
#include <metal_geometric>
using namespace metal;

struct uniforms_t
{
    half4 AdditiveColor;
    half4 DiffuseColor;
};

struct inputs_t
{
    float4 Position [[position]];
    float2 TexCoord0;
    half4 Color0;
};

#include <metal_stdlib>
using namespace metal;

fragment half4 FS(
     inputs_t varyings [[stage_in]],
     constant uniforms_t& uniforms [[buffer(0)]],
     texture2d<half> TextureSampler [[texture(0)]],
     sampler TextureSampler_sampler [[sampler(0)]])
{

    half4 color = TextureSampler.sample(TextureSampler_sampler, varyings.TexCoord0);
    color = (color + uniforms.DiffuseColor) * varyings.Color0;
    return color + uniforms.AdditiveColor;
}