Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_system.cpp')
-rw-r--r--intern/cycles/util/util_system.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index 7c0445577e2..7206455debd 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License
+ * limitations under the License.
*/
#include "util_system.h"
@@ -135,24 +135,42 @@ struct CPUCapabilities {
bool bmi2;
};
+static void system_cpu_capabilities_override(CPUCapabilities *caps)
+{
+ /* Only capabilities which affects on cycles kernel. */
+ if(getenv("CYCLES_CPU_NO_AVX2")) {
+ caps->avx2 = false;
+ }
+ if(getenv("CYCLES_CPU_NO_AVX")) {
+ caps->avx = false;
+ }
+ if(getenv("CYCLES_CPU_NO_SSE41")) {
+ caps->sse41 = false;
+ }
+ if(getenv("CYCLES_CPU_NO_SSE3")) {
+ caps->sse3 = false;
+ }
+ if(getenv("CYCLES_CPU_NO_SSE2")) {
+ caps->sse2 = false;
+ }
+ if(getenv("CYCLES_CPU_NO_SSE")) {
+ caps->sse = false;
+ }
+}
+
static CPUCapabilities& system_cpu_capabilities()
{
static CPUCapabilities caps;
static bool caps_init = false;
if(!caps_init) {
- int result[4], num; //, num_ex;
+ int result[4], num;
memset(&caps, 0, sizeof(caps));
__cpuid(result, 0);
num = result[0];
-#if 0
- __cpuid(result, 0x80000000);
- num_ex = result[0];
-#endif
-
if(num >= 1) {
__cpuid(result, 0x00000001);
caps.mmx = (result[3] & ((int)1 << 23)) != 0;
@@ -190,15 +208,7 @@ static CPUCapabilities& system_cpu_capabilities()
caps.avx2 = (result[1] & ((int)1 << 5)) != 0;
}
-#if 0
- if(num_ex >= 0x80000001) {
- __cpuid(result, 0x80000001);
- caps.x64 = (result[3] & ((int)1 << 29)) != 0;
- caps.sse4a = (result[2] & ((int)1 << 6)) != 0;
- caps.fma4 = (result[2] & ((int)1 << 16)) != 0;
- caps.xop = (result[2] & ((int)1 << 11)) != 0;
- }
-#endif
+ system_cpu_capabilities_override(&caps);
caps_init = true;
}