Merge branch 'blender-v2.93-release'
This commit is contained in:
commit
738a890025
|
@ -145,7 +145,8 @@ int system_cpu_num_active_group_processors()
|
|||
return numaAPI_GetNumCurrentNodesProcessors();
|
||||
}
|
||||
|
||||
#if !defined(__APPLE__) && (!defined(_WIN32) || defined(FREE_WINDOWS))
|
||||
/* Equivalent of Windows __cpuid for x86 processors on other platforms. */
|
||||
#if (!defined(_WIN32) || defined(FREE_WINDOWS)) && (defined(__x86_64__) || defined(__i386__))
|
||||
static void __cpuid(int data[4], int selector)
|
||||
{
|
||||
# if defined(__x86_64__)
|
||||
|
@ -167,12 +168,33 @@ static void __cpuid(int data[4], int selector)
|
|||
string system_cpu_brand_string()
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
/* Get from system on macOS. */
|
||||
char modelname[512] = "";
|
||||
size_t bufferlen = 512;
|
||||
if (sysctlbyname("machdep.cpu.brand_string", &modelname, &bufferlen, NULL, 0) == 0) {
|
||||
return modelname;
|
||||
}
|
||||
#elif !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__)
|
||||
#elif defined(WIN32) || defined(__x86_64__) || defined(__i386__)
|
||||
/* Get from intrinsics on Windows and x86. */
|
||||
char buf[49] = {0};
|
||||
int result[4] = {0};
|
||||
|
||||
__cpuid(result, 0x80000000);
|
||||
|
||||
if (result[0] != 0 && result[0] >= (int)0x80000004) {
|
||||
__cpuid((int *)(buf + 0), 0x80000002);
|
||||
__cpuid((int *)(buf + 16), 0x80000003);
|
||||
__cpuid((int *)(buf + 32), 0x80000004);
|
||||
|
||||
string brand = buf;
|
||||
|
||||
/* Make it a bit more presentable. */
|
||||
brand = string_remove_trademark(brand);
|
||||
|
||||
return brand;
|
||||
}
|
||||
#else
|
||||
/* Get from /proc/cpuinfo on Unix systems. */
|
||||
FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
|
||||
if (cpuinfo != nullptr) {
|
||||
char cpuinfo_buf[513] = "";
|
||||
|
@ -192,24 +214,6 @@ string system_cpu_brand_string()
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
char buf[49] = {0};
|
||||
int result[4] = {0};
|
||||
|
||||
__cpuid(result, 0x80000000);
|
||||
|
||||
if (result[0] != 0 && result[0] >= (int)0x80000004) {
|
||||
__cpuid((int *)(buf + 0), 0x80000002);
|
||||
__cpuid((int *)(buf + 16), 0x80000003);
|
||||
__cpuid((int *)(buf + 32), 0x80000004);
|
||||
|
||||
string brand = buf;
|
||||
|
||||
/* make it a bit more presentable */
|
||||
brand = string_remove_trademark(brand);
|
||||
|
||||
return brand;
|
||||
}
|
||||
#endif
|
||||
return "Unknown CPU";
|
||||
}
|
||||
|
@ -219,7 +223,7 @@ int system_cpu_bits()
|
|||
return (sizeof(void *) * 8);
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(_M_IX86)
|
||||
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
|
||||
|
||||
struct CPUCapabilities {
|
||||
bool x64;
|
||||
|
|
|
@ -867,19 +867,19 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
|||
BMIter iter;
|
||||
const float axis[3] = {0, 0, 1};
|
||||
float vec[3], mat[4][4], cmat[3][3];
|
||||
float phi, phid;
|
||||
int a;
|
||||
|
||||
BMO_slot_mat4_get(op->slots_in, "matrix", mat);
|
||||
|
||||
phid = 2.0f * (float)M_PI / tot;
|
||||
const float phid = (float)M_PI / tot;
|
||||
/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
|
||||
|
||||
/* one segment first */
|
||||
phi = 0;
|
||||
phid /= 2;
|
||||
for (a = 0; a <= tot; a++) {
|
||||
/* Going in this direction, then edge extruding, makes normals face outward */
|
||||
/* Calculate with doubles for higher precision, see: T87779. */
|
||||
const float phi = M_PI * ((double)a / (double)tot);
|
||||
|
||||
vec[0] = 0.0;
|
||||
vec[1] = dia * sinf(phi);
|
||||
vec[2] = dia * cosf(phi);
|
||||
|
@ -891,7 +891,6 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
|||
BMO_edge_flag_enable(bm, e, EDGE_ORIG);
|
||||
}
|
||||
|
||||
phi += phid;
|
||||
preveve = eve;
|
||||
}
|
||||
|
||||
|
@ -1272,7 +1271,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
|
|||
const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
|
||||
|
||||
BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL;
|
||||
float vec[3], mat[4][4], phi, phid;
|
||||
float vec[3], mat[4][4];
|
||||
int a;
|
||||
|
||||
if (!segs) {
|
||||
|
@ -1281,9 +1280,6 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
BMO_slot_mat4_get(op->slots_in, "matrix", mat);
|
||||
|
||||
phid = 2.0f * (float)M_PI / segs;
|
||||
phi = 0;
|
||||
|
||||
if (cap_ends) {
|
||||
zero_v3(vec);
|
||||
mul_m4_v3(mat, vec);
|
||||
|
@ -1292,8 +1288,11 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
|
|||
BMO_vert_flag_enable(bm, cent1, VERT_MARK);
|
||||
}
|
||||
|
||||
for (a = 0; a < segs; a++, phi += phid) {
|
||||
for (a = 0; a < segs; a++) {
|
||||
/* Going this way ends up with normal(s) upward */
|
||||
|
||||
/* Calculate with doubles for higher precision, see: T87779. */
|
||||
const float phi = (2.0 * M_PI) * ((double)a / (double)segs);
|
||||
vec[0] = -radius * sinf(phi);
|
||||
vec[1] = radius * cosf(phi);
|
||||
vec[2] = 0.0f;
|
||||
|
@ -1392,7 +1391,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
|
|||
{
|
||||
BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2;
|
||||
BMFace *f;
|
||||
float vec[3], mat[4][4], phi, phid;
|
||||
float vec[3], mat[4][4];
|
||||
const float dia1 = BMO_slot_float_get(op->slots_in, "diameter1");
|
||||
const float dia2 = BMO_slot_float_get(op->slots_in, "diameter2");
|
||||
const float depth_half = 0.5f * BMO_slot_float_get(op->slots_in, "depth");
|
||||
|
@ -1409,9 +1408,6 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
BMO_slot_mat4_get(op->slots_in, "matrix", mat);
|
||||
|
||||
phid = 2.0f * (float)M_PI / segs;
|
||||
phi = 0;
|
||||
|
||||
if (cap_ends) {
|
||||
vec[0] = vec[1] = 0.0f;
|
||||
vec[2] = -depth_half;
|
||||
|
@ -1432,7 +1428,10 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
|
|||
const int side_faces_len = segs - 1;
|
||||
BMFace **side_faces = MEM_mallocN(sizeof(*side_faces) * side_faces_len, __func__);
|
||||
|
||||
for (int i = 0; i < segs; i++, phi += phid) {
|
||||
for (int i = 0; i < segs; i++) {
|
||||
/* Calculate with doubles for higher precision, see: T87779. */
|
||||
const float phi = (2.0 * M_PI) * ((double)i / (double)segs);
|
||||
|
||||
vec[0] = dia1 * sinf(phi);
|
||||
vec[1] = dia1 * cosf(phi);
|
||||
vec[2] = -depth_half;
|
||||
|
|
Loading…
Reference in New Issue