Chapter 4, use of buffer(0) for both vertex and fragment shaders

In chapter 4, when implementing the shader functions for the playground at the beginning, the vertex function takes vertices in buffer(0) and the fragment function takes color in buffer(0). So there are 2 things I’m unsure of:

1 - So are the buffers for vertex and fragment shaders completely independent of each other? I.e. buffer(0) for each are different buffers? I would assume so given the example.

2 - What if I want to send a uniform value to both the vertex and fragment shader? Do I have to put it in both a vertex buffer and a fragment buffer? Pardon the imprecise terminology.

I can’t seem to find any of this stated clearly in the Apple docs. I expect it is clarified in later chapters but I’m not there yet.

Thanks,
~chuck

@cocheret you are right. you will almost never have buffer(0) representing the same data in both the vertex and fragment shaders. for that reason the API has separate functions: setVertexBuffer(), setFragmentBuffer(), setVertexBytes() and setFragmentBytes(). same goes for uniforms: you will usually have transformation matrices sent to the vertex shader and lights/colors sent to the fragment shader.