Say we've implemented occlusion on a GPU. Would each SIMD unit be assigned the task of performing the depth test for a given sample? Or is there also specialized hardware for this on the GPU?
Also, it seems like you would need locks on the depth buffer to prevent two units from attempting to update a given index in the depth buffer (and the color buffer for that matter) at the same time. In fact, I think we would want updating the color buffer and depth buffer to be one atomic operation.
We wouldn't want a lock on the entire buffer, so a lock on each sample point in the depth buffer seems to make sense (although it takes up O(n) space where n is the number of sample points).
One possible optimization would be to not require obtaining the lock when reading the depth buffer so that we avoid expensive unnecessary grabs for the lock. But that means if a sample point passes the depth test, when we go to obtain the lock, we need to check that we pass the test again because the depth buffer's value could have changed in between the time when we first passed the depth test and when we got the lock.
Say we've implemented occlusion on a GPU. Would each SIMD unit be assigned the task of performing the depth test for a given sample? Or is there also specialized hardware for this on the GPU?
Also, it seems like you would need locks on the depth buffer to prevent two units from attempting to update a given index in the depth buffer (and the color buffer for that matter) at the same time. In fact, I think we would want updating the color buffer and depth buffer to be one atomic operation.
We wouldn't want a lock on the entire buffer, so a lock on each sample point in the depth buffer seems to make sense (although it takes up O(n) space where n is the number of sample points).
One possible optimization would be to not require obtaining the lock when reading the depth buffer so that we avoid expensive unnecessary grabs for the lock. But that means if a sample point passes the depth test, when we go to obtain the lock, we need to check that we pass the test again because the depth buffer's value could have changed in between the time when we first passed the depth test and when we got the lock.