diff --git a/include/common.h b/include/common.h index be4ad4a..729e2fd 100644 --- a/include/common.h +++ b/include/common.h @@ -224,54 +224,6 @@ void GetValidUp( MVector &up ); -template struct ThreadData { - unsigned int start; - unsigned int end; - unsigned int numTasks; - double *alignedStorage; - T *pData; - - ThreadData() - { - alignedStorage = (double *)_mm_malloc(4 * sizeof(double), 256); - } - ~ThreadData() { _mm_free(alignedStorage); } -}; - -/** - Creates the data stuctures that will be sent to each thread. Divides the - vertices into discrete chunks to be evaluated in the threads. - @param[in] taskCount The number of individual tasks we want to divide the - calculation into. - @param[in] elementCount The number of vertices or elements to be divided up. - @param[in] taskData The TaskData or BindData object. - @param[out] threadData The array of ThreadData objects. It is assumed the - array is of size taskCount. -*/ -template -void CreateThreadData( - int taskCount, unsigned int elementCount, T *taskData, - ThreadData *threadData -) -{ - unsigned int taskLength = (elementCount + taskCount - 1) / taskCount; - unsigned int start = 0; - unsigned int end = taskLength; - int lastTask = taskCount - 1; - for (int i = 0; i < taskCount; i++) { - if (i == lastTask) { - end = elementCount; - } - threadData[i].start = start; - threadData[i].end = end; - threadData[i].numTasks = taskCount; - threadData[i].pData = taskData; - - start += taskLength; - end += taskLength; - } -} - #ifdef __AVX__ /** Calculates 4 dot products at once. diff --git a/meson.build b/meson.build index 485b329..e1c9f45 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('blurdeform', 'cpp') +project('blurdeform', 'cpp', default_options: ['cpp_std=c++20']) maya_dep = dependency('maya') maya_name_suffix = maya_dep.get_variable('name_suffix') @@ -27,6 +27,15 @@ else source_files = source_files + version_h endif +cc = meson.get_compiler('cpp') +if cc.get_argument_syntax() == 'gcc' + avx = ['-mavx', '-mfma'] +else + avx = ['/arch:AVX'] +endif +add_project_arguments(avx, language: 'cpp') + + outlib = shared_library( meson.project_name(), source_files, diff --git a/quick_compile.bat b/quick_compile.bat index 2c6af36..95550f7 100644 --- a/quick_compile.bat +++ b/quick_compile.bat @@ -6,7 +6,7 @@ REM use VS for the debugger, otherwise use NINJA REM Until I figure out how to debug using nvim SET BACKEND=vs REM "debug" "debugoptimized" "release" -SET BUILDTYPE=debug +SET BUILDTYPE=release SET BUILDDIR=mayabuild_%BUILDTYPE%_%MAYA_VERSION%_%BACKEND% if not exist %BUILDDIR%\ (