OClCollMeshEngn,PcloudStimProd: Produce into intensity stimbuff

PcloudStimulusBuffer::produceFrameReq():
Now correctly produces into the stim frames for the
PcloudIntensityStimulusBuffer object that's attached to the
PcloudStimulusProducer. If there's no attached I stimbuff, then
the OpenCL kernel will simply not write out the intensity data.

This is the first moment when we actually use the SP-MC ringbuffer
properly and actually cycle through the frames, producing into
them one by one.
This commit is contained in:
2025-11-23 05:54:51 -04:00
parent a025d13fce
commit 79df8b3f74
4 changed files with 175 additions and 36 deletions
+43 -11
View File
@@ -24,6 +24,7 @@ inline int readInt32LE(__global uchar* ptr)
__kernel void collate(
__global uchar* assembly,
__global float* collation,
__global float* intensityBuffer,
uint slotStride,
uint nPointsPerSlot,
uint nDgramsPerFrame)
@@ -44,9 +45,12 @@ __kernel void collate(
__global uchar* pointsArray = slotStart + 18;
// Base offset in collation buffer for this slot (in floats)
// Each PointXYZI is 4 floats (x, y, z, intensity)
#define FLOATS_PER_POINT 4
// Each PointXYZ is 3 floats (x, y, z)
#define FLOATS_PER_POINT 3
uint collationBaseOffset = slotIndex * nPointsPerSlot * FLOATS_PER_POINT;
// Base offset in intensity buffer for this slot (in floats)
// Each intensity is 1 float
uint intensityBaseOffset = slotIndex * nPointsPerSlot;
DBG_PRINTF("Running kernel: about to process points in slot.\n");
// Process based on data type using nested ifs (outer) with loops (inner)
@@ -79,12 +83,16 @@ __kernel void collate(
slotIndex, i, intensity);
}
// Write to collation buffer
// Write XYZ to collation buffer
uint offset = collationBaseOffset + (i * FLOATS_PER_POINT);
collation[offset + 0] = x;
collation[offset + 1] = y;
collation[offset + 2] = z;
collation[offset + 3] = intensity;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + i] = intensity;
}
// Don't write intensity to collation buffer
}
}
else if (dataType == 2)
@@ -117,12 +125,16 @@ __kernel void collate(
slotIndex, i, intensity);
}
// Write to collation buffer
// Write XYZ to collation buffer
uint offset = collationBaseOffset + (i * FLOATS_PER_POINT);
collation[offset + 0] = x;
collation[offset + 1] = y;
collation[offset + 2] = z;
collation[offset + 3] = intensity;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + i] = intensity;
}
// Don't write intensity to collation buffer
}
}
else if (dataType == 4)
@@ -161,7 +173,11 @@ __kernel void collate(
collation[offset1 + 0] = x1;
collation[offset1 + 1] = y1;
collation[offset1 + 2] = z1;
collation[offset1 + 3] = intensity1;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + pointIndex] = intensity1;
}
// Don't write intensity to collation buffer
++pointIndex;
// Process second point
@@ -188,7 +204,11 @@ __kernel void collate(
collation[offset2 + 0] = x2;
collation[offset2 + 1] = y2;
collation[offset2 + 2] = z2;
collation[offset2 + 3] = intensity2;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + pointIndex] = intensity2;
}
// Don't write intensity to collation buffer
++pointIndex;
}
}
@@ -228,7 +248,11 @@ __kernel void collate(
collation[offset1 + 0] = x1;
collation[offset1 + 1] = y1;
collation[offset1 + 2] = z1;
collation[offset1 + 3] = intensity1;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + pointIndex] = intensity1;
}
// Don't write intensity to collation buffer
++pointIndex;
// Process second point
@@ -255,7 +279,11 @@ __kernel void collate(
collation[offset2 + 0] = x2;
collation[offset2 + 1] = y2;
collation[offset2 + 2] = z2;
collation[offset2 + 3] = intensity2;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + pointIndex] = intensity2;
}
// Don't write intensity to collation buffer
++pointIndex;
// Process third point
@@ -282,7 +310,11 @@ __kernel void collate(
collation[offset3 + 0] = x3;
collation[offset3 + 1] = y3;
collation[offset3 + 2] = z3;
collation[offset3 + 3] = intensity3;
// Write intensity conditionally - divert to intensity buffer if attached, else discard
if (intensityBuffer != NULL) {
intensityBuffer[intensityBaseOffset + pointIndex] = intensity3;
}
// Don't write intensity to collation buffer
++pointIndex;
}
}