Merge remote-tracking branch 'origin/master' into blender2.8

This commit is contained in:
Dalai Felinto
2018-01-19 17:01:48 -02:00
5 changed files with 21 additions and 8 deletions

View File

@@ -86,35 +86,35 @@ public:
(void)kernel_avx;
(void)kernel_avx2;
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
if(DebugFlags().cpu.avx2 && system_cpu_support_avx2()) {
if(DebugFlags().cpu.has_avx2() && system_cpu_support_avx2()) {
architecture_name = "AVX2";
kernel = kernel_avx2;
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
if(DebugFlags().cpu.avx && system_cpu_support_avx()) {
if(DebugFlags().cpu.has_avx() && system_cpu_support_avx()) {
architecture_name = "AVX";
kernel = kernel_avx;
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
if(DebugFlags().cpu.sse41 && system_cpu_support_sse41()) {
if(DebugFlags().cpu.has_sse41() && system_cpu_support_sse41()) {
architecture_name = "SSE4.1";
kernel = kernel_sse41;
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
if(DebugFlags().cpu.sse3 && system_cpu_support_sse3()) {
if(DebugFlags().cpu.has_sse3() && system_cpu_support_sse3()) {
architecture_name = "SSE3";
kernel = kernel_sse3;
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
if(DebugFlags().cpu.sse2 && system_cpu_support_sse2()) {
if(DebugFlags().cpu.has_sse2() && system_cpu_support_sse2()) {
architecture_name = "SSE2";
kernel = kernel_sse2;
}

View File

@@ -45,6 +45,15 @@ public:
bool sse3;
bool sse2;
/* Check functions to see whether instructions up to the given one
* are allowed for use.
*/
bool has_avx2() { return has_avx() && avx2; }
bool has_avx() { return has_sse41() && avx; }
bool has_sse41() { return has_sse3() && sse41; }
bool has_sse3() { return has_sse2() && sse3; }
bool has_sse2() { return sse2; }
/* Whether QBVH usage is allowed or not. */
bool qbvh;

View File

@@ -1696,7 +1696,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
int digits = 1;
if (scene->r.efra > 9)
digits = 1 + (int) log10(scene->r.efra);
digits = integer_digits_i(scene->r.efra);
BLI_snprintf(fmtstr, sizeof(fmtstr), do_prefix ? "Frame %%0%di" : "%%0%di", digits);
BLI_snprintf(stamp_data->frame, sizeof(stamp_data->frame), fmtstr, scene->r.cfra);

View File

@@ -397,6 +397,10 @@ MINLINE int integer_digits_d(const double d)
return (d == 0.0) ? 0 : (int)floor(log10(fabs(d))) + 1;
}
MINLINE int integer_digits_i(const int i)
{
return (int)log10(i) + 1;
}
/* Internal helpers for SSE2 implementation.
*

View File

@@ -596,7 +596,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
drawcache->total_lines = 0;
if (st->showlinenrs)
st->linenrs_tot = (int)floor(log10((float)nlines)) + 1;
st->linenrs_tot = integer_digits_i(nlines);
while (line) {
if (drawcache->valid_head) { /* we're inside valid head lines */
@@ -630,7 +630,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
nlines = BLI_listbase_count(&txt->lines);
if (st->showlinenrs)
st->linenrs_tot = (int)floor(log10((float)nlines)) + 1;
st->linenrs_tot = integer_digits_i(nlines);
}
drawcache->total_lines = nlines;