Merge "Fix aprox fs function names bug b206696" into jb-mr1-dev
This commit is contained in:
@@ -383,13 +383,12 @@ static void bench_fp_math() {
|
||||
}
|
||||
|
||||
static void bench_approx_math() {
|
||||
BENCH_FN_FUNC_FN(approx_recip);
|
||||
BENCH_FN_FUNC_FN(approx_sqrt);
|
||||
BENCH_FN_FUNC_FN(approx_rsqrt);
|
||||
BENCH_FN_FUNC_FN(approx_length);
|
||||
BENCH_FN_FUNC_FN_FN(approx_distance);
|
||||
BENCH_FN_FUNC_FN(approx_normalize);
|
||||
BENCH_FN_FUNC_FN(approx_atan);
|
||||
BENCH_FN_FUNC_FN(half_recip);
|
||||
BENCH_FN_FUNC_FN(half_sqrt);
|
||||
BENCH_FN_FUNC_FN(half_rsqrt);
|
||||
BENCH_FN_FUNC_FN(fast_length);
|
||||
BENCH_FN_FUNC_FN_FN(fast_distance);
|
||||
BENCH_FN_FUNC_FN(fast_normalize);
|
||||
}
|
||||
|
||||
void bench() {
|
||||
|
||||
@@ -48,8 +48,8 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
|
||||
const float2 coord = mad(inCoord, inv_dimensions, neg_center);
|
||||
const float2 scaledCoord = axis_scale * coord;
|
||||
const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
|
||||
const float inv_dist = approx_rsqrt(dist2);
|
||||
const float radian = M_PI_2 - approx_atan((alpha * approx_sqrt(radius2 - dist2)) * inv_dist);
|
||||
const float inv_dist = half_rsqrt(dist2);
|
||||
const float radian = M_PI_2 - atan((alpha * half_sqrt(radius2 - dist2)) * inv_dist);
|
||||
const float scalar = radian * factor * inv_dist;
|
||||
const float2 new_coord = mad(coord, scalar, center);
|
||||
const float4 fout = rsSample(in_alloc, sampler, new_coord);
|
||||
|
||||
@@ -49,9 +49,9 @@ void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
|
||||
const float4 fin = convert_float4(*in);
|
||||
const float2 inCoord = {(float)x, (float)y};
|
||||
const float2 coord = mad(inCoord, inv_dimensions, neg_center);
|
||||
const float sloped_dist_ratio = approx_length(axis_scale * coord) * sloped_inv_max_dist;
|
||||
// TODO: add approx_exp once implemented
|
||||
const float lumen = opp_shade + shade * approx_recip(1.f + sloped_neg_range * exp(sloped_dist_ratio));
|
||||
const float sloped_dist_ratio = fast_length(axis_scale * coord) * sloped_inv_max_dist;
|
||||
// TODO: add half_exp once implemented
|
||||
const float lumen = opp_shade + shade * half_recip(1.f + sloped_neg_range * exp(sloped_dist_ratio));
|
||||
float4 fout;
|
||||
fout.rgb = fin.rgb * lumen;
|
||||
fout.w = fin.w;
|
||||
|
||||
Reference in New Issue
Block a user