In the extension to Model found in Rendering.swift the book includes a call to encoder.useResource(…), but that doesn’t occur in the final version of the sample code. Which one is correct?
As you work through the chapter, you will use each resource, so that the resource is available to the GPU. For example:
submesh.allTextures.forEach { texture in
if let texture {
encoder.useResource(texture, usage: .read, stages: .fragment)
}
}
However, continuing on, you’ll use a heap instead of individual texture resources. Then you’ll use useHeap to make the heap available to the GPU.
Later on in the chapter, you will use a residency set instead of the heap. You’ll attach the residency set to the command queue, which will automatically attach the set to the command buffer for each frame.
This is why you won’t find useResource in the final sample code.
2 Likes