Add @(require_results) to core:math/linalg's glsl and hlsl packages

This commit is contained in:
gingerBill
2023-05-22 12:11:18 +01:00
parent c4cb2f2378
commit 396debb9cb
4 changed files with 1307 additions and 1265 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,30 +2,31 @@ package math_linalg_glsl
import "core:math"
cos_f32 :: proc "c" (x: f32) -> f32 { return math.cos(x) }
sin_f32 :: proc "c" (x: f32) -> f32 { return math.sin(x) }
tan_f32 :: proc "c" (x: f32) -> f32 { return math.tan(x) }
acos_f32 :: proc "c" (x: f32) -> f32 { return math.acos(x) }
asin_f32 :: proc "c" (x: f32) -> f32 { return math.asin(x) }
atan_f32 :: proc "c" (x: f32) -> f32 { return math.atan(x) }
atan2_f32 :: proc "c" (y, x: f32) -> f32 { return math.atan2(y, x) }
cosh_f32 :: proc "c" (x: f32) -> f32 { return math.cosh(x) }
sinh_f32 :: proc "c" (x: f32) -> f32 { return math.sinh(x) }
tanh_f32 :: proc "c" (x: f32) -> f32 { return math.tanh(x) }
acosh_f32 :: proc "c" (x: f32) -> f32 { return math.acosh(x) }
asinh_f32 :: proc "c" (x: f32) -> f32 { return math.asinh(x) }
atanh_f32 :: proc "c" (x: f32) -> f32 { return math.atanh(x) }
sqrt_f32 :: proc "c" (x: f32) -> f32 { return math.sqrt(x) }
inversesqrt_f32 :: proc "c" (x: f32) -> f32 { return 1.0/math.sqrt(x) }
pow_f32 :: proc "c" (x, y: f32) -> f32 { return math.pow(x, y) }
exp_f32 :: proc "c" (x: f32) -> f32 { return math.exp(x) }
log_f32 :: proc "c" (x: f32) -> f32 { return math.ln(x) }
exp2_f32 :: proc "c" (x: f32) -> f32 { return math.pow(f32(2), x) }
sign_f32 :: proc "c" (x: f32) -> f32 { return math.sign(x) }
floor_f32 :: proc "c" (x: f32) -> f32 { return math.floor(x) }
round_f32 :: proc "c" (x: f32) -> f32 { return math.round(x) }
ceil_f32 :: proc "c" (x: f32) -> f32 { return math.ceil(x) }
mod_f32 :: proc "c" (x, y: f32) -> f32 { return math.mod(x, y) }
@(require_results) cos_f32 :: proc "c" (x: f32) -> f32 { return math.cos(x) }
@(require_results) sin_f32 :: proc "c" (x: f32) -> f32 { return math.sin(x) }
@(require_results) tan_f32 :: proc "c" (x: f32) -> f32 { return math.tan(x) }
@(require_results) acos_f32 :: proc "c" (x: f32) -> f32 { return math.acos(x) }
@(require_results) asin_f32 :: proc "c" (x: f32) -> f32 { return math.asin(x) }
@(require_results) atan_f32 :: proc "c" (x: f32) -> f32 { return math.atan(x) }
@(require_results) atan2_f32 :: proc "c" (y, x: f32) -> f32 { return math.atan2(y, x) }
@(require_results) cosh_f32 :: proc "c" (x: f32) -> f32 { return math.cosh(x) }
@(require_results) sinh_f32 :: proc "c" (x: f32) -> f32 { return math.sinh(x) }
@(require_results) tanh_f32 :: proc "c" (x: f32) -> f32 { return math.tanh(x) }
@(require_results) acosh_f32 :: proc "c" (x: f32) -> f32 { return math.acosh(x) }
@(require_results) asinh_f32 :: proc "c" (x: f32) -> f32 { return math.asinh(x) }
@(require_results) atanh_f32 :: proc "c" (x: f32) -> f32 { return math.atanh(x) }
@(require_results) sqrt_f32 :: proc "c" (x: f32) -> f32 { return math.sqrt(x) }
@(require_results) inversesqrt_f32 :: proc "c" (x: f32) -> f32 { return 1.0/math.sqrt(x) }
@(require_results) pow_f32 :: proc "c" (x, y: f32) -> f32 { return math.pow(x, y) }
@(require_results) exp_f32 :: proc "c" (x: f32) -> f32 { return math.exp(x) }
@(require_results) log_f32 :: proc "c" (x: f32) -> f32 { return math.ln(x) }
@(require_results) exp2_f32 :: proc "c" (x: f32) -> f32 { return math.pow(f32(2), x) }
@(require_results) sign_f32 :: proc "c" (x: f32) -> f32 { return math.sign(x) }
@(require_results) floor_f32 :: proc "c" (x: f32) -> f32 { return math.floor(x) }
@(require_results) round_f32 :: proc "c" (x: f32) -> f32 { return math.round(x) }
@(require_results) ceil_f32 :: proc "c" (x: f32) -> f32 { return math.ceil(x) }
@(require_results) mod_f32 :: proc "c" (x, y: f32) -> f32 { return math.mod(x, y) }
@(require_results)
fract_f32 :: proc "c" (x: f32) -> f32 {
if x >= 0 {
return x - math.trunc(x)
@@ -33,30 +34,31 @@ fract_f32 :: proc "c" (x: f32) -> f32 {
return math.trunc(-x) + x
}
cos_f64 :: proc "c" (x: f64) -> f64 { return math.cos(x) }
sin_f64 :: proc "c" (x: f64) -> f64 { return math.sin(x) }
tan_f64 :: proc "c" (x: f64) -> f64 { return math.tan(x) }
acos_f64 :: proc "c" (x: f64) -> f64 { return math.acos(x) }
asin_f64 :: proc "c" (x: f64) -> f64 { return math.asin(x) }
atan_f64 :: proc "c" (x: f64) -> f64 { return math.atan(x) }
atan2_f64 :: proc "c" (y, x: f64) -> f64 { return math.atan2(y, x) }
cosh_f64 :: proc "c" (x: f64) -> f64 { return math.cosh(x) }
sinh_f64 :: proc "c" (x: f64) -> f64 { return math.sinh(x) }
tanh_f64 :: proc "c" (x: f64) -> f64 { return math.tanh(x) }
acosh_f64 :: proc "c" (x: f64) -> f64 { return math.acosh(x) }
asinh_f64 :: proc "c" (x: f64) -> f64 { return math.asinh(x) }
atanh_f64 :: proc "c" (x: f64) -> f64 { return math.atanh(x) }
sqrt_f64 :: proc "c" (x: f64) -> f64 { return math.sqrt(x) }
inversesqrt_f64 :: proc "c" (x: f64) -> f64 { return 1.0/math.sqrt(x) }
pow_f64 :: proc "c" (x, y: f64) -> f64 { return math.pow(x, y) }
exp_f64 :: proc "c" (x: f64) -> f64 { return math.exp(x) }
log_f64 :: proc "c" (x: f64) -> f64 { return math.ln(x) }
exp2_f64 :: proc "c" (x: f64) -> f64 { return math.pow(f64(2), x) }
sign_f64 :: proc "c" (x: f64) -> f64 { return math.sign(x) }
floor_f64 :: proc "c" (x: f64) -> f64 { return math.floor(x) }
round_f64 :: proc "c" (x: f64) -> f64 { return math.round(x) }
ceil_f64 :: proc "c" (x: f64) -> f64 { return math.ceil(x) }
mod_f64 :: proc "c" (x, y: f64) -> f64 { return math.mod(x, y) }
@(require_results) cos_f64 :: proc "c" (x: f64) -> f64 { return math.cos(x) }
@(require_results) sin_f64 :: proc "c" (x: f64) -> f64 { return math.sin(x) }
@(require_results) tan_f64 :: proc "c" (x: f64) -> f64 { return math.tan(x) }
@(require_results) acos_f64 :: proc "c" (x: f64) -> f64 { return math.acos(x) }
@(require_results) asin_f64 :: proc "c" (x: f64) -> f64 { return math.asin(x) }
@(require_results) atan_f64 :: proc "c" (x: f64) -> f64 { return math.atan(x) }
@(require_results) atan2_f64 :: proc "c" (y, x: f64) -> f64 { return math.atan2(y, x) }
@(require_results) cosh_f64 :: proc "c" (x: f64) -> f64 { return math.cosh(x) }
@(require_results) sinh_f64 :: proc "c" (x: f64) -> f64 { return math.sinh(x) }
@(require_results) tanh_f64 :: proc "c" (x: f64) -> f64 { return math.tanh(x) }
@(require_results) acosh_f64 :: proc "c" (x: f64) -> f64 { return math.acosh(x) }
@(require_results) asinh_f64 :: proc "c" (x: f64) -> f64 { return math.asinh(x) }
@(require_results) atanh_f64 :: proc "c" (x: f64) -> f64 { return math.atanh(x) }
@(require_results) sqrt_f64 :: proc "c" (x: f64) -> f64 { return math.sqrt(x) }
@(require_results) inversesqrt_f64 :: proc "c" (x: f64) -> f64 { return 1.0/math.sqrt(x) }
@(require_results) pow_f64 :: proc "c" (x, y: f64) -> f64 { return math.pow(x, y) }
@(require_results) exp_f64 :: proc "c" (x: f64) -> f64 { return math.exp(x) }
@(require_results) log_f64 :: proc "c" (x: f64) -> f64 { return math.ln(x) }
@(require_results) exp2_f64 :: proc "c" (x: f64) -> f64 { return math.pow(f64(2), x) }
@(require_results) sign_f64 :: proc "c" (x: f64) -> f64 { return math.sign(x) }
@(require_results) floor_f64 :: proc "c" (x: f64) -> f64 { return math.floor(x) }
@(require_results) round_f64 :: proc "c" (x: f64) -> f64 { return math.round(x) }
@(require_results) ceil_f64 :: proc "c" (x: f64) -> f64 { return math.ceil(x) }
@(require_results) mod_f64 :: proc "c" (x, y: f64) -> f64 { return math.mod(x, y) }
@(require_results)
fract_f64 :: proc "c" (x: f64) -> f64 {
if x >= 0 {
return x - math.trunc(x)

File diff suppressed because it is too large Load Diff

View File

@@ -2,34 +2,35 @@ package math_linalg_hlsl
import "core:math"
cos_float :: proc "c" (x: float) -> float { return math.cos(x) }
sin_float :: proc "c" (x: float) -> float { return math.sin(x) }
tan_float :: proc "c" (x: float) -> float { return math.tan(x) }
acos_float :: proc "c" (x: float) -> float { return math.acos(x) }
asin_float :: proc "c" (x: float) -> float { return math.asin(x) }
atan_float :: proc "c" (x: float) -> float { return math.atan(x) }
atan2_float :: proc "c" (y, x: float) -> float { return math.atan2(y, x) }
cosh_float :: proc "c" (x: float) -> float { return math.cosh(x) }
sinh_float :: proc "c" (x: float) -> float { return math.sinh(x) }
tanh_float :: proc "c" (x: float) -> float { return math.tanh(x) }
acosh_float :: proc "c" (x: float) -> float { return math.acosh(x) }
asinh_float :: proc "c" (x: float) -> float { return math.asinh(x) }
atanh_float :: proc "c" (x: float) -> float { return math.atanh(x) }
sqrt_float :: proc "c" (x: float) -> float { return math.sqrt(x) }
rsqrt_float :: proc "c" (x: float) -> float { return 1.0/math.sqrt(x) }
rcp_float :: proc "c" (x: float) -> float { return 1.0/x }
pow_float :: proc "c" (x, y: float) -> float { return math.pow(x, y) }
exp_float :: proc "c" (x: float) -> float { return math.exp(x) }
log_float :: proc "c" (x: float) -> float { return math.ln(x) }
log2_float :: proc "c" (x: float) -> float { return math.log(x, 2) }
log10_float :: proc "c" (x: float) -> float { return math.log(x, 10) }
exp2_float :: proc "c" (x: float) -> float { return math.pow(float(2), x) }
sign_float :: proc "c" (x: float) -> float { return math.sign(x) }
floor_float :: proc "c" (x: float) -> float { return math.floor(x) }
round_float :: proc "c" (x: float) -> float { return math.round(x) }
ceil_float :: proc "c" (x: float) -> float { return math.ceil(x) }
isnan_float :: proc "c" (x: float) -> bool { return math.classify(x) == .NaN}
fmod_float :: proc "c" (x, y: float) -> float { return math.mod(x, y) }
@(require_results) cos_float :: proc "c" (x: float) -> float { return math.cos(x) }
@(require_results) sin_float :: proc "c" (x: float) -> float { return math.sin(x) }
@(require_results) tan_float :: proc "c" (x: float) -> float { return math.tan(x) }
@(require_results) acos_float :: proc "c" (x: float) -> float { return math.acos(x) }
@(require_results) asin_float :: proc "c" (x: float) -> float { return math.asin(x) }
@(require_results) atan_float :: proc "c" (x: float) -> float { return math.atan(x) }
@(require_results) atan2_float :: proc "c" (y, x: float) -> float { return math.atan2(y, x) }
@(require_results) cosh_float :: proc "c" (x: float) -> float { return math.cosh(x) }
@(require_results) sinh_float :: proc "c" (x: float) -> float { return math.sinh(x) }
@(require_results) tanh_float :: proc "c" (x: float) -> float { return math.tanh(x) }
@(require_results) acosh_float :: proc "c" (x: float) -> float { return math.acosh(x) }
@(require_results) asinh_float :: proc "c" (x: float) -> float { return math.asinh(x) }
@(require_results) atanh_float :: proc "c" (x: float) -> float { return math.atanh(x) }
@(require_results) sqrt_float :: proc "c" (x: float) -> float { return math.sqrt(x) }
@(require_results) rsqrt_float :: proc "c" (x: float) -> float { return 1.0/math.sqrt(x) }
@(require_results) rcp_float :: proc "c" (x: float) -> float { return 1.0/x }
@(require_results) pow_float :: proc "c" (x, y: float) -> float { return math.pow(x, y) }
@(require_results) exp_float :: proc "c" (x: float) -> float { return math.exp(x) }
@(require_results) log_float :: proc "c" (x: float) -> float { return math.ln(x) }
@(require_results) log2_float :: proc "c" (x: float) -> float { return math.log(x, 2) }
@(require_results) log10_float :: proc "c" (x: float) -> float { return math.log(x, 10) }
@(require_results) exp2_float :: proc "c" (x: float) -> float { return math.pow(float(2), x) }
@(require_results) sign_float :: proc "c" (x: float) -> float { return math.sign(x) }
@(require_results) floor_float :: proc "c" (x: float) -> float { return math.floor(x) }
@(require_results) round_float :: proc "c" (x: float) -> float { return math.round(x) }
@(require_results) ceil_float :: proc "c" (x: float) -> float { return math.ceil(x) }
@(require_results) isnan_float :: proc "c" (x: float) -> bool { return math.classify(x) == .NaN}
@(require_results) fmod_float :: proc "c" (x, y: float) -> float { return math.mod(x, y) }
@(require_results)
frac_float :: proc "c" (x: float) -> float {
if x >= 0 {
return x - math.trunc(x)
@@ -38,34 +39,35 @@ frac_float :: proc "c" (x: float) -> float {
}
cos_double :: proc "c" (x: double) -> double { return math.cos(x) }
sin_double :: proc "c" (x: double) -> double { return math.sin(x) }
tan_double :: proc "c" (x: double) -> double { return math.tan(x) }
acos_double :: proc "c" (x: double) -> double { return math.acos(x) }
asin_double :: proc "c" (x: double) -> double { return math.asin(x) }
atan_double :: proc "c" (x: double) -> double { return math.atan(x) }
atan2_double :: proc "c" (y, x: double) -> double { return math.atan2(y, x) }
cosh_double :: proc "c" (x: double) -> double { return math.cosh(x) }
sinh_double :: proc "c" (x: double) -> double { return math.sinh(x) }
tanh_double :: proc "c" (x: double) -> double { return math.tanh(x) }
acosh_double :: proc "c" (x: double) -> double { return math.acosh(x) }
asinh_double :: proc "c" (x: double) -> double { return math.asinh(x) }
atanh_double :: proc "c" (x: double) -> double { return math.atanh(x) }
sqrt_double :: proc "c" (x: double) -> double { return math.sqrt(x) }
rsqrt_double :: proc "c" (x: double) -> double { return 1.0/math.sqrt(x) }
rcp_double :: proc "c" (x: double) -> double { return 1.0/x }
pow_double :: proc "c" (x, y: double) -> double { return math.pow(x, y) }
exp_double :: proc "c" (x: double) -> double { return math.exp(x) }
log_double :: proc "c" (x: double) -> double { return math.ln(x) }
log2_double :: proc "c" (x: double) -> double { return math.log(x, 2) }
log10_double :: proc "c" (x: double) -> double { return math.log(x, 10) }
exp2_double :: proc "c" (x: double) -> double { return math.pow(double(2), x) }
sign_double :: proc "c" (x: double) -> double { return math.sign(x) }
floor_double :: proc "c" (x: double) -> double { return math.floor(x) }
round_double :: proc "c" (x: double) -> double { return math.round(x) }
ceil_double :: proc "c" (x: double) -> double { return math.ceil(x) }
isnan_double :: proc "c" (x: double) -> bool { return math.classify(x) == .NaN}
fmod_double :: proc "c" (x, y: double) -> double { return math.mod(x, y) }
@(require_results) cos_double :: proc "c" (x: double) -> double { return math.cos(x) }
@(require_results) sin_double :: proc "c" (x: double) -> double { return math.sin(x) }
@(require_results) tan_double :: proc "c" (x: double) -> double { return math.tan(x) }
@(require_results) acos_double :: proc "c" (x: double) -> double { return math.acos(x) }
@(require_results) asin_double :: proc "c" (x: double) -> double { return math.asin(x) }
@(require_results) atan_double :: proc "c" (x: double) -> double { return math.atan(x) }
@(require_results) atan2_double :: proc "c" (y, x: double) -> double { return math.atan2(y, x) }
@(require_results) cosh_double :: proc "c" (x: double) -> double { return math.cosh(x) }
@(require_results) sinh_double :: proc "c" (x: double) -> double { return math.sinh(x) }
@(require_results) tanh_double :: proc "c" (x: double) -> double { return math.tanh(x) }
@(require_results) acosh_double :: proc "c" (x: double) -> double { return math.acosh(x) }
@(require_results) asinh_double :: proc "c" (x: double) -> double { return math.asinh(x) }
@(require_results) atanh_double :: proc "c" (x: double) -> double { return math.atanh(x) }
@(require_results) sqrt_double :: proc "c" (x: double) -> double { return math.sqrt(x) }
@(require_results) rsqrt_double :: proc "c" (x: double) -> double { return 1.0/math.sqrt(x) }
@(require_results) rcp_double :: proc "c" (x: double) -> double { return 1.0/x }
@(require_results) pow_double :: proc "c" (x, y: double) -> double { return math.pow(x, y) }
@(require_results) exp_double :: proc "c" (x: double) -> double { return math.exp(x) }
@(require_results) log_double :: proc "c" (x: double) -> double { return math.ln(x) }
@(require_results) log2_double :: proc "c" (x: double) -> double { return math.log(x, 2) }
@(require_results) log10_double :: proc "c" (x: double) -> double { return math.log(x, 10) }
@(require_results) exp2_double :: proc "c" (x: double) -> double { return math.pow(double(2), x) }
@(require_results) sign_double :: proc "c" (x: double) -> double { return math.sign(x) }
@(require_results) floor_double :: proc "c" (x: double) -> double { return math.floor(x) }
@(require_results) round_double :: proc "c" (x: double) -> double { return math.round(x) }
@(require_results) ceil_double :: proc "c" (x: double) -> double { return math.ceil(x) }
@(require_results) isnan_double :: proc "c" (x: double) -> bool { return math.classify(x) == .NaN}
@(require_results) fmod_double :: proc "c" (x, y: double) -> double { return math.mod(x, y) }
@(require_results)
frac_double :: proc "c" (x: double) -> double {
if x >= 0 {
return x - math.trunc(x)