2026-02-26 14:57:16 +00:00
|
|
|
#pragma once
|
2026-02-26 16:40:01 +00:00
|
|
|
#ifndef _FLOAT4_DISPATCH_H_
|
|
|
|
|
#define _FLOAT4_DISPATCH_H_
|
|
|
|
|
|
|
|
|
|
|
2026-02-26 14:57:16 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
|
|
namespace math_backend::float4::dispatch
|
|
|
|
|
{
|
|
|
|
|
struct Float4Funcs
|
|
|
|
|
{
|
|
|
|
|
void (*add)(const float*, const float*, float*) = nullptr;
|
|
|
|
|
void (*sub)(const float*, const float*, float*) = nullptr;
|
|
|
|
|
void (*mul)(const float*, const float*, float*) = nullptr;
|
|
|
|
|
void (*mul_scalar)(const float*, float, float*) = nullptr;
|
|
|
|
|
void (*div)(const float*, const float*, float*) = nullptr;
|
|
|
|
|
void (*div_scalar)(const float*, float, float*) = nullptr;
|
|
|
|
|
float (*dot)(const float*, const float*) = nullptr;
|
|
|
|
|
float (*length)(const float*) = nullptr;
|
|
|
|
|
float (*lengthSquared)(const float*) = nullptr;
|
|
|
|
|
void (*normalize)(float*) = nullptr;
|
2026-02-26 16:45:13 +00:00
|
|
|
void (*normalize_mag)(float*, float) = nullptr;
|
2026-02-26 14:57:16 +00:00
|
|
|
void (*lerp)(const float*, const float*, float, float*) = nullptr;
|
2026-02-26 16:45:13 +00:00
|
|
|
void (*cross)(const float*, const float*, float*) = nullptr;
|
2026-02-26 14:57:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Global dispatch table
|
|
|
|
|
extern Float4Funcs gFloat4;
|
|
|
|
|
|
|
|
|
|
// Backend installers (defined in ISA libraries)
|
|
|
|
|
void install_scalar();
|
|
|
|
|
void install_sse2();
|
|
|
|
|
void install_sse41();
|
|
|
|
|
void install_avx();
|
|
|
|
|
void install_avx2();
|
|
|
|
|
void install_neon();
|
|
|
|
|
}
|
2026-02-26 16:40:01 +00:00
|
|
|
|
|
|
|
|
#endif // !_FLOAT4_DISPATCH_H_
|