From 3d0cafbd0e9b979584cbbe2717ee516a102217b9 Mon Sep 17 00:00:00 2001
From: Daryl <4643499+derwin12@users.noreply.github.com>
Date: Wed, 29 Jan 2025 19:31:10 -0500
Subject: [PATCH] Windows ISPC (#5166)
* Windows ISPC
* updating the ispc as per dan.
* update the config and add tag line
* Code cleanup ..
* Update the readme
---
README.windows | 13 ++++
xLights/Xlights.vcxproj | 59 +++++++++++++++++++
xLights/Xlights.vcxproj.filters | 10 ++++
xLights/effects/ButterflyEffect.cpp | 2 -
xLights/effects/PinwheelEffect.cpp | 2 -
xLights/effects/PlasmaEffect.cpp | 2 -
xLights/effects/ispc/ISPCComputeUtilities.cpp | 2 -
7 files changed, 82 insertions(+), 8 deletions(-)
diff --git a/README.windows b/README.windows
index a9e6e65e8..05906feae 100644
--- a/README.windows
+++ b/README.windows
@@ -108,3 +108,16 @@ Here are the steps to Code::Blocks for Editing .wxs files in Windows.
by double-clicking on the .cbp file in the xLights directory.
Then Open a Dialog, Panel, or Frame in the Left Panel to edit it.
+
+Instructions for Setting up ISPC for Windows
+============================================
+
+ISPC is a compiler for a variant of the C programming language, with extensions for "single program, multiple data" (SPMD) programming.
+It is used in xLights for the generation of AVX1, AVX2, SEE2 and SSE4 optimized code.
+
+ a) Download ISPC from
+ https://github.com/ispc/ispc/releases/download/v1.25.3/ispc-v1.25.3-windows.zip
+
+ b) Extract the zip file to a folder of your choice.
+
+ c) Add the path to the ISPC executable to your PATH environment variable.
diff --git a/xLights/Xlights.vcxproj b/xLights/Xlights.vcxproj
index 76fecdcd1..25acfb009 100644
--- a/xLights/Xlights.vcxproj
+++ b/xLights/Xlights.vcxproj
@@ -1065,8 +1065,15 @@ xcopy "$(SolutionDir)..\bin64\Vamp\" "$(TargetDir)Vamp\" /e /y /i /r
+
+
+
+
+
+
+
@@ -1521,6 +1528,58 @@ xcopy "$(SolutionDir)..\bin64\Vamp\" "$(TargetDir)Vamp\" /e /y /i /r
+
+
+ false
+ Document
+ false
+ ispc.exe "%(FullPath)" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64 -o "$(IntDir)%(Filename).obj"
+ $(IntDir)%(Filename).obj
+ $(InputPath)
+ ispc.exe "%(FullPath)" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64 -o "$(IntDir)%(Filename).obj"
+ $(IntDir)%(FileName).obj
+ $(InputPath)
+
+
+
+
+ false
+ Document
+ ispc.exe "%(FullPath)" -o "$(IntDir)%(Filename).obj" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64
+ $(IntDir)%(Filename).obj
+ $(InputPath)
+ $(IntDir)%(Filename).obj
+ $(InputPath)
+ ispc.exe "%(FullPath)" -o "$(IntDir)%(Filename).obj" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64
+ false
+
+
+
+
+ false
+ Document
+ $(InputPath)
+ $(InputPath)
+ false
+ ispc.exe "%(FullPath)" -o "$(IntDir)%(Filename).obj" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64
+ ispc.exe "%(FullPath)" -o "$(IntDir)%(Filename).obj" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64
+ $(IntDir)%(Filename).obj
+ $(IntDir)%(Filename).obj
+
+
+
+
+ false
+ Document
+ ispc.exe "%(FullPath)" -o "$(IntDir)%(Filename).obj" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64
+ $(IntDir)%(Filename).obj
+ $(InputPath)
+ false
+ ispc.exe "%(FullPath)" -o "$(IntDir)%(Filename).obj" --target=avx2-i32x16 --target=avx1-i32x16 --target=sse4.2-i32x8 --target=sse2-i32x8 --arch=x86_64
+ $(IntDir)%(Filename).obj
+ $(InputPath)
+
+
diff --git a/xLights/Xlights.vcxproj.filters b/xLights/Xlights.vcxproj.filters
index ba3fd7d4c..2f3252ed6 100644
--- a/xLights/Xlights.vcxproj.filters
+++ b/xLights/Xlights.vcxproj.filters
@@ -2203,6 +2203,10 @@
Effects\ispc
+
+
+
+
@@ -2262,4 +2266,10 @@
automation
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xLights/effects/ButterflyEffect.cpp b/xLights/effects/ButterflyEffect.cpp
index 90d8b9fb7..62899fa9e 100644
--- a/xLights/effects/ButterflyEffect.cpp
+++ b/xLights/effects/ButterflyEffect.cpp
@@ -24,10 +24,8 @@
#include "../Parallel.h"
-#ifndef __WXMSW__
#include "ispc/ButterflyFunctions.ispc.h"
#define HASISPC
-#endif
ButterflyEffect::ButterflyEffect(int i) : RenderableEffect(i, "Butterfly", butterfly_16, butterfly_24, butterfly_32, butterfly_48, butterfly_64)
{
diff --git a/xLights/effects/PinwheelEffect.cpp b/xLights/effects/PinwheelEffect.cpp
index 458b52fa2..b652a08f5 100644
--- a/xLights/effects/PinwheelEffect.cpp
+++ b/xLights/effects/PinwheelEffect.cpp
@@ -24,10 +24,8 @@
#include "../Parallel.h"
-#ifndef __WXMSW__
#include "ispc/PinwheelFunctions.ispc.h"
#define HASISPC
-#endif
PinwheelEffect::PinwheelEffect(int id) : RenderableEffect(id, "Pinwheel", pinwheel_16, pinwheel_24, pinwheel_32, pinwheel_48, pinwheel_64)
{
diff --git a/xLights/effects/PlasmaEffect.cpp b/xLights/effects/PlasmaEffect.cpp
index 0996c84f2..af1d8e0c8 100644
--- a/xLights/effects/PlasmaEffect.cpp
+++ b/xLights/effects/PlasmaEffect.cpp
@@ -24,10 +24,8 @@
#include "../Parallel.h"
-#ifndef __WXMSW__
#include "ispc/PlasmaFunctions.ispc.h"
#define HASISPC
-#endif
PlasmaEffect::PlasmaEffect(int id) : RenderableEffect(id, "Plasma", plasma_16, plasma_24, plasma_32, plasma_48, plasma_64)
diff --git a/xLights/effects/ispc/ISPCComputeUtilities.cpp b/xLights/effects/ispc/ISPCComputeUtilities.cpp
index cb0d954da..0f333a8c9 100644
--- a/xLights/effects/ispc/ISPCComputeUtilities.cpp
+++ b/xLights/effects/ispc/ISPCComputeUtilities.cpp
@@ -16,9 +16,7 @@
ISPCComputeUtilities ISPCComputeUtilities::INSTANCE;
-#ifndef __WXMSW__
#define HASISPC
-#endif
#ifdef HASISPC