daily update on 20230730 by nitload youmu, 5th day of params displacement
This commit is contained in:
@@ -1,46 +1,81 @@
|
||||
#include "GLenv/include/glad/glad.h"
|
||||
#include "GLenv/include/GLFW/glfw3.h"
|
||||
#include "StgSharpGraphic.h"
|
||||
#include "SSGinternal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdalign.h>
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
|
||||
STGSHARPGRAPHIC_API float* InitBigM128Map(int floatCount)
|
||||
|
||||
STGSHARPGRAPHIC_API __m128* InitM128(float x, float y, float z, float w)
|
||||
{
|
||||
float* BigMapBeginPtr = malloc(floatCount*sizeof(float));
|
||||
return BigMapBeginPtr;
|
||||
__m128* Ptr = _aligned_malloc(16, sizeof(__m128));
|
||||
|
||||
if (NULL==Ptr)
|
||||
{
|
||||
return (__m128*) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ptr->m128_f32[0] = x;
|
||||
Ptr->m128_f32[1] = y;
|
||||
Ptr->m128_f32[2] = z;
|
||||
Ptr->m128_f32[3] = w;
|
||||
return Ptr;
|
||||
}
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API void DeinitBigM128Map(float* mapPtr)
|
||||
STGSHARPGRAPHIC_API void DeinitM128(__m128* m128Ptr)
|
||||
{
|
||||
free(mapPtr);
|
||||
free(m128Ptr);
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API __m128 VecAddVec(__m128 vec1, __m128 vec2)
|
||||
STGSHARPGRAPHIC_API void __stdcall VecAddVec(__m128* ptr1,__m128* ptr2, __m128* ret)
|
||||
{
|
||||
printf("%llu\n",(uint64_t)ptr1);
|
||||
printf("%llu\n",(uint64_t)ptr2);
|
||||
printf("%llu\n",(uint64_t)ret);
|
||||
|
||||
return _mm_add_ps(vec1, vec2);
|
||||
printf("%f\t%f\t%f\t%f\t\n",
|
||||
ptr1->m128_f32[0], ptr1->m128_f32[1], ptr1->m128_f32[2], ptr1->m128_f32[3]
|
||||
);
|
||||
printf("%f\t%f\t%f\t%f\t\n",
|
||||
ptr2->m128_f32[0], ptr2->m128_f32[1], ptr2->m128_f32[2], ptr2->m128_f32[3]
|
||||
);
|
||||
|
||||
*ret = _mm_add_ps(*ptr1, *ptr2);
|
||||
|
||||
printf("%f\t%f\t%f\t%f\t\n",
|
||||
ret->m128_f32[0], ret->m128_f32[1], ret->m128_f32[2], ret->m128_f32[3]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API __m128 VecSubVec(__m128 vec1, __m128 vec2)
|
||||
STGSHARPGRAPHIC_API void VecSubVec(__m128* ptr1, __m128* ptr2, __m128* ret)
|
||||
{
|
||||
printf("%llu\n", (uint64_t)ptr1);
|
||||
printf("%llu\n", (uint64_t)ptr2);
|
||||
printf("%llu\n", (uint64_t)ret);
|
||||
|
||||
printf("%f\t%f\t%f\t%f\t\n",
|
||||
ptr1->m128_f32[0], ptr1->m128_f32[1], ptr1->m128_f32[2], ptr1->m128_f32[3]
|
||||
);
|
||||
printf("%f\t%f\t%f\t%f\t\n",
|
||||
ptr2->m128_f32[0], ptr2->m128_f32[1], ptr2->m128_f32[2], ptr2->m128_f32[3]
|
||||
);
|
||||
|
||||
|
||||
*ret = _mm_sub_ps(*ptr1, *ptr2);
|
||||
|
||||
printf("%f\t%f\t%f\t%f\t\n",
|
||||
ret->m128_f32[0], ret->m128_f32[1], ret->m128_f32[2], ret->m128_f32[3]
|
||||
);
|
||||
|
||||
return _mm_sub_ps(vec1, vec2);
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API float VecMulVec(__m128 vec1, __m128 vec2)
|
||||
STGSHARPGRAPHIC_API void VecMulVec(__m128* ptr1, __m128* ptr2, __m128* ret)
|
||||
{
|
||||
__m128 cache = _mm_mul_ps(vec1, vec2);
|
||||
|
||||
float ret = cache.m128_f32[0] +
|
||||
cache.m128_f32[1] +
|
||||
cache.m128_f32[2] +
|
||||
cache.m128_f32[3];
|
||||
|
||||
return ret;
|
||||
*ret = _mm_mul_ps(*ptr1, *ptr2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user