Commit: c1412111540f4dd1859b19f21428446e9f78cfb2
Parent: c7cd4986b63922418730083ba1ed8c05bb497ebe
Author: Randy Palamar
Date: Fri, 10 Oct 2025 20:31:52 -0600
shaders/das: move iq rotation into if gaurd
shader compiler isn't smart enough to omit this when the if is
false and ends up evaluating sin and cos anyways. this gives a
minor performance boost when we are not beamforming beyond the end
of the data and a more substantial one if we are.
Linear is a special case which seems to run better if it always
has to evaluate the sin/cos
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/shaders/das.glsl b/shaders/das.glsl
@@ -100,7 +100,7 @@ SAMPLE_TYPE sample_rf(const int channel, const int transmit, const float index)
switch (InterpolationMode) {
case InterpolationMode_Nearest:{
if (index >= 0 && int(round(index)) < SampleCount)
- result = rf_data[base_index + int(round(index))];
+ result = rotate_iq(rf_data[base_index + int(round(index))], index / SamplingFrequency);
}break;
case InterpolationMode_Linear:{
if (index >= 0 && round(index) < SampleCount) {
@@ -108,13 +108,13 @@ SAMPLE_TYPE sample_rf(const int channel, const int transmit, const float index)
int n = base_index + int(tk);
result = (1 - t) * rf_data[n] + t * rf_data[n + 1];
}
+ result = rotate_iq(result, index / SamplingFrequency);
}break;
case InterpolationMode_Cubic:{
if (index >= 0 && (int(index) + 2) < SampleCount)
- result = cubic(base_index, index);
+ result = rotate_iq(cubic(base_index, index), index / SamplingFrequency);
}break;
}
- result = rotate_iq(result, index / SamplingFrequency);
return result;
}