add from giga-device, new branch added

This commit is contained in:
Nitload Youmu
2025-08-21 20:44:30 +08:00
parent 43bbc06bbb
commit fb9398e8be
135 changed files with 1505 additions and 1107 deletions
+1 -1
View File
@@ -142,4 +142,4 @@ typedef struct GLFWFunctionTable {
}
#endif
#endif
#endif
+3 -2
View File
@@ -32,12 +32,12 @@ typedef union uint64_u {
uint32_t u32[2];
} uint64_u;
typedef union mat_kernel {
typedef union mat_kernel{
__m128 xmm[4];
__m256 ymm[2];
__m512 zmm[1];
float m[4][4];
} mat_kernel;
}mat_kernel;
typedef union column_2 {
__m256 stream;
@@ -66,6 +66,7 @@ typedef void(SN_DECL *MATARITHMETIC)(void *left, void *right, void *ans);
typedef void(SN_DECL *SCALERMATARITHMETIC)(void *left, void *right, void *ans);
typedef uint64_t(SN_DECL *FACTORIALROC)(int n);
#pragma region matix function
INTERNAL void normalize(__m128 *source, __m128 *target);
+2 -2
View File
@@ -17,7 +17,7 @@ INTERNAL uint64_t SN_DECL factorial_simd_sse(int n)
uint64_t result = (uint64_t)baseResult.m128i_i32[0] * (uint64_t)baseResult.m128i_i32[1] *
(uint64_t)baseResult.m128i_i32[2] * (uint64_t)baseResult.m128i_i32[3];
for (uint64_t i = rest; i < n; i++) {
result *= i;
result *= i ;
}
return result;
}
}
+3 -3
View File
@@ -15,7 +15,7 @@ INTERNAL int SN_DECL city_hash_simplify_sse(byte const *str, int const length)
for (; ptr < end; ptr += 4) {
hash = _mm_crc32_u32(hash, *(uint32_t *)ptr);
}
for (; ptr < end; ptr++) {
for (; ptr < end; ptr++) {
hash = _mm_crc32_u16(hash, *ptr);
}
} else {
@@ -30,10 +30,10 @@ INTERNAL int SN_DECL city_hash_simplify_sse(byte const *str, int const length)
hash = _mm_crc32_u8(hash, hash64);
hash = _mm_crc32_u8(hash, hash64 >> 32);
for (; ptr < last_32; ptr += 4) {
hash = _mm_crc32_u32(hash, *(uint32_t *)ptr);
hash = _mm_crc32_u32(hash,*(uint32_t *)ptr);
}
for (; ptr < end; ptr += 2) {
hash = _mm_crc32_u8(hash, *ptr);
hash = _mm_crc32_u8(hash,*ptr);
}
}
hash ^= hash >> 16;
+1
View File
@@ -1,6 +1,7 @@
#include "StgSharpNative.h"
#include "sn_intrinsic.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <intrin.h>
#include <isa_availability.h>
+115 -115
View File
@@ -4,119 +4,119 @@
SN_API void SN_DECL load_glfw_functions(GLFWFunctionTable *table)
{
table->glfwInit = glfwInit;
table->glfwTerminate = glfwTerminate;
table->glfwInitHint = glfwInitHint;
table->glfwGetVersion = glfwGetVersion;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetError = glfwGetError;
table->glfwSetErrorCallback = glfwSetErrorCallback;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwSetGamma = glfwSetGamma;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwWindowHint = glfwWindowHint;
table->glfwWindowHintString = glfwWindowHintString;
table->glfwCreateWindow = glfwCreateWindow;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwWindowShouldClose = glfwWindowShouldClose;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwShowWindow = glfwShowWindow;
table->glfwHideWindow = glfwHideWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwPollEvents = glfwPollEvents;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwSetInputMode = glfwSetInputMode;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetKey = glfwGetKey;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwCreateCursor = glfwCreateCursor;
table->glfwCreateStandardCursor = glfwCreateStandardCursor;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwJoystickPresent = glfwJoystickPresent;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwJoystickIsGamepad = glfwJoystickIsGamepad;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetTime = glfwGetTime;
table->glfwSetTime = glfwSetTime;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwExtensionSupported = glfwExtensionSupported;
table->glfwGetProcAddress = glfwGetProcAddress;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwGetRequiredInstanceExtensions = glfwGetRequiredInstanceExtensions;
table->glfwInit = glfwInit;
table->glfwTerminate = glfwTerminate;
table->glfwInitHint = glfwInitHint;
table->glfwGetVersion = glfwGetVersion;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetError = glfwGetError;
table->glfwSetErrorCallback = glfwSetErrorCallback;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwSetGamma = glfwSetGamma;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwWindowHint = glfwWindowHint;
table->glfwWindowHintString = glfwWindowHintString;
table->glfwCreateWindow = glfwCreateWindow;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwWindowShouldClose = glfwWindowShouldClose;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwShowWindow = glfwShowWindow;
table->glfwHideWindow = glfwHideWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwPollEvents = glfwPollEvents;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwSetInputMode = glfwSetInputMode;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetKey = glfwGetKey;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwCreateCursor = glfwCreateCursor;
table->glfwCreateStandardCursor = glfwCreateStandardCursor;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwJoystickPresent = glfwJoystickPresent;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwJoystickIsGamepad = glfwJoystickIsGamepad;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetTime = glfwGetTime;
table->glfwSetTime = glfwSetTime;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwExtensionSupported = glfwExtensionSupported;
table->glfwGetProcAddress = glfwGetProcAddress;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwGetRequiredInstanceExtensions = glfwGetRequiredInstanceExtensions;
}
+1 -1
View File
@@ -100,4 +100,4 @@ INTERNAL void SN_DECL submatrix4_avx(__4_columnset *left, __4_columnset *right,
INTERNAL void SN_DECL submatrix4_512(__4_columnset *left, __4_columnset *right, __4_columnset *ans)
{
ans->stream = _mm512_sub_ps(ALIGN512(left->stream), ALIGN512(right->stream));
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ SN_API GLFWglproc SN_DECL loadGlfuncDefault(char *procName)
void *ret = glfwGetProcAddress(procName);
// printf("%llu\n", (uint64_t)ret);
if (ret == NULL) {
strcpy_s(infolog, 30, "Failed to load OpenGL api:");
strcpy_s(infolog,30, "Failed to load OpenGL api:");
for (size_t i = 0; i < sizeof(procName); i++) {
infolog[30 + i] = procName[i];
}
+6 -6
View File
@@ -3,12 +3,12 @@
int index_pair_sse(short const *str, uint32_t target, int length)
{
int index = 0, result = 0, size = length, end = size - 8;
__m128i s = {
target,
target,
target,
target,
};
__m128i s = {
target,
target,
target,
target,
};
__m128i vec, com;
while (index < end) {