Accumulating min/max bounds with transform feedback?
I'm doing GPU skinning with transform feedback. Specifically, I'm deforming a mesh given as object space coordinates, resulting in a mesh also specified in object space coordinates.
I'd like to accumulate the min/max bounds for each vertex somehow. That is, given:
vec3 minimum = vec3(FLOAT_MAX, FLOAT_MAX, FLOAT_MAX);
vec3 maximum = vec3(FLOAT_MIN, FLOAT_MIN, FLOAT_MIN);
Then, for each vertex v:
minimum = vec3(
min (v.x, minimum.x),
min (v.y, minimum.y),
min (v.z, minimum.z)
maximum = vec3(
max (v.x, maximum.x),
max (v.y, maximum.y),
max (v.z, maximum.z)
I could obviously map the resulting buffer and do the accumulation myself on the CPU side, but it seems like there should be a way to do this. I'd like to keep things roughly 3.0 compatible, I'm not sure if that restricts things too much.