daily update on 20241228 by nitload youmu, better dot in checking
This commit is contained in:
@@ -7,8 +7,7 @@
|
||||
GladGLContext *currentContext;
|
||||
extern char infolog[512] = { 0 };
|
||||
|
||||
SSCAPI int SSCDECL glCheckShaderStat(GladGLContext *context,
|
||||
uint64_t shaderHandle, int key,
|
||||
SSCAPI int SSCDECL glCheckShaderStat(GladGLContext *context, uint64_t shaderHandle, int key,
|
||||
char **logRef)
|
||||
{
|
||||
int stat = 0;
|
||||
@@ -42,8 +41,7 @@ SSCAPI GLFWglproc SSCDECL loadGlfuncDefault(char *procName)
|
||||
return (GLFWglproc)ret;
|
||||
}
|
||||
|
||||
SSCAPI unsigned int linkShaderProgram(GladGLContext *context,
|
||||
GLuint shaderProgram)
|
||||
SSCAPI unsigned int linkShaderProgram(GladGLContext *context, GLuint shaderProgram)
|
||||
{
|
||||
context->LinkProgram(shaderProgram);
|
||||
|
||||
@@ -57,14 +55,12 @@ SSCAPI unsigned int linkShaderProgram(GladGLContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
SSCAPI void SSCDECL loadImageData(char *location, Image *out,
|
||||
imageLoader loader)
|
||||
SSCAPI void SSCDECL loadImageData(char *location, Image *out, imageLoader loader)
|
||||
{
|
||||
if (loader == NULL) {
|
||||
loader = stbi_load;
|
||||
}
|
||||
out->pixelPtr = loader(location, &(out->width), &(out->height),
|
||||
&(out->channel), 0);
|
||||
out->pixelPtr = loader(location, &(out->width), &(out->height), &(out->channel), 0);
|
||||
}
|
||||
|
||||
SSCAPI void SSCDECL unloadImageData(Image *out)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <immintrin.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef SSCAPI_DEFINE
|
||||
#ifndef SSCAPI_DEFINE
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SSCAPI __declspec(dllexport)
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#endif // ! SSCAPI_DEFINE
|
||||
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -50,18 +49,15 @@ typedef struct Image {
|
||||
char *pixelPtr;
|
||||
} Image;
|
||||
|
||||
typedef char *(*imageLoader)(char const *filename, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
typedef char *(*imageLoader)(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
|
||||
SSCAPI char infolog[512];
|
||||
SSCAPI int SSCDECL glCheckShaderStat(GladGLContext *context,
|
||||
uint64_t shaderHandle, int key,
|
||||
SSCAPI int SSCDECL glCheckShaderStat(GladGLContext *context, uint64_t shaderHandle, int key,
|
||||
char **logRef);
|
||||
SSCAPI void SSCDECL initGL(int majorVersion, int minorVersion);
|
||||
SSCAPI unsigned int SSCDECL linkShaderProgram(GladGLContext *context,
|
||||
GLuint shadertype);
|
||||
SSCAPI void SSCDECL loadImageData(char *location, Image *out,
|
||||
imageLoader loader);
|
||||
SSCAPI unsigned int SSCDECL linkShaderProgram(GladGLContext *context, GLuint shadertype);
|
||||
SSCAPI void SSCDECL loadImageData(char *location, Image *out, imageLoader loader);
|
||||
SSCAPI GLFWglproc SSCDECL loadGlfuncDefault(char *procName);
|
||||
SSCAPI void SSCDECL unloadImageData(Image *out);
|
||||
SSCAPI char *SSCDECL readLog(void);
|
||||
|
||||
@@ -170,6 +170,7 @@
|
||||
<ClCompile Include="StgSharpC.c" />
|
||||
<ClCompile Include="quick_hash.c" />
|
||||
<ClCompile Include="vector.c" />
|
||||
<ClCompile Include="vector_dot.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="gl.h" />
|
||||
|
||||
+4807
-2605
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Doxygen documentation
|
||||
*************************************************************************/
|
||||
@@ -86,78 +85,76 @@ extern "C" {
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* System headers and types
|
||||
*************************************************************************/
|
||||
|
||||
#if !defined(GLFW_NATIVE_INCLUDE_NONE)
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||
* example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||
* but windows.h assumes no one will define APIENTRY before it does
|
||||
*/
|
||||
#if defined(GLFW_APIENTRY_DEFINED)
|
||||
#undef APIENTRY
|
||||
#undef GLFW_APIENTRY_DEFINED
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if defined(GLFW_APIENTRY_DEFINED)
|
||||
#undef APIENTRY
|
||||
#undef GLFW_APIENTRY_DEFINED
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
#if defined(__OBJC__)
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <objc/objc.h>
|
||||
#endif
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
#if defined(__OBJC__)
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <objc/objc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||
#include <wayland-client.h>
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||
#include <wayland-client.h>
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||
/* WGL is declared by windows.h */
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
/* NSGL is declared by Cocoa.h */
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||
/* WGL is declared by windows.h */
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
/* NSGL is declared by Cocoa.h */
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
||||
* default it also acts as an OpenGL header
|
||||
* However, glx.h will include gl.h, which will define it unconditionally
|
||||
*/
|
||||
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
||||
#undef GLAPIENTRY
|
||||
#undef GLFW_GLAPIENTRY_DEFINED
|
||||
#endif
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
||||
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
||||
#undef GLAPIENTRY
|
||||
#undef GLFW_GLAPIENTRY_DEFINED
|
||||
#endif
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
||||
* default it also acts as an OpenGL header
|
||||
* However, osmesa.h will include gl.h, which will define it unconditionally
|
||||
*/
|
||||
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
||||
#undef GLAPIENTRY
|
||||
#undef GLFW_GLAPIENTRY_DEFINED
|
||||
#endif
|
||||
#include <GL/osmesa.h>
|
||||
#endif
|
||||
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
||||
#undef GLAPIENTRY
|
||||
#undef GLFW_GLAPIENTRY_DEFINED
|
||||
#endif
|
||||
#include <GL/osmesa.h>
|
||||
#endif
|
||||
|
||||
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Functions
|
||||
*************************************************************************/
|
||||
@@ -178,7 +175,7 @@ extern "C" {
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
||||
SSCAPI const char *glfwGetWin32Adapter(GLFWmonitor *monitor);
|
||||
|
||||
/*! @brief Returns the display device name of the specified monitor.
|
||||
*
|
||||
@@ -195,7 +192,7 @@ SSCAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||
SSCAPI const char *glfwGetWin32Monitor(GLFWmonitor *monitor);
|
||||
|
||||
/*! @brief Returns the `HWND` of the specified window.
|
||||
*
|
||||
@@ -219,7 +216,7 @@ SSCAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||
SSCAPI HWND glfwGetWin32Window(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||
@@ -246,7 +243,7 @@ SSCAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||
SSCAPI HGLRC glfwGetWGLContext(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
||||
@@ -264,7 +261,7 @@ SSCAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||
SSCAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor *monitor);
|
||||
|
||||
/*! @brief Returns the `NSWindow` of the specified window.
|
||||
*
|
||||
@@ -280,7 +277,7 @@ SSCAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
SSCAPI id glfwGetCocoaWindow(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
@@ -299,7 +296,7 @@ SSCAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||
SSCAPI id glfwGetNSGLContext(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_X11)
|
||||
@@ -317,7 +314,7 @@ SSCAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI Display* glfwGetX11Display(void);
|
||||
SSCAPI Display *glfwGetX11Display(void);
|
||||
|
||||
/*! @brief Returns the `RRCrtc` of the specified monitor.
|
||||
*
|
||||
@@ -333,7 +330,7 @@ SSCAPI Display* glfwGetX11Display(void);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||
SSCAPI RRCrtc glfwGetX11Adapter(GLFWmonitor *monitor);
|
||||
|
||||
/*! @brief Returns the `RROutput` of the specified monitor.
|
||||
*
|
||||
@@ -349,7 +346,7 @@ SSCAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||
SSCAPI RROutput glfwGetX11Monitor(GLFWmonitor *monitor);
|
||||
|
||||
/*! @brief Returns the `Window` of the specified window.
|
||||
*
|
||||
@@ -365,7 +362,7 @@ SSCAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI Window glfwGetX11Window(GLFWwindow* window);
|
||||
SSCAPI Window glfwGetX11Window(GLFWwindow *window);
|
||||
|
||||
/*! @brief Sets the current primary selection to the specified string.
|
||||
*
|
||||
@@ -387,7 +384,7 @@ SSCAPI Window glfwGetX11Window(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI void glfwSetX11SelectionString(const char* string);
|
||||
SSCAPI void glfwSetX11SelectionString(const char *string);
|
||||
|
||||
/*! @brief Returns the contents of the current primary selection as a string.
|
||||
*
|
||||
@@ -415,7 +412,7 @@ SSCAPI void glfwSetX11SelectionString(const char* string);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI const char* glfwGetX11SelectionString(void);
|
||||
SSCAPI const char *glfwGetX11SelectionString(void);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||
@@ -434,7 +431,7 @@ SSCAPI const char* glfwGetX11SelectionString(void);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||
SSCAPI GLXContext glfwGetGLXContext(GLFWwindow *window);
|
||||
|
||||
/*! @brief Returns the `GLXWindow` of the specified window.
|
||||
*
|
||||
@@ -451,7 +448,7 @@ SSCAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
||||
SSCAPI GLXWindow glfwGetGLXWindow(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||
@@ -469,7 +466,7 @@ SSCAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI struct wl_display* glfwGetWaylandDisplay(void);
|
||||
SSCAPI struct wl_display *glfwGetWaylandDisplay(void);
|
||||
|
||||
/*! @brief Returns the `struct wl_output*` of the specified monitor.
|
||||
*
|
||||
@@ -485,7 +482,7 @@ SSCAPI struct wl_display* glfwGetWaylandDisplay(void);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||
SSCAPI struct wl_output *glfwGetWaylandMonitor(GLFWmonitor *monitor);
|
||||
|
||||
/*! @brief Returns the main `struct wl_surface*` of the specified window.
|
||||
*
|
||||
@@ -501,7 +498,7 @@ SSCAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
||||
SSCAPI struct wl_surface *glfwGetWaylandWindow(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||
@@ -539,7 +536,7 @@ SSCAPI EGLDisplay glfwGetEGLDisplay(void);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||
SSCAPI EGLContext glfwGetEGLContext(GLFWwindow *window);
|
||||
|
||||
/*! @brief Returns the `EGLSurface` of the specified window.
|
||||
*
|
||||
@@ -556,7 +553,7 @@ SSCAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||
SSCAPI EGLSurface glfwGetEGLSurface(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||
@@ -582,7 +579,8 @@ SSCAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
|
||||
SSCAPI int glfwGetOSMesaColorBuffer(GLFWwindow *window, int *width, int *height, int *format,
|
||||
void **buffer);
|
||||
|
||||
/*! @brief Retrieves the depth buffer associated with the specified window.
|
||||
*
|
||||
@@ -606,7 +604,8 @@ SSCAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height,
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
|
||||
SSCAPI int glfwGetOSMesaDepthBuffer(GLFWwindow *window, int *width, int *height, int *bytesPerValue,
|
||||
void **buffer);
|
||||
|
||||
/*! @brief Returns the `OSMesaContext` of the specified window.
|
||||
*
|
||||
@@ -623,7 +622,7 @@ SSCAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height,
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
SSCAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
|
||||
SSCAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow *window);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -631,4 +630,3 @@ SSCAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
#endif /* _glfw3_native_h_ */
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@ void load_intrinsic_sse(ssc_intrinsic *context)
|
||||
context->normalize_3 = normalize;
|
||||
context->det_matrix33 = det_mat3;
|
||||
context->det_matrix44 = det_mat4;
|
||||
context->dot_31 = dot_31_sse;
|
||||
context->dot_32 = dot_32_sse;
|
||||
context->dot_41 = dot_41_sse;
|
||||
context->dot_42 = dot_42_sse;
|
||||
context->string_quick_hash = quick_string_hash;
|
||||
}
|
||||
|
||||
@@ -96,6 +100,10 @@ void load_intrinsic_avx(ssc_intrinsic *context)
|
||||
context->normalize_3 = normalize;
|
||||
context->det_matrix33 = det_mat3;
|
||||
context->det_matrix44 = det_mat4;
|
||||
context->dot_31 = dot_31_sse;
|
||||
context->dot_32 = dot_32_avx;
|
||||
context->dot_41 = dot_41_sse;
|
||||
context->dot_42 = dot_42_avx;
|
||||
context->string_quick_hash = quick_string_hash;
|
||||
}
|
||||
|
||||
@@ -115,5 +123,7 @@ void load_intrinsic_512(ssc_intrinsic *context)
|
||||
context->normalize_3 = normalize;
|
||||
context->det_matrix33 = det_mat3;
|
||||
context->det_matrix44 = det_mat4;
|
||||
context->dot_31 = dot_31_sse;
|
||||
context->dot_41 = dot_41_sse;
|
||||
context->string_quick_hash = quick_string_hash;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
*/
|
||||
|
||||
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
|
||||
# define KHRONOS_STATIC 1
|
||||
#define KHRONOS_STATIC 1
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -100,17 +100,17 @@
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(KHRONOS_STATIC)
|
||||
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
|
||||
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
|
||||
* header compatible with static linking. */
|
||||
# define KHRONOS_APICALL
|
||||
#define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined(__SYMBIAN32__)
|
||||
#define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -120,10 +120,10 @@
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
/* Win32 but not WinCE */
|
||||
#define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -131,7 +131,7 @@
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#if defined(__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
@@ -140,19 +140,19 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || \
|
||||
defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
/*
|
||||
* To support platform where unsigned long cannot be used interchangeably with
|
||||
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
|
||||
@@ -168,57 +168,57 @@ typedef uint64_t khronos_uint64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
#elif defined(__VMS) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
@@ -226,23 +226,22 @@ typedef unsigned int khronos_uint32_t;
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
@@ -250,29 +249,29 @@ typedef unsigned short int khronos_uint16_t;
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef KHRONOS_USE_INTPTR_T
|
||||
typedef intptr_t khronos_intptr_t;
|
||||
typedef uintptr_t khronos_uintptr_t;
|
||||
typedef intptr_t khronos_intptr_t;
|
||||
typedef uintptr_t khronos_uintptr_t;
|
||||
#elif defined(_WIN64)
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
@@ -285,8 +284,8 @@ typedef float khronos_float_t;
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -303,9 +302,9 @@ typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
|
||||
+13
-24
@@ -6,11 +6,9 @@
|
||||
|
||||
INTERNAL void __cdecl transpose42(__4_columnset const *source, __2_columnset *target)
|
||||
{
|
||||
__m128 t0 = _mm_shuffle_ps(ALIGN(source->column[0]),
|
||||
ALIGN(source->column[1]),
|
||||
__m128 t0 = _mm_shuffle_ps(ALIGN(source->column[0]), ALIGN(source->column[1]),
|
||||
_MM_SHUFFLE(1, 0, 1, 0));
|
||||
__m128 t2 = _mm_shuffle_ps(ALIGN(source->column[2]),
|
||||
ALIGN(source->column[3]),
|
||||
__m128 t2 = _mm_shuffle_ps(ALIGN(source->column[2]), ALIGN(source->column[3]),
|
||||
_MM_SHUFFLE(1, 0, 1, 0));
|
||||
|
||||
target->column[0] = _mm_shuffle_ps(t0, t2, _MM_SHUFFLE(2, 0, 2, 0));
|
||||
@@ -19,17 +17,13 @@ INTERNAL void __cdecl transpose42(__4_columnset const *source, __2_columnset *ta
|
||||
|
||||
INTERNAL void __cdecl transpose43(__4_columnset const *source, __3_columnset *target)
|
||||
{
|
||||
__m128 t0 = _mm_shuffle_ps(ALIGN(source->column[0]),
|
||||
ALIGN(source->column[1]),
|
||||
__m128 t0 = _mm_shuffle_ps(ALIGN(source->column[0]), ALIGN(source->column[1]),
|
||||
_MM_SHUFFLE(1, 0, 1, 0));
|
||||
__m128 t1 = _mm_shuffle_ps(ALIGN(source->column[0]),
|
||||
ALIGN(source->column[1]),
|
||||
__m128 t1 = _mm_shuffle_ps(ALIGN(source->column[0]), ALIGN(source->column[1]),
|
||||
_MM_SHUFFLE(3, 2, 3, 2));
|
||||
__m128 t2 = _mm_shuffle_ps(ALIGN(source->column[2]),
|
||||
ALIGN(source->column[3]),
|
||||
__m128 t2 = _mm_shuffle_ps(ALIGN(source->column[2]), ALIGN(source->column[3]),
|
||||
_MM_SHUFFLE(1, 0, 1, 0));
|
||||
__m128 t3 = _mm_shuffle_ps(ALIGN(source->column[2]),
|
||||
ALIGN(source->column[3]),
|
||||
__m128 t3 = _mm_shuffle_ps(ALIGN(source->column[2]), ALIGN(source->column[3]),
|
||||
_MM_SHUFFLE(3, 2, 3, 2));
|
||||
|
||||
target->column[0] = _mm_shuffle_ps(t0, t2, _MM_SHUFFLE(2, 0, 2, 0));
|
||||
@@ -39,17 +33,13 @@ INTERNAL void __cdecl transpose43(__4_columnset const *source, __3_columnset *ta
|
||||
|
||||
INTERNAL void __cdecl transpose44(__4_columnset const *source, __4_columnset *target)
|
||||
{
|
||||
__m128 t0 = _mm_shuffle_ps(ALIGN(source->column[0]),
|
||||
ALIGN(source->column[1]),
|
||||
__m128 t0 = _mm_shuffle_ps(ALIGN(source->column[0]), ALIGN(source->column[1]),
|
||||
_MM_SHUFFLE(1, 0, 1, 0));
|
||||
__m128 t1 = _mm_shuffle_ps(ALIGN(source->column[0]),
|
||||
ALIGN(source->column[1]),
|
||||
__m128 t1 = _mm_shuffle_ps(ALIGN(source->column[0]), ALIGN(source->column[1]),
|
||||
_MM_SHUFFLE(3, 2, 3, 2));
|
||||
__m128 t2 = _mm_shuffle_ps(ALIGN(source->column[2]),
|
||||
ALIGN(source->column[3]),
|
||||
__m128 t2 = _mm_shuffle_ps(ALIGN(source->column[2]), ALIGN(source->column[3]),
|
||||
_MM_SHUFFLE(1, 0, 1, 0));
|
||||
__m128 t3 = _mm_shuffle_ps(ALIGN(source->column[2]),
|
||||
ALIGN(source->column[3]),
|
||||
__m128 t3 = _mm_shuffle_ps(ALIGN(source->column[2]), ALIGN(source->column[3]),
|
||||
_MM_SHUFFLE(3, 2, 3, 2));
|
||||
|
||||
target->column[0] = _mm_shuffle_ps(t0, t2, _MM_SHUFFLE(2, 0, 2, 0));
|
||||
@@ -65,10 +55,9 @@ INTERNAL float __cdecl det_mat4(__4_columnset const *mat_ptr, __4_columnset cons
|
||||
__m128 mc2 = ALIGN(mat_ptr->column[2]);
|
||||
__m128 mc3 = ALIGN(mat_ptr->column[3]);
|
||||
|
||||
__m128 cogeneration = _mm_set_ps(det_mat3_internal(mc0, mc1, mc2),
|
||||
det_mat3_internal(mc0, mc1, mc3),
|
||||
det_mat3_internal(mc0, mc2, mc3),
|
||||
det_mat3_internal(mc1, mc2, mc3));
|
||||
__m128 cogeneration =
|
||||
_mm_set_ps(det_mat3_internal(mc0, mc1, mc2), det_mat3_internal(mc0, mc1, mc3),
|
||||
det_mat3_internal(mc0, mc2, mc3), det_mat3_internal(mc1, mc2, mc3));
|
||||
__m128 retvec = _mm_mul_ps(ALIGN(transpose->column[3]), cogeneration);
|
||||
retvec = _mm_hsub_ps(retvec, retvec);
|
||||
retvec = _mm_hadd_ps(retvec, retvec);
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
|
||||
|
||||
#if _WIN32
|
||||
|
||||
#endif // __WIN32
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,17 @@
|
||||
#include <isa_availability.h>
|
||||
#endif
|
||||
|
||||
#define LASTTWO(x) (x & 3)
|
||||
#define LAST(x) (x & 3)
|
||||
|
||||
#define SSE_INSERT(source, target, reset3, reset2, reset1, reset0) \
|
||||
(LASTTWO(source - 1) << 6) | (LASTTWO(target - 1) << 4) | (LAST(reset3) << 3) | \
|
||||
(LAST(reset2) << 2) | (LAST(reset1) << 1) | LAST(reset0)
|
||||
|
||||
#define SSE_INSERT_SIMPLE(source, target) SSE_INSERT(source, target, 0, 0, 0, 0)
|
||||
|
||||
#define M256_PERMUTE(s3, s2, s1, s0) (LASTTWO(s3) << 6) | (LASTTWO(s2) << 4) | (LASTTWO(s1) << 2) | (LASTTWO(s0)
|
||||
|
||||
typedef union column_2 {
|
||||
__m256 stream[1];
|
||||
__m128 column[2];
|
||||
@@ -32,25 +43,25 @@ typedef union column_4 {
|
||||
float m[4][4];
|
||||
} __4_columnset;
|
||||
|
||||
typedef void (SSCDECL *VECTORNORMALIZEPROC)(__m128 *source, __m128 *target);
|
||||
typedef void (SSCDECL *MATRIXTRANSPOSEPROC)(void *source, void *target);
|
||||
typedef void (SSCDECL *MATRIXDETPROC)(void *mat, void *transpose);
|
||||
typedef void (SSCDECL *MATARITHMETIC)(void* left, void* right, void* ans);
|
||||
typedef void (SSCDECL *SCALERMATARITHMETIC)(void* left, void* right, void* ans);
|
||||
typedef void(SSCDECL *VECTORNORMALIZEPROC)(__m128 *source, __m128 *target);
|
||||
typedef void(SSCDECL *DOTPROC)(void *transpose, __m128 *vector, __m128 *ans);
|
||||
typedef void(SSCDECL *MATRIXTRANSPOSEPROC)(void *source, void *target);
|
||||
typedef void(SSCDECL *MATRIXDETPROC)(void *mat, void *transpose);
|
||||
typedef void(SSCDECL *MATARITHMETIC)(void *left, void *right, void *ans);
|
||||
typedef void(SSCDECL *SCALERMATARITHMETIC)(void *left, void *right, void *ans);
|
||||
|
||||
#pragma region matix function
|
||||
|
||||
INTERNAL void normalize(__m128 *source, __m128 *target);
|
||||
|
||||
INTERNAL void SSCDECL addmatrix2_sse(__2_columnset* left, __2_columnset* right, __2_columnset* ans);
|
||||
INTERNAL void SSCDECL addmatrix2_avx(__2_columnset* left, __2_columnset* right, __2_columnset* ans);
|
||||
INTERNAL void SSCDECL addmatrix2_sse(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
||||
INTERNAL void SSCDECL addmatrix2_avx(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
||||
INTERNAL void SSCDECL transpose23(__2_columnset const *source, __3_columnset *target);
|
||||
INTERNAL void SSCDECL transpose24(__2_columnset const *source, __4_columnset *target);
|
||||
|
||||
|
||||
INTERNAL void SSCDECL addmatrix3_sse(__3_columnset* left, __3_columnset* right, __3_columnset* ans);
|
||||
INTERNAL void SSCDECL addmatrix3_avx(__3_columnset* left, __3_columnset* right, __3_columnset* ans);
|
||||
INTERNAL void SSCDECL addmatrix3_512(__3_columnset* left, __3_columnset* right, __3_columnset* ans);
|
||||
INTERNAL void SSCDECL addmatrix3_sse(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||
INTERNAL void SSCDECL addmatrix3_avx(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||
INTERNAL void SSCDECL addmatrix3_512(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||
INTERNAL void SSCDECL transpose32(__3_columnset const *source, __2_columnset *target);
|
||||
INTERNAL void SSCDECL transpose33(__3_columnset const *source, __3_columnset *target);
|
||||
INTERNAL void SSCDECL transpose34(__3_columnset const *source, __4_columnset *target);
|
||||
@@ -66,6 +77,18 @@ INTERNAL float SSCDECL det_mat4(__4_columnset *matrix, __4_columnset *transpose)
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region dot
|
||||
|
||||
INTERNAL void SSCDECL dot_41_sse(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||
INTERNAL void SSCDECL dot_31_sse(__3_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||
|
||||
INTERNAL void SSCDECL dot_42_sse(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||
INTERNAL void SSCDECL dot_32_sse(__3_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||
INTERNAL void SSCDECL dot_42_avx(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||
INTERNAL void SSCDECL dot_32_avx(__3_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region quick_hash
|
||||
|
||||
INTERNAL int quick_string_hash(byte *str, int length);
|
||||
@@ -78,6 +101,10 @@ typedef struct ssc_intrinsic {
|
||||
MATARITHMETIC add_m4;
|
||||
MATRIXDETPROC det_matrix33;
|
||||
MATRIXDETPROC det_matrix44;
|
||||
DOTPROC dot_31;
|
||||
DOTPROC dot_32;
|
||||
DOTPROC dot_41;
|
||||
DOTPROC dot_42;
|
||||
VECTORNORMALIZEPROC normalize_3;
|
||||
int (*string_quick_hash)(char *str, int length);
|
||||
MATRIXTRANSPOSEPROC transpose_23;
|
||||
@@ -90,8 +117,7 @@ typedef struct ssc_intrinsic {
|
||||
MATRIXTRANSPOSEPROC transpose_44;
|
||||
} ssc_intrinsic;
|
||||
|
||||
typedef enum most_advanced_instruction
|
||||
{
|
||||
typedef enum most_advanced_instruction {
|
||||
#ifdef _MSC_VER
|
||||
SSE = __IA_SUPPORT_SSE42,
|
||||
AVX256 = __IA_SUPPORT_VECTOR256,
|
||||
@@ -103,6 +129,6 @@ typedef enum most_advanced_instruction
|
||||
AVX512,
|
||||
NEON
|
||||
#endif
|
||||
}most_advanced_instruction;
|
||||
} most_advanced_instruction;
|
||||
|
||||
#endif // !SSC_INTRIN
|
||||
|
||||
+754
-1321
File diff suppressed because it is too large
Load Diff
+114
-99
@@ -373,14 +373,13 @@ RECENT REVISION HISTORY:
|
||||
|
||||
#define STBI_VERSION 1
|
||||
|
||||
enum
|
||||
{
|
||||
STBI_default = 0, // only used for desired_channels
|
||||
enum {
|
||||
STBI_default = 0, // only used for desired_channels
|
||||
|
||||
STBI_grey = 1,
|
||||
STBI_grey_alpha = 2,
|
||||
STBI_rgb = 3,
|
||||
STBI_rgb_alpha = 4
|
||||
STBI_grey = 1,
|
||||
STBI_grey_alpha = 2,
|
||||
STBI_rgb = 3,
|
||||
STBI_rgb_alpha = 4
|
||||
};
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -399,142 +398,159 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIMARY API - works on images of any type
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIMARY API - works on images of any type
|
||||
//
|
||||
|
||||
//
|
||||
// load image by filename, open file, or memory buffer
|
||||
//
|
||||
//
|
||||
// load image by filename, open file, or memory buffer
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*read) (void* user, char* data, int size); // fill 'data' with 'size' bytes. return number of bytes actually read
|
||||
void (*skip) (void* user, int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative
|
||||
int (*eof) (void* user); // returns nonzero if we are at end of file/data
|
||||
} stbi_io_callbacks;
|
||||
typedef struct {
|
||||
int (*read)(
|
||||
void *user, char *data,
|
||||
int size); // fill 'data' with 'size' bytes. return number of bytes actually read
|
||||
void (*skip)(void *user,
|
||||
int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative
|
||||
int (*eof)(void *user); // returns nonzero if we are at end of file/data
|
||||
} stbi_io_callbacks;
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
|
||||
STBIDEF stbi_uc* stbi_load_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc* stbi_load_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF stbi_uc* stbi_load(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF void stbi_load_to_target(char const* filename, int* x, int* y, stbi_uc* target, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc* stbi_load_from_file(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
||||
STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
STBIDEF void stbi_load_to_target(char const *filename, int *x, int *y, stbi_uc *target,
|
||||
int *channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
||||
#endif
|
||||
|
||||
#ifndef STBI_NO_GIF
|
||||
STBIDEF stbi_uc* stbi_load_gif_from_memory(stbi_uc const* buffer, int len, int** delays, int* x, int* y, int* z, int* comp, int req_comp);
|
||||
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x,
|
||||
int *y, int *z, int *comp, int req_comp);
|
||||
#endif
|
||||
|
||||
#ifdef STBI_WINDOWS_UTF8
|
||||
STBIDEF int stbi_convert_wchar_to_utf8(char* buffer, size_t bufferlen, const wchar_t* input);
|
||||
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t *input);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
|
||||
STBIDEF stbi_us* stbi_load_16_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us* stbi_load_16_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x,
|
||||
int *y, int *channels_in_file, int desired_channels);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF stbi_us* stbi_load_16(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us* stbi_load_from_file_16(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// float-per-channel interface
|
||||
//
|
||||
////////////////////////////////////
|
||||
//
|
||||
// float-per-channel interface
|
||||
//
|
||||
#ifndef STBI_NO_LINEAR
|
||||
STBIDEF float* stbi_loadf_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float* stbi_loadf_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF float* stbi_loadf(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float* stbi_loadf_from_file(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef STBI_NO_HDR
|
||||
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
|
||||
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
|
||||
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
|
||||
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
|
||||
#endif // STBI_NO_HDR
|
||||
|
||||
#ifndef STBI_NO_LINEAR
|
||||
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);
|
||||
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
|
||||
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);
|
||||
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
|
||||
#endif // STBI_NO_LINEAR
|
||||
|
||||
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
|
||||
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const* clbk, void* user);
|
||||
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const* buffer, int len);
|
||||
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
|
||||
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);
|
||||
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF int stbi_is_hdr(char const* filename);
|
||||
STBIDEF int stbi_is_hdr_from_file(FILE* f);
|
||||
STBIDEF int stbi_is_hdr(char const *filename);
|
||||
STBIDEF int stbi_is_hdr_from_file(FILE *f);
|
||||
#endif // STBI_NO_STDIO
|
||||
|
||||
// get a VERY brief reason for failure
|
||||
// on most compilers (and ALL modern mainstream compilers) this is threadsafe
|
||||
STBIDEF const char *stbi_failure_reason(void);
|
||||
|
||||
// get a VERY brief reason for failure
|
||||
// on most compilers (and ALL modern mainstream compilers) this is threadsafe
|
||||
STBIDEF const char* stbi_failure_reason(void);
|
||||
// free the loaded image -- this is just free()
|
||||
STBIDEF void stbi_image_free(void *retval_from_stbi_load);
|
||||
|
||||
// free the loaded image -- this is just free()
|
||||
STBIDEF void stbi_image_free(void* retval_from_stbi_load);
|
||||
|
||||
// get image dimensions & components without fully decoding
|
||||
STBIDEF int stbi_info_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const* buffer, int len);
|
||||
STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const* clbk, void* user);
|
||||
// get image dimensions & components without fully decoding
|
||||
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
||||
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y,
|
||||
int *comp);
|
||||
STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len);
|
||||
STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF int stbi_info(char const* filename, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_info_from_file(FILE* f, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_is_16_bit(char const* filename);
|
||||
STBIDEF int stbi_is_16_bit_from_file(FILE* f);
|
||||
STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp);
|
||||
STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp);
|
||||
STBIDEF int stbi_is_16_bit(char const *filename);
|
||||
STBIDEF int stbi_is_16_bit_from_file(FILE *f);
|
||||
#endif
|
||||
|
||||
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||
// we just return the colors as stored in the file. set this flag to force
|
||||
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
||||
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
||||
|
||||
// indicate whether we should process iphone images back to canonical format,
|
||||
// or just pass them through "as-is"
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
||||
|
||||
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||
// we just return the colors as stored in the file. set this flag to force
|
||||
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
||||
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
||||
// flip the image vertically, so the first pixel in the output array is the bottom left
|
||||
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);
|
||||
|
||||
// indicate whether we should process iphone images back to canonical format,
|
||||
// or just pass them through "as-is"
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
||||
// as above, but only applies to images loaded on the thread that calls the function
|
||||
// this function is only available if your compiler supports thread-local variables;
|
||||
// calling it will fail to link if your compiler doesn't
|
||||
STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply);
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert);
|
||||
STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip);
|
||||
|
||||
// flip the image vertically, so the first pixel in the output array is the bottom left
|
||||
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);
|
||||
// ZLIB client - used by PNG, available for other purposes
|
||||
|
||||
// as above, but only applies to images loaded on the thread that calls the function
|
||||
// this function is only available if your compiler supports thread-local variables;
|
||||
// calling it will fail to link if your compiler doesn't
|
||||
STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply);
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert);
|
||||
STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip);
|
||||
|
||||
// ZLIB client - used by PNG, available for other purposes
|
||||
|
||||
STBIDEF char* stbi_zlib_decode_malloc_guesssize(const char* buffer, int len, int initial_size, int* outlen);
|
||||
STBIDEF char* stbi_zlib_decode_malloc_guesssize_headerflag(const char* buffer, int len, int initial_size, int* outlen, int parse_header);
|
||||
STBIDEF char* stbi_zlib_decode_malloc(const char* buffer, int len, int* outlen);
|
||||
STBIDEF int stbi_zlib_decode_buffer(char* obuffer, int olen, const char* ibuffer, int ilen);
|
||||
|
||||
STBIDEF char* stbi_zlib_decode_noheader_malloc(const char* buffer, int len, int* outlen);
|
||||
STBIDEF int stbi_zlib_decode_noheader_buffer(char* obuffer, int olen, const char* ibuffer, int ilen);
|
||||
STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size,
|
||||
int *outlen);
|
||||
STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len,
|
||||
int initial_size, int *outlen,
|
||||
int parse_header);
|
||||
STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
|
||||
STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
||||
|
||||
STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
|
||||
STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer,
|
||||
int ilen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -728,7 +744,6 @@ extern "C" {
|
||||
first released version
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
@@ -769,4 +784,4 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -5,41 +5,27 @@ SSCAPI void SSCDECL normalize(__m128 *source, __m128 *target)
|
||||
{
|
||||
__m128 a_length_sq = _mm_mul_ps(*source, *source);
|
||||
a_length_sq = _mm_add_ps(a_length_sq,
|
||||
_mm_shuffle_ps(a_length_sq, a_length_sq,
|
||||
_MM_SHUFFLE(2, 3, 0, 1)));
|
||||
_mm_shuffle_ps(a_length_sq, a_length_sq, _MM_SHUFFLE(2, 3, 0, 1)));
|
||||
a_length_sq = _mm_add_ss(a_length_sq,
|
||||
_mm_shuffle_ps(a_length_sq, a_length_sq,
|
||||
_MM_SHUFFLE(0, 0, 3, 2)));
|
||||
_mm_shuffle_ps(a_length_sq, a_length_sq, _MM_SHUFFLE(0, 0, 3, 2)));
|
||||
|
||||
__m128 a_inv_length = _mm_rsqrt_ps(a_length_sq);
|
||||
*source = _mm_mul_ps(*source, a_inv_length);
|
||||
|
||||
__m128 dot_product = _mm_mul_ps(*target, *source);
|
||||
dot_product = _mm_add_ps(dot_product,
|
||||
_mm_shuffle_ps(dot_product, dot_product,
|
||||
_MM_SHUFFLE(2, 3, 0, 1)));
|
||||
_mm_shuffle_ps(dot_product, dot_product, _MM_SHUFFLE(2, 3, 0, 1)));
|
||||
dot_product = _mm_add_ss(dot_product,
|
||||
_mm_shuffle_ps(dot_product, dot_product,
|
||||
_MM_SHUFFLE(0, 0, 3, 2)));
|
||||
_mm_shuffle_ps(dot_product, dot_product, _MM_SHUFFLE(0, 0, 3, 2)));
|
||||
|
||||
__m128 b_orthogonal =
|
||||
_mm_sub_ps(*target, _mm_mul_ps(*source, dot_product));
|
||||
__m128 b_orthogonal = _mm_sub_ps(*target, _mm_mul_ps(*source, dot_product));
|
||||
|
||||
__m128 b_length_sq = _mm_mul_ps(b_orthogonal, b_orthogonal);
|
||||
b_length_sq = _mm_add_ps(b_length_sq,
|
||||
_mm_shuffle_ps(b_length_sq, b_length_sq,
|
||||
_MM_SHUFFLE(2, 3, 0, 1)));
|
||||
_mm_shuffle_ps(b_length_sq, b_length_sq, _MM_SHUFFLE(2, 3, 0, 1)));
|
||||
b_length_sq = _mm_add_ss(b_length_sq,
|
||||
_mm_shuffle_ps(b_length_sq, b_length_sq,
|
||||
_MM_SHUFFLE(0, 0, 3, 2)));
|
||||
_mm_shuffle_ps(b_length_sq, b_length_sq, _MM_SHUFFLE(0, 0, 3, 2)));
|
||||
|
||||
__m128 b_inv_length = _mm_rsqrt_ps(b_length_sq);
|
||||
*target = _mm_mul_ps(b_orthogonal, b_inv_length);
|
||||
}
|
||||
|
||||
void Foo()
|
||||
{
|
||||
|
||||
__m128 a1 = {0.0f,1.0f,2.0f,3.0f};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#include "ssc_intrinsic.h"
|
||||
#include "SSC_internal.h"
|
||||
|
||||
INTERNAL void __inline SSCDECL dot_41_sse(__4_columnset *transpose, __m128 *vector, __m128 *ans)
|
||||
{
|
||||
*ans = _mm_dp_ps(transpose->column[0], *vector, 0B00011111);
|
||||
*ans = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[1], *vector, 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 1));
|
||||
*ans = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[2], *vector, 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 3));
|
||||
*ans = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[3], *vector, 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 4));
|
||||
}
|
||||
|
||||
INTERNAL void SSCDECL dot_31_sse(__3_columnset *transpose, __m128 *vector, __m128 *ans)
|
||||
{
|
||||
*ans = _mm_dp_ps(transpose->column[0], *vector, 0B00011111);
|
||||
*ans = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[1], *vector, 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 1));
|
||||
*ans = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[2], *vector, 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 3));
|
||||
}
|
||||
|
||||
INTERNAL void SSCDECL dot_42_sse(__4_columnset *transpose, __m128 *vector, __m128 *ans)
|
||||
{
|
||||
ans[0] = _mm_dp_ps(transpose->column[0], vector[0], 0B00011111);
|
||||
ans[0] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[1], vector[0], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 1));
|
||||
ans[0] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[2], vector[0], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 3));
|
||||
ans[0] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[3], vector[0], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 4));
|
||||
|
||||
ans[1] = _mm_dp_ps(transpose->column[0], vector[1], 0B00011111);
|
||||
ans[1] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[1], vector[1], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 1));
|
||||
ans[1] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[2], vector[1], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 3));
|
||||
ans[1] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[3], vector[1], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 4));
|
||||
}
|
||||
|
||||
INTERNAL void SSCDECL dot_32_sse(__3_columnset *transpose, __m128 *vector, __m128 *ans)
|
||||
{
|
||||
ans[0] = _mm_dp_ps(transpose->column[0], vector[0], 0B00011111);
|
||||
ans[0] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[1], vector[0], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 1));
|
||||
ans[0] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[2], vector[0], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 3));
|
||||
|
||||
ans[1] = _mm_dp_ps(transpose->column[0], vector[1], 0B00011111);
|
||||
ans[1] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[1], vector[1], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 1));
|
||||
ans[1] = _mm_insert_ps(*ans, _mm_dp_ps(transpose->column[2], vector[1], 0B00011111),
|
||||
SSE_INSERT_SIMPLE(1, 3));
|
||||
}
|
||||
|
||||
INTERNAL void SSCDECL dot_42_avx(__4_columnset *transpose, __m128 *vector, __m128 *ans)
|
||||
{
|
||||
__2_columnset *ansPtr = (__2_columnset *)ans;
|
||||
__m256 temp = ALIGN256(transpose->half[0]);
|
||||
|
||||
ansPtr->stream[0] = _mm256_dp_ps(temp, *(__m256 *)vector, 0B11110001);
|
||||
temp = _mm256_permute2f128_ps(temp, temp, 0B00000001);
|
||||
ansPtr->stream[0] = _mm256_blend_ps(
|
||||
ansPtr->stream[0], _mm256_dp_ps(temp, *(__m256 *)vector, 0B11110010), 0B001000010);
|
||||
|
||||
temp = ALIGN256(transpose->half[1]);
|
||||
ansPtr->stream[0] = _mm256_blend_ps(
|
||||
ansPtr->stream[0], _mm256_dp_ps(temp, *(__m256 *)vector, 0B11110100), 0B01000100);
|
||||
temp = _mm256_permute2f128_ps(temp, temp, 0B00000001);
|
||||
ansPtr->stream[0] = _mm256_blend_ps(
|
||||
ansPtr->stream[0], _mm256_dp_ps(temp, *(__m256 *)vector, 0B11111000), 0B10001000);
|
||||
|
||||
ans[1] = _mm_shuffle_ps(ALIGN(ans[1]), ALIGN(ans[1]), _MM_SHUFFLE(2, 3, 0, 1));
|
||||
}
|
||||
|
||||
INTERNAL void SSCDECL dot_32_avx(__3_columnset *transpose, __m128 *vector, __m128 *ans)
|
||||
{
|
||||
__2_columnset *ansPtr = (__2_columnset *)ans;
|
||||
__m256 temp = transpose->part;
|
||||
|
||||
ansPtr->stream[0] = _mm256_dp_ps(temp, *(__m256 *)vector, 0B11110001);
|
||||
temp = _mm256_permute2f128_ps(temp, temp, 0B00000001);
|
||||
ansPtr->stream[0] = _mm256_blend_ps(
|
||||
ansPtr->stream[0], _mm256_dp_ps(temp, *(__m256 *)vector, 0B11110010), 0B001000010);
|
||||
|
||||
temp = _mm256_set_m128(transpose->column[2], transpose->column[2]);
|
||||
ansPtr->stream[0] = _mm256_blend_ps(
|
||||
ansPtr->stream[0], _mm256_dp_ps(temp, *(__m256 *)vector, 0B11110100), 0B01000100);
|
||||
|
||||
ans[1] = _mm_shuffle_ps(ALIGN(ans[1]), ALIGN(ans[1]), _MM_SHUFFLE(2, 2, 0, 1));
|
||||
}
|
||||
+444
-349
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user