Sending a subset of an array to GPU

Hi there!

I’m trying to send a subset of an array to GPU so:

let totalCount = 100
let subsetCount = 50
var vertices:[float3]=Array(repeating: float3(repeating: 0), count: totalCount)
//update vertices data... Need fixed array size
let verticesBuffer = device.makeBuffer(bytes: &vertices, length: MemoryLayout<float3>.stride * subsetCount, options: [])
renderEncoder.setVertexBuffer(verticesBuffer, offset: 0, index: 0)
//GPU:
vertex flota3 vertex_main ( constant float3* vertices [[ buffer(0) ]],...,uint id [[ vertex_id ]]){...}

But the vertex function iterates over totalCount and not subsetCount, so id takes the values of the range[0…99].

Why???

What is the count in the draw call?

1 Like

You’re right! :grin:
thank you very much…

1 Like