daily update on 20230822 by nitload youmu
This commit is contained in:
@@ -12,15 +12,60 @@
|
||||
|
||||
#include "GLenv/include/glad/glad.h"
|
||||
#include "GLenv/include/GLFW/glfw3.h"
|
||||
#include "SSGinternal.h"
|
||||
#include <immintrin.h>
|
||||
|
||||
#pragma region Internal
|
||||
|
||||
extern __m128* defaultVecPtr;
|
||||
#define ALIGN(simdVec) _mm_loadu_ps((float*)&simdVec)
|
||||
|
||||
typedef struct glIOPack
|
||||
{
|
||||
//these are gl functions used to create a new window
|
||||
GLFWwindow* (*createWindow)(
|
||||
int width,
|
||||
int height,
|
||||
const char* title,
|
||||
GLFWmonitor* monitor,
|
||||
GLFWwindow* share);
|
||||
void(*makeContextCurrent)(GLFWwindow* window);
|
||||
void(*swapInterval)(int interval);
|
||||
void(*clearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
int(*windowShouldClose)(GLFWwindow* window);
|
||||
void(*swapBuffer)(GLFWwindow* window);
|
||||
|
||||
|
||||
//these are gl functions used to set a callback
|
||||
|
||||
GLFWframebuffersizefun(*SetFramebufferSizeCallback)
|
||||
(GLFWwindow* window, GLFWframebuffersizefun callback);
|
||||
|
||||
}glIOpackage;
|
||||
typedef struct sse_matmap
|
||||
{
|
||||
__m128* c0ptr;
|
||||
__m128* c1ptr;
|
||||
__m128* c2ptr;
|
||||
__m128* c3ptr;
|
||||
}sse_matmap;
|
||||
|
||||
glIOpackage pack;
|
||||
|
||||
SSGC_API _inline float __cdecl mulps_sum_internal(__m128 left, __m128 right);
|
||||
SSGC_API _inline float __cdecl mulps_total_internal(__m128 vec);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SSGC_API glIOpackage loadGLApi(void);
|
||||
SSGC_API void initGL(void);
|
||||
SSGC_API int initGLAD(void);
|
||||
|
||||
|
||||
|
||||
//linear related function
|
||||
|
||||
SSGC_API __m128* __cdecl load(float x, float y, float z, float w);
|
||||
SSGC_API __m128* __cdecl load_cpy(__m128* ptr);
|
||||
@@ -28,19 +73,96 @@ SSGC_API __m128* __cdecl addps(__m128* ptr1, __m128* ptr2);
|
||||
SSGC_API __m128* __cdecl subps(__m128* ptr1, __m128* ptr2);
|
||||
SSGC_API __m128* __cdecl mulps_const(__m128* ptr, float value);
|
||||
SSGC_API __m128* __cdecl mulps(__m128* ptr1, __m128* ptr2);
|
||||
SSGC_API float __cdecl mulps_sum(__m128* ptr1, __m128* ptr2);
|
||||
SSGC_API _inline float __cdecl mulps_sum(__m128* ptr1, __m128* ptr2);
|
||||
SSGC_API __m128* __cdecl divps_const(__m128* ptr, float value);
|
||||
SSGC_API __m128* __cdecl divps(__m128* ptr1, __m128* ptr2);
|
||||
SSGC_API float __cdecl sqrtss_const(float a);
|
||||
|
||||
|
||||
SSGC_API __m128* __cdecl set_m128ptr_default();
|
||||
SSGC_API sse_matmap* __cdecl transpose_ssemat_2(sse_matmap* matPtr);
|
||||
SSGC_API sse_matmap* __cdecl transpose_ssemat_3(sse_matmap* matPtr);
|
||||
|
||||
|
||||
|
||||
|
||||
SSGC_API void __cdecl deinitM128(__m128* ptr);
|
||||
SSGC_API void __cdecl deinit_matmap_sse(sse_matmap* mapptr);
|
||||
|
||||
|
||||
#pragma region mat define
|
||||
|
||||
typedef union matrix2map
|
||||
{
|
||||
__m128 colum[2];
|
||||
float m[4][2];
|
||||
}matrix2map;
|
||||
|
||||
typedef struct matrix3map
|
||||
{
|
||||
__m128 colum[3];
|
||||
float m[4][3];
|
||||
};
|
||||
|
||||
typedef union matrix4map {
|
||||
__m128 colum[4];
|
||||
float m[4][4];
|
||||
}matrix4map;
|
||||
|
||||
typedef struct matrix4 {
|
||||
matrix4map matrix;
|
||||
matrix4map transpose;
|
||||
}matrix4;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma region mat2
|
||||
|
||||
SSGC_API __inline matrix2map* __cdecl add_mat2(matrix2map* mat1, matrix2map* mat2);
|
||||
SSGC_API __inline matrix2map* __cdecl sub_mat2(matrix2map* mat1, matrix2map* mat2);
|
||||
|
||||
SSGC_API __inline void __cdecl transmpose2to4(matrix2map* source, matrix4map* target);
|
||||
|
||||
SSGC_API _inline void __cdecl deinit_mat2(matrix2map* mat);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region mat3
|
||||
|
||||
SSGC_API __inline float det_mat3_internal(__m128 const c1, __m128 const c2, __m128 const c3);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma region mat4
|
||||
//type and function for 4 colum matrix
|
||||
|
||||
SSGC_API __inline matrix4map* __cdecl add_mat4(matrix4map* mat1, matrix4map* mat2);
|
||||
SSGC_API __inline matrix4map* __cdecl sub_mat4(matrix4map* mat1, matrix4map* mat2);
|
||||
SSGC_API __inline matrix4map* __cdecl mul_const(matrix4map* mat, float value);
|
||||
SSGC_API __inline matrix4* __cdecl mul_4_4(matrix4map* left, matrix4map* right);
|
||||
|
||||
SSGC_API __inline void __cdecl transpose4to2(matrix4map* source, matrix4map* target);
|
||||
SSGC_API __inline void __cdecl transpose4to4(matrix4map* matrix, matrix4map* target);
|
||||
|
||||
SSGC_API __inline float __cdecl det_mat4(matrix4* matPtr);
|
||||
|
||||
SSGC_API __inline void __cdecl deinit_mat4(matrix4map* matPtr);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // !SSG
|
||||
|
||||
|
||||
Reference in New Issue
Block a user