Re: How can I store global variables one by one in an array?
Larry Gritz
The programming model (how you think of the shader operating) is that you are shading one point at a time. That's all that is exposed. Whether the system is actually shading one or multiple points at the same time (and if they are synchronized in any meaningful way) depends on the implementation and which "back end" you may be using. The ordinary CPU based back end that almost all OSL renderers use REALLY IS just shading one point at a time (though multiple threads may be shading different points simultaneously, which are not necessarily the same material or shader). The "CPU batched shading" that Intel has ~95% complete shades up to 8 or 16 points of the same material simultaneously (depending on the kind of CPU you have). The Cuda-based GPU back end may shade LOTS of points, but even in that case, it's not ALL the points that will be shaded, and groups of points in parallel don't necessarily know about and are not necessarily synchronized with other groups of points in the same overall kernel launch. So in short, OSL just doesn't present this kind of interface, and most renderers currently in operation do not work underneath in a way that would be well matched to accessing all points simultaneously at the same point of execution of the shader.
|
|