* Adding clipper to generate the terrain's negative powder-contour offset. * Fixing RDB issues (fracture, active trigger, performances) * Fixing blood emission * Fixing the freezing formula on liquids * Fixing Steve spawning due to a missed test. * Reaction table properly build
17 lines
661 B
GLSL
17 lines
661 B
GLSL
int alloc_part() {
|
|
const uint s0 = atomicAdd(fcnt[1], 1u);
|
|
for (uint k = 0u; k < 64u; ++k) {
|
|
const uint s = (s0 + k) % uint(FPART_MAX);
|
|
const uint word = 4u + uint(FP_MAX) * 24u + s * 12u + 4u;
|
|
const uint previous = atomicAdd(fxwords[word], 0u);
|
|
if (uintBitsToFloat(previous) <= 0.0 && atomicCompSwap(fxwords[word], previous, floatBitsToUint(3.0e38)) == previous) return int(s);
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
void release_part(uint slot) {
|
|
// Publish a free slot only after its previous owner has finished all writes.
|
|
memoryBarrierBuffer();
|
|
atomicExchange(fxwords[4u + uint(FP_MAX) * 24u + slot * 12u + 4u], 0u);
|
|
}
|