Normalize all existing files to LF
This commit is contained in:
@@ -1,73 +1,73 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef SSC
|
||||
#define SSC
|
||||
|
||||
#include "ssc_internal.h"
|
||||
|
||||
#define STBIDEF SSCAPI
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "gl.h"
|
||||
#include "wgl.h"
|
||||
#include "glfw3.h"
|
||||
#include <immintrin.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef SSCAPI_DEFINE
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SSCAPI __declspec(dllexport)
|
||||
#elif defined _LINUX_
|
||||
#define SSCAPI __attribute__((dllexport))
|
||||
#elif defined _APPLE_
|
||||
#define SSCAPI __attribute__((visibility("default")))
|
||||
#else
|
||||
#define SSCAPI
|
||||
#endif
|
||||
|
||||
#endif // ! SSCAPI_DEFINE
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define byte char
|
||||
#define cs_char uint16_t
|
||||
#define ssc_null_assert(ptr) assert(ptr != NULL)
|
||||
|
||||
#define ALIGN(simdVec) _mm_loadu_ps(&simdVec)
|
||||
#define ALIGN256(simdVec) _mm256_loadu_ps(&simdVec)
|
||||
#define ALIGN512(simdVec) _mm512_loadu_ps(&simdVec)
|
||||
|
||||
typedef struct Image {
|
||||
int width;
|
||||
int height;
|
||||
int channel;
|
||||
char *pixelPtr;
|
||||
} Image;
|
||||
|
||||
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,
|
||||
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 GLFWglproc SSCDECL loadGlfuncDefault(char *procName);
|
||||
SSCAPI void SSCDECL unloadImageData(Image *out);
|
||||
SSCAPI char *SSCDECL readLog(void);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
SSCAPI int SSCDECL load_intrinsic_function(void *intrinsic_context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef SSC
|
||||
#define SSC
|
||||
|
||||
#include "ssc_internal.h"
|
||||
|
||||
#define STBIDEF SSCAPI
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "gl.h"
|
||||
#include "wgl.h"
|
||||
#include "glfw3.h"
|
||||
#include <immintrin.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef SSCAPI_DEFINE
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SSCAPI __declspec(dllexport)
|
||||
#elif defined _LINUX_
|
||||
#define SSCAPI __attribute__((dllexport))
|
||||
#elif defined _APPLE_
|
||||
#define SSCAPI __attribute__((visibility("default")))
|
||||
#else
|
||||
#define SSCAPI
|
||||
#endif
|
||||
|
||||
#endif // ! SSCAPI_DEFINE
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define byte char
|
||||
#define cs_char uint16_t
|
||||
#define ssc_null_assert(ptr) assert(ptr != NULL)
|
||||
|
||||
#define ALIGN(simdVec) _mm_loadu_ps(&simdVec)
|
||||
#define ALIGN256(simdVec) _mm256_loadu_ps(&simdVec)
|
||||
#define ALIGN512(simdVec) _mm512_loadu_ps(&simdVec)
|
||||
|
||||
typedef struct Image {
|
||||
int width;
|
||||
int height;
|
||||
int channel;
|
||||
char *pixelPtr;
|
||||
} Image;
|
||||
|
||||
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,
|
||||
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 GLFWglproc SSCDECL loadGlfuncDefault(char *procName);
|
||||
SSCAPI void SSCDECL unloadImageData(Image *out);
|
||||
SSCAPI char *SSCDECL readLog(void);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
SSCAPI int SSCDECL load_intrinsic_function(void *intrinsic_context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,81 +1,81 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef SNative
|
||||
#define SNative
|
||||
|
||||
#include "sn_internal.h"
|
||||
#include "sn_target.h"
|
||||
|
||||
#define STBIDEF SN_API
|
||||
#include "../lib/stbi/stb_image.h"
|
||||
|
||||
#include "gl.h"
|
||||
#include "wgl.h"
|
||||
#define GLFWAPI INTERNAL
|
||||
#include "glfw\glfw3.h"
|
||||
#include <immintrin.h>
|
||||
#include <assert.h>
|
||||
#include <glfw_function.h>
|
||||
|
||||
#ifndef SN_APIDEF
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SN_API __declspec(dllexport)
|
||||
#elif defined _LINUX_
|
||||
#define SN_API __attribute__((dllexport))
|
||||
#elif defined _APPLE_
|
||||
#define SN_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define SN_API
|
||||
#endif
|
||||
|
||||
#endif // ! SN_APIDEF
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define byte char
|
||||
#define cs_char uint16_t
|
||||
#define sn_null_assert(ptr) assert(ptr != NULL)
|
||||
|
||||
#define ALIGN(simdVec) _mm_loadu_ps(&simdVec)
|
||||
#define ALIGN256(simdVec) _mm256_loadu_ps(&simdVec)
|
||||
#define ALIGN512(simdVec) _mm512_loadu_ps(&simdVec)
|
||||
|
||||
typedef struct Image {
|
||||
int width;
|
||||
int height;
|
||||
int channel;
|
||||
char *pixelPtr;
|
||||
} Image;
|
||||
|
||||
typedef char *(*imageLoader)(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
|
||||
SN_API char infolog[512];
|
||||
SN_API int SN_DECL glCheckShaderStat(GladGLContext *context, uint64_t shaderHandle, int key,
|
||||
char **logRef);
|
||||
SN_API void SN_DECL initGL(int majorVersion, int minorVersion);
|
||||
SN_API unsigned int SN_DECL linkShaderProgram(GladGLContext *context, GLuint shadertype);
|
||||
SN_API void SN_DECL loadImageData(char *location, Image *out, imageLoader loader);
|
||||
SN_API GLFWglproc SN_DECL loadGlfuncDefault(char *procName);
|
||||
SN_API void SN_DECL unloadImageData(Image *out);
|
||||
SN_API char *SN_DECL readLog(void);
|
||||
SN_API void SN_DECL load_glfw_functions(GLFWFunctionTable *table);
|
||||
SN_API void SN_DECL load_intrinsic_function(void *intrinsic_context, uint64_t id);
|
||||
SN_API SIMDID SN_DECL sn_get_simd_level_global();
|
||||
/* Per-core variant: always re-executes CPUID, never caches.
|
||||
* Must be called on the target core (after affinity is set). */
|
||||
SN_API SIMDID SN_DECL sn_get_simd_level_local();
|
||||
SN_API SIMDID SN_DECL sn_get_unite_simd(SIMDID left, SIMDID right);
|
||||
SN_API int SN_DECL sn_compare_simd(SIMDID left, SIMDID right);
|
||||
SN_API void SN_DECL sn_set_thread_affinity(int core_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef SNative
|
||||
#define SNative
|
||||
|
||||
#include "sn_internal.h"
|
||||
#include "sn_target.h"
|
||||
|
||||
#define STBIDEF SN_API
|
||||
#include "../lib/stbi/stb_image.h"
|
||||
|
||||
#include "gl.h"
|
||||
#include "wgl.h"
|
||||
#define GLFWAPI INTERNAL
|
||||
#include "glfw\glfw3.h"
|
||||
#include <immintrin.h>
|
||||
#include <assert.h>
|
||||
#include <glfw_function.h>
|
||||
|
||||
#ifndef SN_APIDEF
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SN_API __declspec(dllexport)
|
||||
#elif defined _LINUX_
|
||||
#define SN_API __attribute__((dllexport))
|
||||
#elif defined _APPLE_
|
||||
#define SN_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define SN_API
|
||||
#endif
|
||||
|
||||
#endif // ! SN_APIDEF
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define byte char
|
||||
#define cs_char uint16_t
|
||||
#define sn_null_assert(ptr) assert(ptr != NULL)
|
||||
|
||||
#define ALIGN(simdVec) _mm_loadu_ps(&simdVec)
|
||||
#define ALIGN256(simdVec) _mm256_loadu_ps(&simdVec)
|
||||
#define ALIGN512(simdVec) _mm512_loadu_ps(&simdVec)
|
||||
|
||||
typedef struct Image {
|
||||
int width;
|
||||
int height;
|
||||
int channel;
|
||||
char *pixelPtr;
|
||||
} Image;
|
||||
|
||||
typedef char *(*imageLoader)(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
|
||||
SN_API char infolog[512];
|
||||
SN_API int SN_DECL glCheckShaderStat(GladGLContext *context, uint64_t shaderHandle, int key,
|
||||
char **logRef);
|
||||
SN_API void SN_DECL initGL(int majorVersion, int minorVersion);
|
||||
SN_API unsigned int SN_DECL linkShaderProgram(GladGLContext *context, GLuint shadertype);
|
||||
SN_API void SN_DECL loadImageData(char *location, Image *out, imageLoader loader);
|
||||
SN_API GLFWglproc SN_DECL loadGlfuncDefault(char *procName);
|
||||
SN_API void SN_DECL unloadImageData(Image *out);
|
||||
SN_API char *SN_DECL readLog(void);
|
||||
SN_API void SN_DECL load_glfw_functions(GLFWFunctionTable *table);
|
||||
SN_API void SN_DECL load_intrinsic_function(void *intrinsic_context, uint64_t id);
|
||||
SN_API SIMDID SN_DECL sn_get_simd_level_global();
|
||||
/* Per-core variant: always re-executes CPUID, never caches.
|
||||
* Must be called on the target core (after affinity is set). */
|
||||
SN_API SIMDID SN_DECL sn_get_simd_level_local();
|
||||
SN_API SIMDID SN_DECL sn_get_unite_simd(SIMDID left, SIMDID right);
|
||||
SN_API int SN_DECL sn_compare_simd(SIMDID left, SIMDID right);
|
||||
SN_API void SN_DECL sn_set_thread_affinity(int core_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+10775
-10775
File diff suppressed because one or more lines are too long
@@ -1,146 +1,146 @@
|
||||
#ifndef GLFW_FUNCTION_TABLE_H
|
||||
#define GLFW_FUNCTION_TABLE_H
|
||||
|
||||
#include "../lib/glfw/glfw3.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct GLFWFunctionTable {
|
||||
GLFWcursor *(*glfwCreateCursor)(const GLFWimage *image, int xhot, int yhot);
|
||||
GLFWcursor *(*glfwCreateStandardCursor)(int shape);
|
||||
GLFWwindow *(*glfwCreateWindow)(int width, int height, const char *title,
|
||||
GLFWmonitor *monitor, GLFWwindow *share);
|
||||
void (*glfwDefaultWindowHints)(void);
|
||||
void (*glfwDestroyCursor)(GLFWcursor *cursor);
|
||||
void (*glfwDestroyWindow)(GLFWwindow *window);
|
||||
int (*glfwExtensionSupported)(const char *extension);
|
||||
void (*glfwFocusWindow)(GLFWwindow *window);
|
||||
const char *(*glfwGetClipboardString)(GLFWwindow *window);
|
||||
GLFWwindow *(*glfwGetCurrentContext)(void);
|
||||
void (*glfwGetCursorPos)(GLFWwindow *window, double *xpos, double *ypos);
|
||||
int (*glfwGetError)(const char **description);
|
||||
void (*glfwGetFrameBufferSize)(GLFWwindow *window, int *width, int *height);
|
||||
const char *(*glfwGetGamepadName)(int jid);
|
||||
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate *state);
|
||||
const GLFWgammaramp *(*glfwGetGammaRamp)(GLFWmonitor *monitor);
|
||||
int (*glfwGetInputMode)(GLFWwindow *window, int mode);
|
||||
const float *(*glfwGetJoystickAxes)(int jid, int *count);
|
||||
const unsigned char *(*glfwGetJoystickButtons)(int jid, int *count);
|
||||
const char *(*glfwGetJoystickGUID)(int jid);
|
||||
const unsigned char *(*glfwGetJoystickHats)(int jid, int *count);
|
||||
const char *(*glfwGetJoystickName)(int jid);
|
||||
void *(*glfwGetJoystickUserPointer)(int jid);
|
||||
int (*glfwGetKey)(GLFWwindow *window, int key);
|
||||
const char *(*glfwGetKeyName)(int key, int scancode);
|
||||
int (*glfwGetKeyScancode)(int key);
|
||||
void (*glfwGetMonitorContentScale)(GLFWmonitor *monitor, float *xscale, float *yscale);
|
||||
const char *(*glfwGetMonitorName)(GLFWmonitor *monitor);
|
||||
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor *monitor, int *widthMM, int *heightMM);
|
||||
void (*glfwGetMonitorPos)(GLFWmonitor *monitor, int *xpos, int *ypos);
|
||||
GLFWmonitor **(*glfwGetMonitors)(int *count);
|
||||
void *(*glfwGetMonitorUserPointer)(GLFWmonitor *monitor);
|
||||
void (*glfwGetMonitorWorkarea)(GLFWmonitor *monitor, int *xpos, int *ypos, int *width,
|
||||
int *height);
|
||||
int (*glfwGetMouseButton)(GLFWwindow *window, int button);
|
||||
GLFWmonitor *(*glfwGetPrimaryMonitor)(void);
|
||||
GLFWglproc (*glfwGetProcAddress)(const char *procname);
|
||||
const char **(*glfwGetRequiredInstanceExtensions)(unsigned int *count);
|
||||
double (*glfwGetTime)(void);
|
||||
unsigned long long (*glfwGetTimerFrequency)(void);
|
||||
unsigned long long (*glfwGetTimerValue)(void);
|
||||
void (*glfwGetVersion)(int *major, int *minor, int *rev);
|
||||
const char *(*glfwGetVersionString)(void);
|
||||
const GLFWvidmode *(*glfwGetVideoMode)(GLFWmonitor *monitor);
|
||||
const GLFWvidmode *(*glfwGetVideoModes)(GLFWmonitor *monitor, int *count);
|
||||
int (*glfwGetWindowAttrib)(GLFWwindow *window, int attrib);
|
||||
void (*glfwGetWindowContentScale)(GLFWwindow *window, float *xscale, float *yscale);
|
||||
void (*glfwGetWindowFrameSize)(GLFWwindow *window, int *left, int *top, int *right,
|
||||
int *bottom);
|
||||
GLFWmonitor *(*glfwGetWindowMonitor)(GLFWwindow *window);
|
||||
float (*glfwGetWindowOpacity)(GLFWwindow *window);
|
||||
void (*glfwGetWindowPos)(GLFWwindow *window, int *xpos, int *ypos);
|
||||
void (*glfwGetWindowSize)(GLFWwindow *window, int *width, int *height);
|
||||
void *(*glfwGetWindowUserPointer)(GLFWwindow *window);
|
||||
void (*glfwHideWindow)(GLFWwindow *window);
|
||||
void (*glfwIconifyWindow)(GLFWwindow *window);
|
||||
int (*glfwInit)(void);
|
||||
void (*glfwInitHint)(int hint, int value);
|
||||
int (*glfwJoystickIsGamePad)(int jid);
|
||||
int (*glfwJoystickPresent)(int jid);
|
||||
void (*glfwMakeContextCurrent)(GLFWwindow *window);
|
||||
void (*glfwMaximizeWindow)(GLFWwindow *window);
|
||||
void (*glfwPollEvents)(void);
|
||||
void (*glfwPostEmptyEvent)(void);
|
||||
int (*glfwRawMouseMotionSupported)(void);
|
||||
void (*glfwRequestWindowAttention)(GLFWwindow *window);
|
||||
void (*glfwRestoreWindow)(GLFWwindow *window);
|
||||
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow *window, GLFWcharfun callback);
|
||||
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow *window, GLFWcharmodsfun callback);
|
||||
void (*glfwSetClipboardString)(GLFWwindow *window, const char *str);
|
||||
void (*glfwSetCursor)(GLFWwindow *window, GLFWcursor *cursor);
|
||||
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow *window,
|
||||
GLFWcursorenterfun callback);
|
||||
void (*glfwSetCursorPos)(GLFWwindow *window, double xpos, double ypos);
|
||||
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow *window, GLFWcursorposfun callback);
|
||||
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow *window, GLFWdropfun callback);
|
||||
GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback);
|
||||
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow *window,
|
||||
GLFWframebuffersizefun callback);
|
||||
void (*glfwSetGamma)(GLFWmonitor *monitor, float gamma);
|
||||
void (*glfwSetGammaRamp)(GLFWmonitor *monitor, const GLFWgammaramp *ramp);
|
||||
void (*glfwSetInputMode)(GLFWwindow *window, int mode, int value);
|
||||
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
|
||||
void (*glfwSetJoystickUserPointer)(int jid, void *pointer);
|
||||
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow *window, GLFWkeyfun callback);
|
||||
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
|
||||
void (*glfwSetMonitorUserPointer)(GLFWmonitor *monitor, void *pointer);
|
||||
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow *window,
|
||||
GLFWmousebuttonfun callback);
|
||||
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow *window, GLFWscrollfun callback);
|
||||
void (*glfwSetTime)(double time);
|
||||
void (*glfwSetWindowAspectRatio)(GLFWwindow *window, int numer, int denom);
|
||||
void (*glfwSetWindowAttrib)(GLFWwindow *window, int attrib, int value);
|
||||
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow *window,
|
||||
GLFWwindowclosefun callback);
|
||||
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(
|
||||
GLFWwindow *window, GLFWwindowcontentscalefun callback);
|
||||
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow *window,
|
||||
GLFWwindowfocusfun callback);
|
||||
void (*glfwSetWindowIcon)(GLFWwindow *window, int count, const GLFWimage *images);
|
||||
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow *window,
|
||||
GLFWwindowiconifyfun callback);
|
||||
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow *window,
|
||||
GLFWwindowmaximizefun callback);
|
||||
void (*glfwSetWindowMonitor)(GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos,
|
||||
int width, int height, int refreshRate);
|
||||
void (*glfwSetWindowOpacity)(GLFWwindow *window, float opacity);
|
||||
void (*glfwSetWindowPos)(GLFWwindow *window, int xpos, int ypos);
|
||||
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow *window, GLFWwindowposfun callback);
|
||||
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow *window,
|
||||
GLFWwindowrefreshfun callback);
|
||||
void (*glfwSetWindowShouldClose)(GLFWwindow *window, int value);
|
||||
void (*glfwSetWindowSize)(GLFWwindow *window, int width, int height);
|
||||
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow *window,
|
||||
GLFWwindowsizefun callback);
|
||||
void (*glfwSetWindowSizeLimits)(GLFWwindow *window, int minwidth, int minheight,
|
||||
int maxwidth, int maxheight);
|
||||
void (*glfwSetWindowTitle)(GLFWwindow *window, const char *title);
|
||||
void (*glfwSetWindowUserPointer)(GLFWwindow *window, void *pointer);
|
||||
void (*glfwShowWindow)(GLFWwindow *window);
|
||||
void (*glfwSwapBuffers)(GLFWwindow *window);
|
||||
void (*glfwSwapInterval)(int interval);
|
||||
void (*glfwTerminate)(void);
|
||||
int (*glfwUpdateGamePadMappings)(const char *str);
|
||||
int (*glfwVulkanSupported)(void);
|
||||
void (*glfwWaitEvents)(void);
|
||||
void (*glfwWaitEventsTimeout)(double timeout);
|
||||
void (*glfwWindowHint)(int hint, int value);
|
||||
void (*glfwWindowHintString)(int hint, const char *value);
|
||||
int (*glfwWindowShouldClose)(GLFWwindow *window);
|
||||
} GLFWFunctionTable;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifndef GLFW_FUNCTION_TABLE_H
|
||||
#define GLFW_FUNCTION_TABLE_H
|
||||
|
||||
#include "../lib/glfw/glfw3.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct GLFWFunctionTable {
|
||||
GLFWcursor *(*glfwCreateCursor)(const GLFWimage *image, int xhot, int yhot);
|
||||
GLFWcursor *(*glfwCreateStandardCursor)(int shape);
|
||||
GLFWwindow *(*glfwCreateWindow)(int width, int height, const char *title,
|
||||
GLFWmonitor *monitor, GLFWwindow *share);
|
||||
void (*glfwDefaultWindowHints)(void);
|
||||
void (*glfwDestroyCursor)(GLFWcursor *cursor);
|
||||
void (*glfwDestroyWindow)(GLFWwindow *window);
|
||||
int (*glfwExtensionSupported)(const char *extension);
|
||||
void (*glfwFocusWindow)(GLFWwindow *window);
|
||||
const char *(*glfwGetClipboardString)(GLFWwindow *window);
|
||||
GLFWwindow *(*glfwGetCurrentContext)(void);
|
||||
void (*glfwGetCursorPos)(GLFWwindow *window, double *xpos, double *ypos);
|
||||
int (*glfwGetError)(const char **description);
|
||||
void (*glfwGetFrameBufferSize)(GLFWwindow *window, int *width, int *height);
|
||||
const char *(*glfwGetGamepadName)(int jid);
|
||||
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate *state);
|
||||
const GLFWgammaramp *(*glfwGetGammaRamp)(GLFWmonitor *monitor);
|
||||
int (*glfwGetInputMode)(GLFWwindow *window, int mode);
|
||||
const float *(*glfwGetJoystickAxes)(int jid, int *count);
|
||||
const unsigned char *(*glfwGetJoystickButtons)(int jid, int *count);
|
||||
const char *(*glfwGetJoystickGUID)(int jid);
|
||||
const unsigned char *(*glfwGetJoystickHats)(int jid, int *count);
|
||||
const char *(*glfwGetJoystickName)(int jid);
|
||||
void *(*glfwGetJoystickUserPointer)(int jid);
|
||||
int (*glfwGetKey)(GLFWwindow *window, int key);
|
||||
const char *(*glfwGetKeyName)(int key, int scancode);
|
||||
int (*glfwGetKeyScancode)(int key);
|
||||
void (*glfwGetMonitorContentScale)(GLFWmonitor *monitor, float *xscale, float *yscale);
|
||||
const char *(*glfwGetMonitorName)(GLFWmonitor *monitor);
|
||||
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor *monitor, int *widthMM, int *heightMM);
|
||||
void (*glfwGetMonitorPos)(GLFWmonitor *monitor, int *xpos, int *ypos);
|
||||
GLFWmonitor **(*glfwGetMonitors)(int *count);
|
||||
void *(*glfwGetMonitorUserPointer)(GLFWmonitor *monitor);
|
||||
void (*glfwGetMonitorWorkarea)(GLFWmonitor *monitor, int *xpos, int *ypos, int *width,
|
||||
int *height);
|
||||
int (*glfwGetMouseButton)(GLFWwindow *window, int button);
|
||||
GLFWmonitor *(*glfwGetPrimaryMonitor)(void);
|
||||
GLFWglproc (*glfwGetProcAddress)(const char *procname);
|
||||
const char **(*glfwGetRequiredInstanceExtensions)(unsigned int *count);
|
||||
double (*glfwGetTime)(void);
|
||||
unsigned long long (*glfwGetTimerFrequency)(void);
|
||||
unsigned long long (*glfwGetTimerValue)(void);
|
||||
void (*glfwGetVersion)(int *major, int *minor, int *rev);
|
||||
const char *(*glfwGetVersionString)(void);
|
||||
const GLFWvidmode *(*glfwGetVideoMode)(GLFWmonitor *monitor);
|
||||
const GLFWvidmode *(*glfwGetVideoModes)(GLFWmonitor *monitor, int *count);
|
||||
int (*glfwGetWindowAttrib)(GLFWwindow *window, int attrib);
|
||||
void (*glfwGetWindowContentScale)(GLFWwindow *window, float *xscale, float *yscale);
|
||||
void (*glfwGetWindowFrameSize)(GLFWwindow *window, int *left, int *top, int *right,
|
||||
int *bottom);
|
||||
GLFWmonitor *(*glfwGetWindowMonitor)(GLFWwindow *window);
|
||||
float (*glfwGetWindowOpacity)(GLFWwindow *window);
|
||||
void (*glfwGetWindowPos)(GLFWwindow *window, int *xpos, int *ypos);
|
||||
void (*glfwGetWindowSize)(GLFWwindow *window, int *width, int *height);
|
||||
void *(*glfwGetWindowUserPointer)(GLFWwindow *window);
|
||||
void (*glfwHideWindow)(GLFWwindow *window);
|
||||
void (*glfwIconifyWindow)(GLFWwindow *window);
|
||||
int (*glfwInit)(void);
|
||||
void (*glfwInitHint)(int hint, int value);
|
||||
int (*glfwJoystickIsGamePad)(int jid);
|
||||
int (*glfwJoystickPresent)(int jid);
|
||||
void (*glfwMakeContextCurrent)(GLFWwindow *window);
|
||||
void (*glfwMaximizeWindow)(GLFWwindow *window);
|
||||
void (*glfwPollEvents)(void);
|
||||
void (*glfwPostEmptyEvent)(void);
|
||||
int (*glfwRawMouseMotionSupported)(void);
|
||||
void (*glfwRequestWindowAttention)(GLFWwindow *window);
|
||||
void (*glfwRestoreWindow)(GLFWwindow *window);
|
||||
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow *window, GLFWcharfun callback);
|
||||
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow *window, GLFWcharmodsfun callback);
|
||||
void (*glfwSetClipboardString)(GLFWwindow *window, const char *str);
|
||||
void (*glfwSetCursor)(GLFWwindow *window, GLFWcursor *cursor);
|
||||
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow *window,
|
||||
GLFWcursorenterfun callback);
|
||||
void (*glfwSetCursorPos)(GLFWwindow *window, double xpos, double ypos);
|
||||
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow *window, GLFWcursorposfun callback);
|
||||
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow *window, GLFWdropfun callback);
|
||||
GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback);
|
||||
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow *window,
|
||||
GLFWframebuffersizefun callback);
|
||||
void (*glfwSetGamma)(GLFWmonitor *monitor, float gamma);
|
||||
void (*glfwSetGammaRamp)(GLFWmonitor *monitor, const GLFWgammaramp *ramp);
|
||||
void (*glfwSetInputMode)(GLFWwindow *window, int mode, int value);
|
||||
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
|
||||
void (*glfwSetJoystickUserPointer)(int jid, void *pointer);
|
||||
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow *window, GLFWkeyfun callback);
|
||||
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
|
||||
void (*glfwSetMonitorUserPointer)(GLFWmonitor *monitor, void *pointer);
|
||||
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow *window,
|
||||
GLFWmousebuttonfun callback);
|
||||
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow *window, GLFWscrollfun callback);
|
||||
void (*glfwSetTime)(double time);
|
||||
void (*glfwSetWindowAspectRatio)(GLFWwindow *window, int numer, int denom);
|
||||
void (*glfwSetWindowAttrib)(GLFWwindow *window, int attrib, int value);
|
||||
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow *window,
|
||||
GLFWwindowclosefun callback);
|
||||
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(
|
||||
GLFWwindow *window, GLFWwindowcontentscalefun callback);
|
||||
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow *window,
|
||||
GLFWwindowfocusfun callback);
|
||||
void (*glfwSetWindowIcon)(GLFWwindow *window, int count, const GLFWimage *images);
|
||||
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow *window,
|
||||
GLFWwindowiconifyfun callback);
|
||||
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow *window,
|
||||
GLFWwindowmaximizefun callback);
|
||||
void (*glfwSetWindowMonitor)(GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos,
|
||||
int width, int height, int refreshRate);
|
||||
void (*glfwSetWindowOpacity)(GLFWwindow *window, float opacity);
|
||||
void (*glfwSetWindowPos)(GLFWwindow *window, int xpos, int ypos);
|
||||
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow *window, GLFWwindowposfun callback);
|
||||
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow *window,
|
||||
GLFWwindowrefreshfun callback);
|
||||
void (*glfwSetWindowShouldClose)(GLFWwindow *window, int value);
|
||||
void (*glfwSetWindowSize)(GLFWwindow *window, int width, int height);
|
||||
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow *window,
|
||||
GLFWwindowsizefun callback);
|
||||
void (*glfwSetWindowSizeLimits)(GLFWwindow *window, int minwidth, int minheight,
|
||||
int maxwidth, int maxheight);
|
||||
void (*glfwSetWindowTitle)(GLFWwindow *window, const char *title);
|
||||
void (*glfwSetWindowUserPointer)(GLFWwindow *window, void *pointer);
|
||||
void (*glfwShowWindow)(GLFWwindow *window);
|
||||
void (*glfwSwapBuffers)(GLFWwindow *window);
|
||||
void (*glfwSwapInterval)(int interval);
|
||||
void (*glfwTerminate)(void);
|
||||
int (*glfwUpdateGamePadMappings)(const char *str);
|
||||
int (*glfwVulkanSupported)(void);
|
||||
void (*glfwWaitEvents)(void);
|
||||
void (*glfwWaitEventsTimeout)(double timeout);
|
||||
void (*glfwWindowHint)(int hint, int value);
|
||||
void (*glfwWindowHintString)(int hint, const char *value);
|
||||
int (*glfwWindowShouldClose)(GLFWwindow *window);
|
||||
} GLFWFunctionTable;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,310 +1,310 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* The master copy of khrplatform.h is maintained in the Khronos EGL
|
||||
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
|
||||
* The last semantic modification to khrplatform.h was at commit ID:
|
||||
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by filing pull requests or issues on
|
||||
* the EGL Registry repository linked above.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
|
||||
#define KHRONOS_STATIC 1
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* 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
|
||||
* header compatible with static linking. */
|
||||
#define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
#define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined(__SYMBIAN32__)
|
||||
#define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
#define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
#define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
#define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
#define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined(__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#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
|
||||
/*
|
||||
* 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.
|
||||
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
|
||||
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
|
||||
* unsigned long long or similar (this results in different C++ name mangling).
|
||||
* To avoid changes for existing platforms, we restrict usage of intptr_t to
|
||||
* platforms where the size of a pointer is larger than the size of long.
|
||||
*/
|
||||
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
|
||||
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
|
||||
#define KHRONOS_USE_INTPTR_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#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
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
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;
|
||||
#else
|
||||
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
|
||||
|
||||
#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
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
#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;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* 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;
|
||||
#elif defined(_WIN64)
|
||||
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;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
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;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 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;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* 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_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* The master copy of khrplatform.h is maintained in the Khronos EGL
|
||||
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
|
||||
* The last semantic modification to khrplatform.h was at commit ID:
|
||||
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by filing pull requests or issues on
|
||||
* the EGL Registry repository linked above.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
|
||||
#define KHRONOS_STATIC 1
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* 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
|
||||
* header compatible with static linking. */
|
||||
#define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
#define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined(__SYMBIAN32__)
|
||||
#define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
#define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
#define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
#define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
#define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined(__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#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
|
||||
/*
|
||||
* 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.
|
||||
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
|
||||
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
|
||||
* unsigned long long or similar (this results in different C++ name mangling).
|
||||
* To avoid changes for existing platforms, we restrict usage of intptr_t to
|
||||
* platforms where the size of a pointer is larger than the size of long.
|
||||
*/
|
||||
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
|
||||
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
|
||||
#define KHRONOS_USE_INTPTR_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#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
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
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;
|
||||
#else
|
||||
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
|
||||
|
||||
#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
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
#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;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* 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;
|
||||
#elif defined(_WIN64)
|
||||
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;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
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;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 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;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* 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_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
|
||||
#ifndef SN_INTERNAL
|
||||
#define SN_INTERNAL
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define UNSAFE_AS(type, expr) *(type *)&(expr)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define SN_DECL __cdecl
|
||||
#define SN_MAT_DECL __cdecl __forceinline
|
||||
#define SN_API __declspec(dllexport)
|
||||
#define FORCEINLINE __forceinline
|
||||
#include <windows.h>
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
#define SN_DECL __attribute__((cdecl))
|
||||
#define SN_MAT_DECL __attribute__((cdecl)) __attribute__((always_inline))
|
||||
#define SN_API __attribute__((dllexport))
|
||||
#define FORCEINLINE __attribute__((always_inline))
|
||||
#else
|
||||
#define SN_API
|
||||
#define SN_DECL
|
||||
#define SN_MAT_DECL
|
||||
#define FORCEINLINE
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define SN_ALIGNAS(n) __declspec(align(n))
|
||||
#else
|
||||
#define SN_ALIGNAS(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#define SN_APIDEF
|
||||
|
||||
#define PRIVATE static
|
||||
#define INTERNAL extern
|
||||
|
||||
#endif //
|
||||
|
||||
#ifndef SN_INTERNAL
|
||||
#define SN_INTERNAL
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define UNSAFE_AS(type, expr) *(type *)&(expr)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define SN_DECL __cdecl
|
||||
#define SN_MAT_DECL __cdecl __forceinline
|
||||
#define SN_API __declspec(dllexport)
|
||||
#define FORCEINLINE __forceinline
|
||||
#include <windows.h>
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
#define SN_DECL __attribute__((cdecl))
|
||||
#define SN_MAT_DECL __attribute__((cdecl)) __attribute__((always_inline))
|
||||
#define SN_API __attribute__((dllexport))
|
||||
#define FORCEINLINE __attribute__((always_inline))
|
||||
#else
|
||||
#define SN_API
|
||||
#define SN_DECL
|
||||
#define SN_MAT_DECL
|
||||
#define FORCEINLINE
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define SN_ALIGNAS(n) __declspec(align(n))
|
||||
#else
|
||||
#define SN_ALIGNAS(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#define SN_APIDEF
|
||||
|
||||
#define PRIVATE static
|
||||
#define INTERNAL extern
|
||||
|
||||
#endif //
|
||||
|
||||
@@ -1,123 +1,123 @@
|
||||
#ifndef SSC_INTRIN
|
||||
#define SSC_INTRIN
|
||||
|
||||
#define SSC_INTRIN_HEAD
|
||||
|
||||
#include "StgSharpNative.h"
|
||||
#include "sn_intrinsic.matkernel.h"
|
||||
#include <immintrin.h>
|
||||
#include <smmintrin.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#include <isa_availability.h>
|
||||
#endif
|
||||
|
||||
#define LASTTWO(x) (x & 3)
|
||||
#define LAST(x) (x & 3)
|
||||
#define get_align_begin(x) ((x + 15) & (~15))
|
||||
|
||||
#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)))
|
||||
#define BIT_CVRT(pack, index, T) *(T *)(pack->data + index)
|
||||
#define zero_vec _mm_setzero_ps()
|
||||
#define zero_vec_256 _mm256_setzero_ps()
|
||||
|
||||
#define SPAN(T) \
|
||||
struct SPAN_T { \
|
||||
T *pointer; \
|
||||
size_t length; \
|
||||
};
|
||||
|
||||
typedef union uint64_u {
|
||||
uint64_t u64;
|
||||
uint32_t u32[2];
|
||||
} uint64_u;
|
||||
|
||||
typedef struct mat_kernel mat_kernel;
|
||||
|
||||
typedef struct mat_panel mat_panel;
|
||||
|
||||
typedef union scalar_pack {
|
||||
uint64_t data[8];
|
||||
} scalar_pack;
|
||||
|
||||
/* Mirrors StgSharp.Mathematics.Numeric.MatrixParallelTaskPackage<T> (128 bytes). */
|
||||
#define MAT_TASK(T) \
|
||||
struct { \
|
||||
MAT_KERNEL(T) * mat_0; /* Offset 0: 1st matrix kernel base */ \
|
||||
MAT_KERNEL(T) * mat_1; /* Offset 8: 2nd matrix kernel base */ \
|
||||
MAT_KERNEL(T) * mat_2; /* Offset 16: 3rd matrix kernel base */ \
|
||||
void *scalar; /* Offset 24: scalar pack */ \
|
||||
int32_t x; /* Offset 32: row index of the result tile */ \
|
||||
int32_t y; /* Offset 36: column index of the result tile */ \
|
||||
int32_t z; /* Offset 40: column index of the result tile */ \
|
||||
int32_t common_x; /* Offset 44: row index of the result tile */ \
|
||||
int32_t common_y; /* Offset 48: column index of the result tile */ \
|
||||
int32_t common_z; /* Offset 52: column index of the result tile */ \
|
||||
uint32_t mask; /* Offset 56: mask for task schedualing, not useful in C side */ \
|
||||
uint32_t reverse; /* Offset 60: reserved for future use */ \
|
||||
scalar_pack padding; /* Offset 64: padding to make the struct size 128 bytes */ \
|
||||
}
|
||||
typedef struct matrix_task matrix_task;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
static_assert(sizeof(matrix_task) == 128, "matrix_parallel_task_package size mismatch");
|
||||
#elif defined(__STDC_VERSION__)
|
||||
static_assert(sizeof(MAT_TASK(float)) == 128, "matrix_parallel_task_package size mismatch");
|
||||
#endif
|
||||
|
||||
typedef void(SN_DECL *UNI_MK_PROC)(matrix_task *task);
|
||||
typedef void(SN_DECL *UNI_SK_PROC)(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *restrict ans, uint64_t scalar);
|
||||
|
||||
typedef void(SN_DECL *VECTORNORMALIZEPROC)(__m128 *source, __m128 *target);
|
||||
typedef void(SN_DECL *DOTPROC)(void *transpose, __m128 *vector, __m128 *ans);
|
||||
typedef uint64_t(SN_DECL *FACTORIALROC)(int n);
|
||||
|
||||
#pragma region string
|
||||
|
||||
typedef int(SN_DECL *HASH)(byte const *str, int length);
|
||||
typedef int(SN_DECL *INDEX_PAIR)(short const *stram, uint32_t target, int length);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
typedef struct mat_mk_intrinsic {
|
||||
UNI_MK_PROC add;
|
||||
UNI_MK_PROC fill;
|
||||
UNI_MK_PROC scalar_mul;
|
||||
UNI_MK_PROC sub;
|
||||
UNI_MK_PROC transpose;
|
||||
UNI_MK_PROC fma;
|
||||
UNI_MK_PROC pivot;
|
||||
} mat_mk_intrinsic;
|
||||
|
||||
typedef struct mat_sk_intrinsic {
|
||||
UNI_SK_PROC add;
|
||||
UNI_SK_PROC fill;
|
||||
UNI_SK_PROC scalar_mul;
|
||||
UNI_SK_PROC sub;
|
||||
UNI_SK_PROC transpose;
|
||||
UNI_SK_PROC fma;
|
||||
UNI_SK_PROC pivot;
|
||||
} mat_sk_intrinsic;
|
||||
|
||||
// Mirrors C# IntrinsicContext field order so managed/unmanaged layouts stay in sync.
|
||||
typedef struct sn_intrinsic {
|
||||
HASH city_hash_simplify;
|
||||
FACTORIALROC factorial_simd;
|
||||
VECTORNORMALIZEPROC vec_f32_normalize_3;
|
||||
mat_mk_intrinsic mat_mk[0x0a];
|
||||
mat_sk_intrinsic mat_sk[0x0a];
|
||||
} sn_intrinsic;
|
||||
|
||||
typedef enum elment_mask { F32 = 0, F64 = 1, I32 = 2, I64 = 3 } element_mask;
|
||||
|
||||
#include "sn_target.h"
|
||||
|
||||
#endif
|
||||
#ifndef SSC_INTRIN
|
||||
#define SSC_INTRIN
|
||||
|
||||
#define SSC_INTRIN_HEAD
|
||||
|
||||
#include "StgSharpNative.h"
|
||||
#include "sn_intrinsic.matkernel.h"
|
||||
#include <immintrin.h>
|
||||
#include <smmintrin.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#include <isa_availability.h>
|
||||
#endif
|
||||
|
||||
#define LASTTWO(x) (x & 3)
|
||||
#define LAST(x) (x & 3)
|
||||
#define get_align_begin(x) ((x + 15) & (~15))
|
||||
|
||||
#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)))
|
||||
#define BIT_CVRT(pack, index, T) *(T *)(pack->data + index)
|
||||
#define zero_vec _mm_setzero_ps()
|
||||
#define zero_vec_256 _mm256_setzero_ps()
|
||||
|
||||
#define SPAN(T) \
|
||||
struct SPAN_T { \
|
||||
T *pointer; \
|
||||
size_t length; \
|
||||
};
|
||||
|
||||
typedef union uint64_u {
|
||||
uint64_t u64;
|
||||
uint32_t u32[2];
|
||||
} uint64_u;
|
||||
|
||||
typedef struct mat_kernel mat_kernel;
|
||||
|
||||
typedef struct mat_panel mat_panel;
|
||||
|
||||
typedef union scalar_pack {
|
||||
uint64_t data[8];
|
||||
} scalar_pack;
|
||||
|
||||
/* Mirrors StgSharp.Mathematics.Numeric.MatrixParallelTaskPackage<T> (128 bytes). */
|
||||
#define MAT_TASK(T) \
|
||||
struct { \
|
||||
MAT_KERNEL(T) * mat_0; /* Offset 0: 1st matrix kernel base */ \
|
||||
MAT_KERNEL(T) * mat_1; /* Offset 8: 2nd matrix kernel base */ \
|
||||
MAT_KERNEL(T) * mat_2; /* Offset 16: 3rd matrix kernel base */ \
|
||||
void *scalar; /* Offset 24: scalar pack */ \
|
||||
int32_t x; /* Offset 32: row index of the result tile */ \
|
||||
int32_t y; /* Offset 36: column index of the result tile */ \
|
||||
int32_t z; /* Offset 40: column index of the result tile */ \
|
||||
int32_t common_x; /* Offset 44: row index of the result tile */ \
|
||||
int32_t common_y; /* Offset 48: column index of the result tile */ \
|
||||
int32_t common_z; /* Offset 52: column index of the result tile */ \
|
||||
uint32_t mask; /* Offset 56: mask for task schedualing, not useful in C side */ \
|
||||
uint32_t reverse; /* Offset 60: reserved for future use */ \
|
||||
scalar_pack padding; /* Offset 64: padding to make the struct size 128 bytes */ \
|
||||
}
|
||||
typedef struct matrix_task matrix_task;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
static_assert(sizeof(matrix_task) == 128, "matrix_parallel_task_package size mismatch");
|
||||
#elif defined(__STDC_VERSION__)
|
||||
static_assert(sizeof(MAT_TASK(float)) == 128, "matrix_parallel_task_package size mismatch");
|
||||
#endif
|
||||
|
||||
typedef void(SN_DECL *UNI_MK_PROC)(matrix_task *task);
|
||||
typedef void(SN_DECL *UNI_SK_PROC)(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *restrict ans, uint64_t scalar);
|
||||
|
||||
typedef void(SN_DECL *VECTORNORMALIZEPROC)(__m128 *source, __m128 *target);
|
||||
typedef void(SN_DECL *DOTPROC)(void *transpose, __m128 *vector, __m128 *ans);
|
||||
typedef uint64_t(SN_DECL *FACTORIALROC)(int n);
|
||||
|
||||
#pragma region string
|
||||
|
||||
typedef int(SN_DECL *HASH)(byte const *str, int length);
|
||||
typedef int(SN_DECL *INDEX_PAIR)(short const *stram, uint32_t target, int length);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
typedef struct mat_mk_intrinsic {
|
||||
UNI_MK_PROC add;
|
||||
UNI_MK_PROC fill;
|
||||
UNI_MK_PROC scalar_mul;
|
||||
UNI_MK_PROC sub;
|
||||
UNI_MK_PROC transpose;
|
||||
UNI_MK_PROC fma;
|
||||
UNI_MK_PROC pivot;
|
||||
} mat_mk_intrinsic;
|
||||
|
||||
typedef struct mat_sk_intrinsic {
|
||||
UNI_SK_PROC add;
|
||||
UNI_SK_PROC fill;
|
||||
UNI_SK_PROC scalar_mul;
|
||||
UNI_SK_PROC sub;
|
||||
UNI_SK_PROC transpose;
|
||||
UNI_SK_PROC fma;
|
||||
UNI_SK_PROC pivot;
|
||||
} mat_sk_intrinsic;
|
||||
|
||||
// Mirrors C# IntrinsicContext field order so managed/unmanaged layouts stay in sync.
|
||||
typedef struct sn_intrinsic {
|
||||
HASH city_hash_simplify;
|
||||
FACTORIALROC factorial_simd;
|
||||
VECTORNORMALIZEPROC vec_f32_normalize_3;
|
||||
mat_mk_intrinsic mat_mk[0x0a];
|
||||
mat_sk_intrinsic mat_sk[0x0a];
|
||||
} sn_intrinsic;
|
||||
|
||||
typedef enum elment_mask { F32 = 0, F64 = 1, I32 = 2, I64 = 3 } element_mask;
|
||||
|
||||
#include "sn_target.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,84 +1,84 @@
|
||||
#ifndef SN_TARGET
|
||||
#define SN_TARGET
|
||||
|
||||
#include "sn_internal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define SN_OS_WINDOWS 0
|
||||
#define SN_OS_LINUX 1
|
||||
#define SN_OS_MACOS 2
|
||||
#define SN_OS_IOS 3
|
||||
#define SN_OS_ANDROID 4
|
||||
#define SN_OS_UNKNOWN 5
|
||||
|
||||
#define SN_ARCH_X86_64 0
|
||||
#define SN_ARCH_ARM64 1
|
||||
#define SN_ARCH_RISCV64 2
|
||||
#define SN_ARCH_PPC64le 3
|
||||
|
||||
#if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) || defined(__amd64__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_X86_64
|
||||
|
||||
#elif defined(_M_ARM64) || defined(__aarch64__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_ARM64
|
||||
|
||||
#elif defined(_M_ARM) || defined(__arm__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_ARM32
|
||||
|
||||
#elif defined(_M_IX86) || defined(__i386__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_X86_32
|
||||
|
||||
#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_PPC64LE
|
||||
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_RISCV64
|
||||
|
||||
#else
|
||||
#error "SN: Unsupported target architecture"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Target selection policy:
|
||||
* - Default (no SN_EXTERN_TARGET): fixed Windows + x86_64.
|
||||
* - External (SN_EXTERN_TARGET): build system must provide SN_OS and SN_ARCH.
|
||||
*/
|
||||
#ifndef SN_EXTERN_TARGET
|
||||
|
||||
#define SN_OS_TARGET SN_OS_WINDOWS
|
||||
#define SN_ARCH_TARGET SN_ARCH_X86_64
|
||||
|
||||
#else
|
||||
|
||||
#ifndef SN_OS_TARGET
|
||||
#error "SN_EXTERN_TARGET is defined but SN_OS is not provided."
|
||||
#endif
|
||||
|
||||
#ifndef SN_ARCH_TARGET
|
||||
#error "SN_EXTERN_TARGET is defined but SN_ARCH is not provided."
|
||||
#endif
|
||||
|
||||
/* Validate externally supplied values are within known enum constants. */
|
||||
#if (SN_OS_TARGET != SN_OS_WINDOWS) && (SN_OS_TARGET != SN_OS_LINUX) && \
|
||||
(SN_OS_TARGET != SN_OS_MACOS) && (SN_OS_TARGET != SN_OS_IOS) && \
|
||||
(SN_OS_TARGET != SN_OS_ANDROID) && (SN_OS_TARGET != SN_OS_UNKNOWN)
|
||||
#error "SN_OS has an invalid value. Use SN_OS_<...> enum constants."
|
||||
#endif
|
||||
|
||||
#if (SN_ARCH_TARGET != SN_ARCH_X86_64) && (SN_ARCH_TARGET != SN_ARCH_ARM64) && \
|
||||
(SN_ARCH_TARGET != SN_ARCH_RISCV64) && (SN_ARCH_TARGET != SN_ARCH_PPC64le)
|
||||
#error "SN_ARCH has an invalid value. Use SN_ARCH_<...> enum constants."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define SN_IS_OS(os) ((SN_OS_TARGET) == (os))
|
||||
|
||||
#define SN_IS_ARCH(arch) ((SN_ARCH_TARGET) == (arch))
|
||||
|
||||
typedef union SIMDID {
|
||||
uint64_t mask;
|
||||
char make_byte[8];
|
||||
} SIMDID;
|
||||
|
||||
#endif // SN_TARGET
|
||||
#ifndef SN_TARGET
|
||||
#define SN_TARGET
|
||||
|
||||
#include "sn_internal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define SN_OS_WINDOWS 0
|
||||
#define SN_OS_LINUX 1
|
||||
#define SN_OS_MACOS 2
|
||||
#define SN_OS_IOS 3
|
||||
#define SN_OS_ANDROID 4
|
||||
#define SN_OS_UNKNOWN 5
|
||||
|
||||
#define SN_ARCH_X86_64 0
|
||||
#define SN_ARCH_ARM64 1
|
||||
#define SN_ARCH_RISCV64 2
|
||||
#define SN_ARCH_PPC64le 3
|
||||
|
||||
#if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) || defined(__amd64__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_X86_64
|
||||
|
||||
#elif defined(_M_ARM64) || defined(__aarch64__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_ARM64
|
||||
|
||||
#elif defined(_M_ARM) || defined(__arm__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_ARM32
|
||||
|
||||
#elif defined(_M_IX86) || defined(__i386__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_X86_32
|
||||
|
||||
#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_PPC64LE
|
||||
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#define SN_CURRENT_ARCH SN_ARCH_RISCV64
|
||||
|
||||
#else
|
||||
#error "SN: Unsupported target architecture"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Target selection policy:
|
||||
* - Default (no SN_EXTERN_TARGET): fixed Windows + x86_64.
|
||||
* - External (SN_EXTERN_TARGET): build system must provide SN_OS and SN_ARCH.
|
||||
*/
|
||||
#ifndef SN_EXTERN_TARGET
|
||||
|
||||
#define SN_OS_TARGET SN_OS_WINDOWS
|
||||
#define SN_ARCH_TARGET SN_ARCH_X86_64
|
||||
|
||||
#else
|
||||
|
||||
#ifndef SN_OS_TARGET
|
||||
#error "SN_EXTERN_TARGET is defined but SN_OS is not provided."
|
||||
#endif
|
||||
|
||||
#ifndef SN_ARCH_TARGET
|
||||
#error "SN_EXTERN_TARGET is defined but SN_ARCH is not provided."
|
||||
#endif
|
||||
|
||||
/* Validate externally supplied values are within known enum constants. */
|
||||
#if (SN_OS_TARGET != SN_OS_WINDOWS) && (SN_OS_TARGET != SN_OS_LINUX) && \
|
||||
(SN_OS_TARGET != SN_OS_MACOS) && (SN_OS_TARGET != SN_OS_IOS) && \
|
||||
(SN_OS_TARGET != SN_OS_ANDROID) && (SN_OS_TARGET != SN_OS_UNKNOWN)
|
||||
#error "SN_OS has an invalid value. Use SN_OS_<...> enum constants."
|
||||
#endif
|
||||
|
||||
#if (SN_ARCH_TARGET != SN_ARCH_X86_64) && (SN_ARCH_TARGET != SN_ARCH_ARM64) && \
|
||||
(SN_ARCH_TARGET != SN_ARCH_RISCV64) && (SN_ARCH_TARGET != SN_ARCH_PPC64le)
|
||||
#error "SN_ARCH has an invalid value. Use SN_ARCH_<...> enum constants."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define SN_IS_OS(os) ((SN_OS_TARGET) == (os))
|
||||
|
||||
#define SN_IS_ARCH(arch) ((SN_ARCH_TARGET) == (arch))
|
||||
|
||||
typedef union SIMDID {
|
||||
uint64_t mask;
|
||||
char make_byte[8];
|
||||
} SIMDID;
|
||||
|
||||
#endif // SN_TARGET
|
||||
|
||||
+1076
-1076
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user