projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.22k stars 364 forks source link

Constrain/clamp per-pixel mesh size to [8,300] and even values. #737

Closed kblaschke closed 8 months ago

kblaschke commented 8 months ago

The per-mixel mesh size needs to be a mutiple of two to avoid "bars" being rendered in each axis if the resolution is an odd number.

Also now clamping the value range from 8 to 300 (inclusive) on each axis, with 300 being well above anyone would need (Milkdrop's default of 64x48 is totally sufficient even in 4K).

The third commit just fixes a few compiler warnings by making the casts explicit.

labkey-matthewb commented 8 months ago

I recall that the mesh size might get rounded to a multiple of 4 internally to enable SSE optimization.

kblaschke commented 8 months ago

I recall that the mesh size might get rounded to a multiple of 4 internally to enable SSE optimization.

The SSE code has been removed, as the U/V coordinate calculations are now done in the warp mesh vertex shader, which is even better than using SSE (and portable to ARM as well).

But this explains why it wasn't an issue in the 3.x versions.

labkey-matthewb commented 8 months ago

I recall that the mesh size might get rounded to a multiple of 4 internally to enable SSE optimization.

The SSE code has been removed, as the U/V coordinate calculations are now done in the warp mesh vertex shader, which is even better than using SSE (and portable to ARM as well).

But this explains why it wasn't an issue in the 3.x versions.

Very cool!