Daily update on 20230803 by nitload youmu, problem of parameter displacement solved, rewriting other linear math

This commit is contained in:
Nitload
2023-08-03 22:46:16 +08:00
parent 194d65edf6
commit aae7e0292c
105 changed files with 13858 additions and 11394 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -6,9 +6,9 @@ namespace StgSharp
public static unsafe partial class Geometry
{
public static unsafe Triangle InitTriagnle<T>(
vec3d vertex1,
vec3d vertex2,
vec3d vertex3
Vec3d vertex1,
Vec3d vertex2,
Vec3d vertex3
) where T : Triangle
{
Triangle t = new Triangle();
@@ -18,11 +18,11 @@ namespace StgSharp.Geometries
public override Point RefPoint03 => endPoint;
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
public virtual Vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
public virtual vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
public virtual Vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
public virtual Vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
internal override void OnRender(uint tick)
{
@@ -19,11 +19,11 @@ namespace StgSharp.Geometries
public override Point RefPoint03 => pointOnPlain;
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
public virtual Vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
public virtual vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
public virtual Vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
public virtual vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
public virtual Vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
public override Plain GetPlain()
{
@@ -7,13 +7,13 @@ namespace StgSharp.Geometries
/// </summary>
/// <param name="tick"></param>
/// <returns>表示位移量的三维矢量</returns>
public delegate vec3d GetLocationHandler(uint tick);
public delegate Vec3d GetLocationHandler(uint tick);
public static unsafe class GeometryOperation
{
public static vec3d DefualtMotion(uint tick)
public static Vec3d DefualtMotion(uint tick)
{
return default(vec3d);
return default(Vec3d);
}
}
@@ -24,11 +24,11 @@ namespace StgSharp.Geometries
public Line() { }
//计算线起点的方法,通过对线的派生的重写实现功能
public virtual vec3d MoveBeginPoint(uint tick)
public virtual Vec3d MoveBeginPoint(uint tick)
=> movBegin.Invoke(tick);
//计算线重点的方法,通过对线的派生的重写实现功能
public virtual vec3d MoveEndPoint(uint tick)
public virtual Vec3d MoveEndPoint(uint tick)
=> movEnd.Invoke(tick);
internal override void OnRender(uint tick)
@@ -17,7 +17,7 @@ namespace StgSharp.Geometries
public GetLocationHandler MovVertex01Operation { get { return movVertex01Operation; } }
public GetLocationHandler MovVertex02Operation { get { return movVertex02Operation; } }
public virtual vec3d MovCenter(uint tick)
public virtual Vec3d MovCenter(uint tick)
{
return movCenterOperation.Invoke(tick);
}
@@ -28,12 +28,12 @@ namespace StgSharp.Geometries
/// <param name="tick">当前游戏刻</param>
/// <returns></returns>
/// <exception cref="UnusedVertexException">几何体过定义</exception>
public sealed override vec3d MovVertex03(uint tick)
public sealed override Vec3d MovVertex03(uint tick)
{
throw new UnusedVertexException();
}
public sealed override vec3d MovVertex04(uint tick)
public sealed override Vec3d MovVertex04(uint tick)
{
throw new UnusedVertexException();
}
@@ -4,14 +4,14 @@ namespace StgSharp.Geometries
{
public unsafe class Plain
{
internal vec3d origin;
internal vec3d vec1;
internal vec3d vec2;
internal Vec3d origin;
internal Vec3d vec1;
internal Vec3d vec2;
internal vec3d plainParameter;
internal Vec3d plainParameter;
internal readonly float d = -1;
public Plain(vec3d o, vec3d v1, vec3d v2)
public Plain(Vec3d o, Vec3d v1, Vec3d v2)
{
this.origin = o;
this.vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
@@ -30,9 +30,9 @@ namespace StgSharp.Geometries
public Plain(Point p1, Point p2, Point p3)
{
vec3d origin = p1.Position;
vec3d v1 = p2.Position - origin;
vec3d v2 = p3.Position - origin;
Vec3d origin = p1.Position;
Vec3d v1 = p2.Position - origin;
Vec3d v2 = p3.Position - origin;
vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
@@ -1,54 +1,47 @@
using StgSharp.Math;
using System;
using System.Runtime.InteropServices;
using System.Threading;
namespace StgSharp.Geometries
{
public unsafe class Point
{
internal vec3d* positionPtr;
internal Vec3d position;
internal readonly bool isVertex;
internal Point(vec3d* ptr)
internal Point(Vec3d p)
{
positionPtr = ptr;
position = p;
}
public Point()
{
IntPtr ptr = Marshal.AllocHGlobal(sizeof(vec3d));
positionPtr = (vec3d*)ptr.ToPointer();
}
public vec3d Position
public Vec3d Position
{
get { return *positionPtr; }
set { *positionPtr = value; }
}
public vec3d* PositionPtr
{
get { return positionPtr; }
set { positionPtr = value; }
get { return position; }
set { position = value; }
}
public float X
{
get { return (*this.positionPtr).X; }
set { (*this.positionPtr).X = value; }
get { return position.X; }
set { position.X = value; }
}
public float Y
{
get { return (*this.positionPtr).Y; }
set { (*this.positionPtr).Y = value; }
get { return position.Y; }
set { position.Y = value; }
}
public float Z
{
get { return (*this.positionPtr).Z; }
set { (*this.positionPtr).Z = value; }
get { return position.Z; }
set { position.Z = value; }
}
@@ -70,7 +63,7 @@ namespace StgSharp.Geometries
public bool IsOnPlain(IPlainGeometry geo)
{
return (*this.positionPtr) * geo.GetPlain().plainParameter == 1;
return position * geo.GetPlain().plainParameter == 1;
}
@@ -50,13 +50,13 @@ namespace StgSharp.Geometries
}
public virtual vec3d MovVertex01(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MovVertex01(uint tick) => movVertex01Operation.Invoke(tick);
public virtual vec3d MovVertex02(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MovVertex02(uint tick) => movVertex01Operation.Invoke(tick);
public virtual vec3d MovVertex03(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MovVertex03(uint tick) => movVertex01Operation.Invoke(tick);
public virtual vec3d MovVertex04(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MovVertex04(uint tick) => movVertex01Operation.Invoke(tick);
internal override void OnRender(uint tick)
@@ -36,15 +36,15 @@ namespace StgSharp.Geometries
{
}
public virtual vec3d movPoint01(uint tick) => movP01Operation.Invoke(TimeLine.tickCounter._value);
public virtual Vec3d movPoint01(uint tick) => movP01Operation.Invoke(TimeLine.tickCounter._value);
public virtual vec3d movPoint02(uint tick) => movP02Operation.Invoke(TimeLine.tickCounter._value);
public virtual Vec3d movPoint02(uint tick) => movP02Operation.Invoke(TimeLine.tickCounter._value);
public virtual vec3d movPoint03(uint tick) => movP03Operation.Invoke(TimeLine.tickCounter._value);
public virtual Vec3d movPoint03(uint tick) => movP03Operation.Invoke(TimeLine.tickCounter._value);
public virtual vec3d movPoint04(uint tick) => movP04Operation.Invoke(TimeLine.tickCounter._value);
public virtual Vec3d movPoint04(uint tick) => movP04Operation.Invoke(TimeLine.tickCounter._value);
public virtual vec3d movPoint05(uint tick) => movP05Operation.Invoke(TimeLine.tickCounter._value);
public virtual Vec3d movPoint05(uint tick) => movP05Operation.Invoke(TimeLine.tickCounter._value);
internal override void OnRender(uint tick)
@@ -35,32 +35,32 @@ namespace StgSharp.Geometries
public GetLocationHandler MovP05Operation { get => movP05Operation; }
public GetLocationHandler MovP06Operation { get => movP06Operation; }
public virtual vec3d movPoint01(uint tick)
public virtual Vec3d movPoint01(uint tick)
{
return movP01Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint02(uint tick)
public virtual Vec3d movPoint02(uint tick)
{
return movP02Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint03(uint tick)
public virtual Vec3d movPoint03(uint tick)
{
return movP03Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint04(uint tick)
public virtual Vec3d movPoint04(uint tick)
{
return movP04Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint05(uint tick)
public virtual Vec3d movPoint05(uint tick)
{
return movP05Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint06(uint tick)
public virtual Vec3d movPoint06(uint tick)
{
return movP06Operation.Invoke(TimeLine.tickCounter._value);
}
@@ -19,14 +19,14 @@ namespace StgSharp.Geometries
/// </summary>
/// <param name="tick">当前游戏刻</param>
/// <returns></returns>
public virtual vec3d MovCenter(uint tick) => default(vec3d);
public virtual Vec3d MovCenter(uint tick) => default(Vec3d);
public sealed override vec3d MovVertex03(uint tick)
public sealed override Vec3d MovVertex03(uint tick)
{
return this.center.Position * 2 - this.vertex01.Position;
}
public sealed override vec3d MovVertex04(uint tick)
public sealed override Vec3d MovVertex04(uint tick)
{
return this.center.Position * 2 - this.vertex02.Position;
}
@@ -8,7 +8,7 @@ namespace StgSharp.Geometries
/// </summary>
public class Square : Rectangle
{
public sealed override vec3d MovVertex02(uint tick)
public sealed override Vec3d MovVertex02(uint tick)
{
return this.center.Position * 2 - this.vertex01.Position;
}
@@ -23,11 +23,11 @@ namespace StgSharp.Geometries
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
public virtual vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
public virtual Vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
public virtual vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
public virtual Vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
public virtual vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
public virtual Vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
public Triangle()
{
@@ -46,9 +46,9 @@ namespace StgSharp.Geometries
}
public Triangle(
vec3d vertex01,
vec3d vertex02,
vec3d vertex03
Vec3d vertex01,
Vec3d vertex02,
Vec3d vertex03
)
{
vertex1.Position = vertex01;
+22 -19
View File
@@ -2,35 +2,38 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
internal static unsafe partial class internalIO
internal static partial class internalIO
{
[DllImport("StgSharpGraphic.dll", EntryPoint = "VecAddVec",
CallingConvention =CallingConvention.Cdecl)]
internal static extern M128 VecAddVec(in IntPtr ptr1, in IntPtr ptr2 /**/, in IntPtr ret/**/);
[DllImport("StgSharpGraphic.dll", EntryPoint = "VecSubVec",
[DllImport("StgSharpGraphic.dll", EntryPoint = "load",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void VecSubVec(IntPtr ptr1, IntPtr ptr2,IntPtr ret);
internal static extern IntPtr load_internal(float x,float y, float z, float w);
[DllImport("StgSharpGraphic.dll", EntryPoint = "VecMulVec",
[DllImport("StgSharpGraphic.dll", EntryPoint = "addps",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void VecMulVec(IntPtr ptr1, IntPtr ptr2, IntPtr ret);
internal static extern IntPtr addps_internal(IntPtr ptr1, IntPtr ptr2);
[DllImport("StgSharpGraphic.dll", EntryPoint = "initSSE")]
internal static extern ulong InternalInitSSE();
[DllImport("StgSharpGraphic.dll", EntryPoint = "subps",
CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr subps_internal(IntPtr ptr1, IntPtr ptr2);
[DllImport("StgSharpGraphic.dll", EntryPoint = "InitM128")]
internal static unsafe extern IntPtr InternalInitM128(float x,float y,float z,float w);
[DllImport("StgSharpGraphic.dll", EntryPoint = "mulps",
CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr mulps_internal(IntPtr ptr1, IntPtr ptr2);
[DllImport("StgSharpGraphic.dll", EntryPoint = "DeinitM128")]
internal static unsafe extern void InternalDeinitM128(IntPtr m128Ptr);
[DllImport("StgSharpGraphic.dll", EntryPoint = "mulps_const",
CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr mulps_const_internal(IntPtr ptr, float value);
[DllImport("StgSharpGraphic.dll", EntryPoint = "deinitM128",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void deinitM128_internal(IntPtr M128Ptr);
}
}
+19 -9
View File
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
@@ -8,17 +10,25 @@ namespace StgSharp.Math
{
public enum Registor : byte
{
XMM0=0,
XMM1=1,
XMM2=2,
XMM3=3,
XMM4=4,
XMM5=5,
XMM6=6,
XMM7=7
XMM0 = 0,
XMM1 = 1,
XMM2 = 2,
XMM3 = 3,
XMM4 = 4,
XMM5 = 5,
XMM6 = 6,
XMM7 = 7
}
static SSE()
{
}
public static Vec4d addps(Vec4d vec1, Vec4d vec2)
{
return new Vec4d(
internalIO.addps_internal(vec1._m128Ptr,vec2._m128Ptr)
) ;
}
}
}
@@ -8,9 +8,9 @@
return vec1.X * vec2.Y - vec1.Y * vec2.X;
}
public static vec3d Cross(vec3d vec1, vec3d vec2)
public static Vec3d Cross(Vec3d vec1, Vec3d vec2)
{
return new vec3d(
return new Vec3d(
vec1.Y * vec2.Z - vec1.Z * vec2.Y,
vec1.X * vec2.Z - vec1.Z * vec2.X,
vec1.X * vec2.Y - vec1.Y * vec2.X
@@ -8,6 +8,8 @@
return Cross(array.row1, array.row2);
}
/*
public static unsafe float Det(matrix3x3 array)
{
float* p = &array.row1.X;
@@ -31,5 +33,7 @@
+ *(p + 2) * Det(matrix3)
;
}
*/
}
}
@@ -10,7 +10,7 @@
);
}
public static float GetAngle(vec3d vec1, vec3d vec2)
public static float GetAngle(Vec3d vec1, Vec3d vec2)
{
return Calc.ACos(
vec1 * vec2
@@ -2,7 +2,7 @@
{
public static unsafe partial class Vector
{
public static float GetLength(this vec3d vec)
public static float GetLength(this Vec3d vec)
{
return Calc.Sqrt(
vec.X * vec.X +
@@ -1,8 +1,30 @@
namespace StgSharp.Math
using System;
namespace StgSharp.Math
{
public static unsafe partial class VectorCalc
{
public static unsafe float Multiple(Vec3d vec1, Vec4d vec2)
{
M128* retPtr = (M128*)internalIO.mulps_internal(vec1._m128Ptr,vec2._m128Ptr);
return
retPtr->single_0 +
retPtr->single_1 +
retPtr->single_2;
}
public static unsafe float Multiple(Vec4d vec1,Vec4d vec2)
{
M128* retPtr = (M128*)internalIO.mulps_internal(vec1._m128Ptr,vec2._m128Ptr);
return
retPtr->single_0 +
retPtr->single_1 +
retPtr->single_2 +
retPtr->single_3;
}
public static unsafe Matrix4x4 Multiple(
Matrix4x4 matrix1, Matrix4x4 matrix2
)
@@ -74,7 +96,7 @@
);
}
public static float multiple(this vec3d vec, colum3 colum)
public static float multiple(this Vec3d vec, colum3 colum)
{
return vec.X * colum.X + vec.Y * colum.Y + vec.Z * colum.Z;
}
@@ -85,11 +107,11 @@
/// <param name="vec"></param>
/// <param name="matrix"></param>
/// <returns></returns>
public static unsafe vec3d multiple(this vec2d vec, matrix2x3 matrix)
public static unsafe Vec3d multiple(this vec2d vec, matrix2x3 matrix)
{
float* p = &matrix.row1.X;
return new vec3d(
return new Vec3d(
vec.X * *(p + 0) + vec.Y * *(p + 3),
vec.X * *(p + 1) + vec.Y * *(p + 4),
vec.X * *(p + 2) + vec.Y * *(p + 5)
@@ -2,12 +2,12 @@
{
public unsafe static partial class Vector
{
public static vec3d To3D(vec2d vec)
public static Vec3d To3D(vec2d vec)
{
return new vec3d(vec.X, vec.Y, 0.0f);
return new Vec3d(vec.X, vec.Y, 0.0f);
}
public static vec2d To2D(vec3d vec, CordinatePlain plain)
public static vec2d To2D(Vec3d vec, CordinatePlain plain)
{
switch (plain)
{
+1 -1
View File
@@ -55,7 +55,7 @@ namespace StgSharp.Math
}
else
{
return this.Equals((vec3d)obj);
return this.Equals((Vec3d)obj);
}
}
+6 -6
View File
@@ -7,11 +7,11 @@ namespace StgSharp.Math
public struct matrix2x3 : IEquatable<matrix2x3>
{
[FieldOffset(0)]
public vec3d row1;
public Vec3d row1;
[FieldOffset(12)]
public vec3d row2;
public Vec3d row2;
public matrix2x3(vec3d r1, vec3d r2)
public matrix2x3(Vec3d r1, Vec3d r2)
{
row1 = r1;
row2 = r2;
@@ -22,8 +22,8 @@ namespace StgSharp.Math
float r21, float r22, float r23
)
{
row1 = new vec3d(r11, r12, r13);
row2 = new vec3d(r21, r22, r23);
row1 = new Vec3d(r11, r12, r13);
row2 = new Vec3d(r21, r22, r23);
}
public override bool Equals(object obj)
@@ -38,7 +38,7 @@ namespace StgSharp.Math
}
else
{
return this.Equals((vec3d)obj);
return this.Equals((Vec3d)obj);
}
}
+7 -7
View File
@@ -7,13 +7,13 @@ namespace StgSharp.Math
public struct matrix3x3 : IEquatable<matrix3x3>
{
[FieldOffset(0)]
public vec3d row1;
public Vec3d row1;
[FieldOffset(12)]
public vec3d row2;
public Vec3d row2;
[FieldOffset(24)]
public vec3d row3;
public Vec3d row3;
public matrix3x3(vec3d r0, vec3d r1, vec3d r2)
public matrix3x3(Vec3d r0, Vec3d r1, Vec3d r2)
{
row1 = r0;
row2 = r1;
@@ -26,9 +26,9 @@ namespace StgSharp.Math
float a31, float a32, float a33
)
{
row1 = new vec3d(a11, a12, a13);
row2 = new vec3d(a21, a22, a23);
row3 = new vec3d(a31, a32, a33);
row1 = new Vec3d(a11, a12, a13);
row2 = new Vec3d(a21, a22, a23);
row3 = new Vec3d(a31, a32, a33);
}
public override int GetHashCode()
+8 -8
View File
@@ -8,13 +8,13 @@ namespace StgSharp.Math
public struct matrix4x3 : IEquatable<matrix4x3>
{
[FieldOffset(0)]
public vec3d row1;
public Vec3d row1;
[FieldOffset(12)]
public vec3d row2;
public Vec3d row2;
[FieldOffset(24)]
public vec3d row3;
public Vec3d row3;
[FieldOffset(36)]
public vec3d row4;
public Vec3d row4;
public matrix4x3(
float a11, float a12, float a13,
@@ -23,10 +23,10 @@ namespace StgSharp.Math
float a41, float a42, float a43
)
{
row1 = new vec3d(a11, a12, a13);
row2 = new vec3d(a21, a22, a23);
row3 = new vec3d(a31, a32, a33);
row4 = new vec3d(a41, a42, a43);
row1 = new Vec3d(a11, a12, a13);
row2 = new Vec3d(a21, a22, a23);
row3 = new Vec3d(a31, a32, a33);
row4 = new Vec3d(a41, a42, a43);
}
public override bool Equals(object obj)
+60 -66
View File
@@ -13,6 +13,15 @@ namespace StgSharp.Math
public unsafe class Matrix4x4
{
public static readonly Matrix4x4 Unit
= new Matrix4x4(
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1
);
internal M128Map map;
internal IntPtr _row0Ptr;
@@ -27,11 +36,10 @@ namespace StgSharp.Math
internal Matrix4x4()
{
_row0Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row1Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row2Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row3Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row0Ptr = internalIO.load_internal(0,0,0,0);
_row1Ptr = internalIO.load_internal(0,0,0,0);
_row2Ptr = internalIO.load_internal(0,0,0,0);
_row3Ptr = internalIO.load_internal(0,0,0,0);
_transpose = new Matrix4x4(this);
}
@@ -39,27 +47,26 @@ namespace StgSharp.Math
//Ctor used for the matixes of transposed matrix
internal Matrix4x4(Matrix4x4 transpose)
{
_row0Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row1Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row2Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row3Ptr = internalIO.InternalInitM128(0, 0, 0, 0);
_row0Ptr = internalIO.load_internal(0, 0, 0, 0);
_row1Ptr = internalIO.load_internal(0, 0, 0, 0);
_row2Ptr = internalIO.load_internal(0, 0, 0, 0);
_row3Ptr = internalIO.load_internal(0, 0, 0, 0);
_transpose = transpose;
this.isTransposed=true;
}
internal unsafe Matrix4x4(M128 row0, M128 row1, M128 row2, M128 row3)
internal unsafe Matrix4x4(
IntPtr row0Ptr,
IntPtr row1Ptr,
IntPtr row2Ptr,
IntPtr row3Ptr)
{
_row0Ptr = internalIO.InternalInitM128(
row0.single_0, row0.single_1, row0.single_2, row0.single_3);
_row1Ptr = internalIO.InternalInitM128(
row1.single_0, row1.single_1, row1.single_2, row1.single_3);
_row2Ptr = internalIO.InternalInitM128(
row2.single_0, row2.single_1, row2.single_2, row2.single_3);
_row3Ptr = internalIO.InternalInitM128(
row3.single_0, row3.single_1, row3.single_2, row3.single_3);
_row0Ptr = row0Ptr;
_row1Ptr = row1Ptr;
_row2Ptr = row2Ptr;
_row3Ptr = row3Ptr;
_transpose = new Matrix4x4(this);
}
@@ -72,10 +79,10 @@ namespace StgSharp.Math
)
{
_row0Ptr = internalIO.InternalInitM128(a00,a01,a02,a03);
_row1Ptr = internalIO.InternalInitM128(a10,a11,a12,a13);
_row2Ptr = internalIO.InternalInitM128(a20,a21,a22,a23);
_row3Ptr = internalIO.InternalInitM128(a30,a31,a32,a33);
_row0Ptr = internalIO.load_internal(a00,a01,a02,a03);
_row1Ptr = internalIO.load_internal(a10,a11,a12,a13);
_row2Ptr = internalIO.load_internal(a20,a21,a22,a23);
_row3Ptr = internalIO.load_internal(a30,a31,a32,a33);
_transpose = new Matrix4x4(this);
}
@@ -115,10 +122,10 @@ namespace StgSharp.Math
{
case TransposeMode.New:
return new Matrix4x4(
*(M128*)_transpose._row0Ptr,
*(M128*)_transpose._row1Ptr,
*(M128*)_transpose._row2Ptr,
*(M128*)_transpose._row3Ptr
_transpose._row0Ptr,
_transpose._row1Ptr,
_transpose._row2Ptr,
_transpose._row3Ptr
);
break;
case TransposeMode.Copy:
@@ -130,52 +137,39 @@ namespace StgSharp.Math
}
}
/*
/**/
public static Matrix4x4 operator +(Matrix4x4 matrix1, Matrix4x4 matrix2)
{
return new Matrix4x4(
internalIO.VecAddVec(matrix1._row0Ptr, matrix2._row0Ptr),
internalIO.VecAddVec(matrix1._row1Ptr, matrix2._row1Ptr),
internalIO.VecAddVec(matrix1._row2Ptr, matrix2._row2Ptr),
internalIO.VecAddVec(matrix1._row3Ptr, matrix2._row3Ptr)
internalIO.addps_internal(matrix1._row0Ptr, matrix2._row0Ptr),
internalIO.addps_internal(matrix1._row1Ptr, matrix2._row1Ptr),
internalIO.addps_internal(matrix1._row2Ptr, matrix2._row2Ptr),
internalIO.addps_internal(matrix1._row3Ptr, matrix2._row3Ptr)
) ;
}
public static Matrix4x4 operator *(Matrix4x4 matrix, float value)
public static Matrix4x4 operator -(Matrix4x4 matrix1, Matrix4x4 matrix2)
{
M128 newRow0 = new M128(
(*(M128*)matrix._row0Ptr).single_0 * value,
(*(M128*)matrix._row0Ptr).single_1 * value,
(*(M128*)matrix._row0Ptr).single_2 * value,
(*(M128*)matrix._row0Ptr).single_3 * value
);
M128 newRow1 = new M128(
(*(M128*)matrix._row1Ptr).single_0 * value,
(*(M128*)matrix._row1Ptr).single_1 * value,
(*(M128*)matrix._row1Ptr).single_2 * value,
(*(M128*)matrix._row1Ptr).single_3 * value
);
M128 newRow2 = new M128(
(*(M128*)matrix._row2Ptr).single_0 * value,
(*(M128*)matrix._row2Ptr).single_1 * value,
(*(M128*)matrix._row2Ptr).single_2 * value,
(*(M128*)matrix._row2Ptr).single_3 * value
);
M128 newRow3 = new M128(
(*(M128*)matrix._row3Ptr).single_0 * value,
(*(M128*)matrix._row3Ptr).single_1 * value,
(*(M128*)matrix._row3Ptr).single_2 * value,
(*(M128*)matrix._row3Ptr).single_3 * value
);
return new Matrix4x4(
newRow0, newRow1, newRow2, newRow3
internalIO.subps_internal(matrix1._row0Ptr, matrix2._row0Ptr),
internalIO.subps_internal(matrix1._row1Ptr, matrix2._row1Ptr),
internalIO.subps_internal(matrix1._row2Ptr, matrix2._row2Ptr),
internalIO.subps_internal(matrix1._row3Ptr, matrix2._row3Ptr)
);
}
/**/
public static Matrix4x4 operator *(Matrix4x4 matrix, float value)
{
return new Matrix4x4(
internalIO.mulps_const_internal(matrix._row0Ptr,value),
internalIO.mulps_const_internal(matrix._row1Ptr,value),
internalIO.mulps_const_internal(matrix._row2Ptr,value),
internalIO.mulps_const_internal(matrix._row3Ptr,value)
);
}
public override string ToString()
{
return $"{*(M128*)_row0Ptr}\n{*(M128*)_row1Ptr}\n{*(M128*)_row2Ptr}\n{*(M128*)_row3Ptr}";
@@ -187,10 +181,10 @@ namespace StgSharp.Math
{
if (map==null)
{
Marshal.FreeHGlobal((IntPtr)_row0Ptr);
Marshal.FreeHGlobal((IntPtr)_row1Ptr);
Marshal.FreeHGlobal((IntPtr)_row2Ptr);
Marshal.FreeHGlobal((IntPtr)_row3Ptr);
internalIO.deinitM128_internal(_row0Ptr);
internalIO.deinitM128_internal(_row1Ptr);
internalIO.deinitM128_internal(_row2Ptr);
internalIO.deinitM128_internal(_row3Ptr);
}
else
{
+125 -22
View File
@@ -1,10 +1,13 @@
using System;
using StgSharp.Control;
using System;
using System.Runtime.InteropServices;
namespace StgSharp.Math
{
/*
[StructLayout(LayoutKind.Explicit, Size = 12, Pack = 16)]
public struct vec3d : IEquatable<vec3d>
public struct Vec3d : IEquatable<Vec3d>
{
[FieldOffset(0)]
public float X;
@@ -13,14 +16,14 @@ namespace StgSharp.Math
[FieldOffset(8)]
public float Z;
public vec3d(float x, float y, float z)
public Vec3d(float x, float y, float z)
{
X = x;
Y = y;
Z = z;
}
bool IEquatable<vec3d>.Equals(vec3d other)
bool IEquatable<Vec3d>.Equals(Vec3d other)
{
if (this.GetHashCode() != other.GetHashCode())
{
@@ -40,13 +43,13 @@ namespace StgSharp.Math
{
return false;
}
else if (obj.GetType() != typeof(vec3d))
else if (obj.GetType() != typeof(Vec3d))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
return this.Equals((Vec3d)obj);
}
}
@@ -65,39 +68,39 @@ namespace StgSharp.Math
return $"{X.ToString(sample)}\t{Y.ToString(sample)}\t{Z.ToString(sample)}";
}
public static bool operator ==(vec3d vec1, vec3d vec2)
public static bool operator ==(Vec3d vec1, Vec3d vec2)
{
return vec1.X == vec2.X
&& vec1.Y == vec2.Y
&& vec1.Z == vec2.Z;
}
public static bool operator !=(vec3d vec1, vec3d vec2)
public static bool operator !=(Vec3d vec1, Vec3d vec2)
{
return !(vec1.X == vec2.X
&& vec1.Y == vec2.Y
&& vec1.Z == vec2.Z);
}
public static vec3d operator +(vec3d vec1, vec3d vec2)
public static Vec3d operator +(Vec3d vec1, Vec3d vec2)
{
return new vec3d(
return new Vec3d(
vec1.X + vec2.X,
vec1.Y + vec2.Y,
vec1.Z + vec2.Z
);
}
public static vec3d operator -(vec3d vec1, vec3d vec2)
public static Vec3d operator -(Vec3d vec1, Vec3d vec2)
{
return new vec3d(
return new Vec3d(
vec1.X - vec2.X,
vec1.Y - vec2.Y,
vec1.Z - vec2.Z
);
}
public static float operator *(vec3d vec1, vec3d vec2)
public static float operator *(Vec3d vec1, Vec3d vec2)
{
return
vec1.X * vec2.X
@@ -105,41 +108,141 @@ namespace StgSharp.Math
+ vec1.Z + vec2.Z;
}
public static vec3d operator *(vec3d vec, float x)
public static Vec3d operator *(Vec3d vec, float x)
{
return new vec3d(
return new Vec3d(
vec.X * x,
vec.Y * x,
vec.Z * x
);
}
public static vec3d operator *(float x, vec3d vec)
public static Vec3d operator *(float x, Vec3d vec)
{
return new vec3d(
return new Vec3d(
vec.X * x,
vec.Y * x,
vec.Z * x
);
}
public static vec3d operator /(vec3d vec, float x)
public static Vec3d operator /(Vec3d vec, float x)
{
return new vec3d(
return new Vec3d(
vec.X / x,
vec.Y / x,
vec.Z / x
);
}
public static implicit operator float[](vec3d vec)
public static implicit operator float[](Vec3d vec)
{
return new float[3] { vec.X, vec.Y, vec.Y };
}
public static implicit operator vec3d(float[] floatArray)
public static implicit operator Vec3d(float[] floatArray)
{
return new vec3d(floatArray[0], floatArray[1], floatArray[2]);
return new Vec3d(floatArray[0], floatArray[1], floatArray[2]);
}
}
/**/
public class Vec3d
{
public static Vec3d defaultValue =
new Vec3d(0, 0, 0);
internal M128Map _map;
internal IntPtr _m128Ptr;
public unsafe float X
{
get { return ((M128*)_m128Ptr)->single_0; }
set { ((M128*)_m128Ptr)->single_0 = value; }
}
public unsafe float Y
{
get { return ((M128*)_m128Ptr)->single_1; }
set { ((M128*)_m128Ptr)->single_1 = value; }
}
public unsafe float Z
{
get { return ((M128*)_m128Ptr)->single_2; }
set { ((M128*)_m128Ptr)->single_2 = value; }
}
internal Vec3d(IntPtr value)
{
if ((long)value == -1)
{
throw new Exception("Failed to creat M128 pointer");
}
else
{
_m128Ptr = value;
}
}
public Vec3d(float x, float y, float z)
{
_m128Ptr = internalIO.load_internal(x,y,z,0);
}
internal Vec3d()
{
_m128Ptr = defaultValue._m128Ptr;
}
public static Vec3d operator +(Vec3d vec1, Vec3d vec2)
{
return new Vec3d(
internalIO.addps_internal(vec1._m128Ptr, vec2._m128Ptr)
);
}
public static Vec3d operator -(Vec3d vec1, Vec3d vec2)
{
return new Vec3d(
internalIO.subps_internal(vec1._m128Ptr, vec2._m128Ptr)
);
}
public static Vec3d operator *(Vec3d vec, float value)
{
return new Vec3d(
internalIO.mulps_const_internal(vec._m128Ptr,value)
);
}
public unsafe override string ToString()
{
return (*(M128*)_m128Ptr).ToString();
}
~Vec3d()
{
if (_map == null)
{
if (_m128Ptr != defaultValue._m128Ptr)
{
internalIO.deinitM128_internal(this._m128Ptr);
}
else
{
_m128Ptr = IntPtr.Zero;
}
}
else
{
}
}
}
}
+46 -13
View File
@@ -9,8 +9,11 @@ namespace StgSharp.Math
public class Vec4d
{
internal readonly M128Map _map;
internal readonly IntPtr _m128Ptr;
internal static readonly Vec4d defaultValue
= new Vec4d( 0,0,0,0 );
internal M128Map _map;
internal IntPtr _m128Ptr;
public unsafe float X
@@ -39,34 +42,57 @@ namespace StgSharp.Math
public Vec4d(float x, float y, float z, float w)
{
IntPtr a = internalIO.InternalInitM128(x,y,z,w);
IntPtr a = internalIO.load_internal(x,y,z,w);
if ((ulong)a>=0)
{
this._m128Ptr = a;
}
}
internal Vec4d()
/// <summary>
/// internal constructor to recive a pointer of the M128 value
/// </summary>
/// <param name="value"></param>
internal Vec4d(IntPtr value)
{
_m128Ptr = internalIO.InternalInitM128(0,0,0,0);
if ((long)value == -1)
{
throw new Exception("Failed to init M128 pointer!");
}
else
{
_m128Ptr = value;
}
}
public static Vec4d operator +(Vec4d vec1,Vec4d vec2)
public Vec4d()
{
Vec4d result = new Vec4d();
internalIO.VecAddVec(vec1._m128Ptr, vec2._m128Ptr/**/,result._m128Ptr/**/);
return result;
_m128Ptr = defaultValue._m128Ptr;
}
public static unsafe Vec4d operator +(Vec4d vec1,Vec4d vec2)
{
return new Vec4d(
internalIO.addps_internal(vec1._m128Ptr,vec2._m128Ptr)
) ;
}
/**/
public static Vec4d operator -(Vec4d vec1, Vec4d vec2)
{
Vec4d result = new Vec4d();
internalIO.VecSubVec(vec1._m128Ptr,vec2._m128Ptr,result._m128Ptr);
return result;
return new Vec4d(
internalIO.subps_internal(vec1._m128Ptr,vec2._m128Ptr)
);
}
/**/
public static Vec4d operator *(Vec4d vec, float value)
{
return new Vec4d(
internalIO.mulps_const_internal(vec._m128Ptr,value)
);
}
public unsafe override string ToString()
{
@@ -77,7 +103,14 @@ namespace StgSharp.Math
{
if (_map == null)
{
internalIO.InternalDeinitM128(this._m128Ptr);
if (_m128Ptr != defaultValue._m128Ptr)
{
internalIO.deinitM128_internal(this._m128Ptr);
}
else
{
_m128Ptr = IntPtr.Zero;
}
}
else
{
+12 -38
View File
@@ -1,5 +1,6 @@
using StgSharp.Math;
using System;
using System.Runtime.Intrinsics;
namespace StgSharp
{
@@ -8,48 +9,21 @@ namespace StgSharp
{
private unsafe static void Main(string[] args)
{
/*
Matrix4x4 matrix = new Matrix4x4(
0,0,0,0,
1,2,3,4,
0,0,0,0,
0,0,0,0
);
Vec3d v = new Vec3d(1,2,3);
Console.WriteLine(v._m128Ptr);
Console.WriteLine(v);
Console.WriteLine();
Console.WriteLine((long)matrix._row0Ptr/16.0);
Console.WriteLine((long)matrix._row1Ptr/16.0);
Console.WriteLine((long)matrix._row2Ptr/16.0);
Console.WriteLine((long)matrix._row3Ptr/16.0);
Vec3d v2 = new Vec3d(2,2,3);
Console.WriteLine(v2._m128Ptr);
Console.WriteLine(v2);
Console.WriteLine();
Matrix4x4 matrix2 = new Matrix4x4(
0, 0, 0, 0,
1, 2, 3, 4,
0, 0, 0, 0,
0, 0, 0, 0
);
Vec3d v3 = v - v2;
Console.WriteLine((long)matrix2._row0Ptr / 16.0);
Console.WriteLine((long)matrix2._row1Ptr / 16.0);
Console.WriteLine((long)matrix2._row2Ptr / 16.0);
Console.WriteLine((long)matrix2._row3Ptr / 16.0);
Console.WriteLine(matrix+matrix2);
/**/
Vec4d vec = new Vec4d(1,2,2,3);
IntPtr ptr1 = internalIO.InternalInitM128(1,2,3,4);
IntPtr ptr2 = internalIO.InternalInitM128(2,2,3,3);
Console.WriteLine(ptr1);
Console.WriteLine(ptr2);
IntPtr ret = internalIO.InternalInitM128(0,0,0,0);
internalIO.VecAddVec(ptr1,ptr2,ret);
Console.WriteLine(*(M128*)ret);
Console.WriteLine();
Console.WriteLine(v3);
}
+3
View File
@@ -11,6 +11,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StgSharpGraphic", "StgShqrpGraphic\StgShqrpGraphic.vcxproj", "{4CD737E9-9502-46CE-89AC-FE8047502DE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharpDebug", "StgSharpDebug\StgSharpDebug.csproj", "{D85E4AF0-4FC7-41C5-B892-795A4025B776}"
ProjectSection(ProjectDependencies) = postProject
{4CD737E9-9502-46CE-89AC-FE8047502DE4} = {4CD737E9-9502-46CE-89AC-FE8047502DE4}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10 -12
View File
@@ -3,19 +3,15 @@
#include "GLenv/include/glad/glad.h"
#include "GLenv/include/glad/glad.h"
#include "StgSharpGraphic.h"
#include <xmmintrin.h>
typedef struct M128ptrCache
typedef struct SSEfuncptr
{
unsigned long long m128Ptr0;
unsigned long long m128Ptr1;
unsigned long long m128Ptr2;
unsigned long long m128Ptr3;
unsigned long long m128Ptr4;
unsigned long long m128Ptr5;
unsigned long long m128Ptr6;
unsigned long long m128Ptr7;
unsigned long long m128Ptr8;
}M128ptrCache;
__m128* (*loadM128)(float x, float y, float z, float w);
__m128* (*addps)(__m128 ptr1, __m128 ptr2);
__m128* (*subps)(__m128 ptr1, __m128 ptr2);
}SSEfuncptr;
typedef struct glIOPack
{
@@ -40,4 +36,6 @@ typedef struct glIOPack
}glIOpackage;
M128ptrCache m128ptr;
SSEfuncptr sseFunc;
glIOpackage pack;
+3 -4
View File
@@ -8,7 +8,8 @@
#include "StgSharpGraphic.h"
#include "SSGinternal.h"
glIOpackage pack;
extern SSEfuncptr sseFunc;
extern glIOpackage pack;
STGSHARPGRAPHIC_API glIOpackage loadGLApi(void)
{
@@ -23,8 +24,6 @@ STGSHARPGRAPHIC_API glIOpackage loadGLApi(void)
//these are for callback
pack.SetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
glfwCreateWindow(800,600,"Stg#!", NULL,NULL);
return pack;
}
@@ -45,5 +44,5 @@ STGSHARPGRAPHIC_API void initGL(void)
STGSHARPGRAPHIC_API int initGLAD(void)
{
return gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
}
}
+6 -15
View File
@@ -14,28 +14,19 @@
#include "GLenv/include/GLFW/glfw3.h"
#include "SSGinternal.h"
#include <stdint.h>
#include <xmmintrin.h>
STGSHARPGRAPHIC_API glIOpackage loadGLApi(void);
STGSHARPGRAPHIC_API void initGL(void);
STGSHARPGRAPHIC_API int initGLAD(void);
STGSHARPGRAPHIC_API __m128* InitM128(float x,float y,float z,float w);
STGSHARPGRAPHIC_API void DeinitM128(__m128* m128Ptr);
STGSHARPGRAPHIC_API __m128* __cdecl load(float x, float y, float z, float w);
STGSHARPGRAPHIC_API __m128* __cdecl addps(__m128* ptr1, __m128* ptr2);
STGSHARPGRAPHIC_API __m128* __cdecl subps(__m128* ptr1, __m128* ptr2);
STGSHARPGRAPHIC_API __m128* __cdecl mulps_const(__m128* ptr, float value);
STGSHARPGRAPHIC_API __m128* __cdecl mulps(__m128* ptr1, __m128* ptr2);
STGSHARPGRAPHIC_API void VecAddVec(__m128* ptr1, __m128* ptr2, __m128* ret);
STGSHARPGRAPHIC_API void VecSubVec(__m128* ptr1, __m128* ptr2, __m128* ret);
STGSHARPGRAPHIC_API void VecMulVec(__m128* ptr1, __m128* ptr2, __m128* ret);
STGSHARPGRAPHIC_API void __cdecl deinitM128(__m128* ptr);
#endif // !SSG
@@ -129,12 +129,14 @@
<PreprocessorDefinitions>_DEBUG;STGSHQRPGRAPHIC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard_C>Default</LanguageStandard_C>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AssemblerOutput>All</AssemblerOutput>
<LanguageStandard>stdcpp20</LanguageStandard>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<IntrinsicFunctions>true</IntrinsicFunctions>
<CompileAs>CompileAsC</CompileAs>
<CompileAs>Default</CompileAs>
<Optimization>MaxSpeed</Optimization>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -151,12 +153,13 @@
<PreprocessorDefinitions>NDEBUG;STGSHARPGRAPHIC_API;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AssemblerOutput>All</AssemblerOutput>
<LanguageStandard_C>Default</LanguageStandard_C>
<LanguageStandard>stdcpp20</LanguageStandard>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<CompileAs>CompileAsC</CompileAs>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+70 -53
View File
@@ -1,3 +1,5 @@
#pragma once
#include "StgSharpGraphic.h"
#include "SSGinternal.h"
#include <stdio.h>
@@ -5,77 +7,92 @@
#include <xmmintrin.h>
STGSHARPGRAPHIC_API __m128* InitM128(float x, float y, float z, float w)
STGSHARPGRAPHIC_API __m128* __cdecl load(float x, float y, float z, float w)
{
__m128* Ptr = _aligned_malloc(16, sizeof(__m128));
if (NULL==Ptr)
float array[4] = {x,y,z,w};
__m128* ptr = _aligned_malloc(sizeof(__m128),16);
if (NULL != ptr)
{
return (__m128*) - 1;
*ptr = _mm_loadu_ps(&array);
return ptr;
}
else
{
Ptr->m128_f32[0] = x;
Ptr->m128_f32[1] = y;
Ptr->m128_f32[2] = z;
Ptr->m128_f32[3] = w;
return Ptr;
return -1;
}
}
STGSHARPGRAPHIC_API void DeinitM128(__m128* m128Ptr)
STGSHARPGRAPHIC_API __m128* __cdecl addps(__m128* ptr1, __m128* ptr2)
{
free(m128Ptr);
}
__m128* ret = _aligned_malloc(sizeof(__m128*),16);
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);
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]
);
if (NULL != ret)
{
*ret = _mm_add_ps(*ptr1, *ptr2);
return ret;
}
else
{
return -1;
}
}
STGSHARPGRAPHIC_API void VecSubVec(__m128* ptr1, __m128* ptr2, __m128* ret)
STGSHARPGRAPHIC_API __m128* __cdecl subps(__m128* ptr1, __m128* ptr2)
{
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]
);
__m128* ret = _aligned_malloc(sizeof(__m128*), 16);
if (NULL != ret)
{
*ret = _mm_sub_ps(*ptr1, *ptr2);
return ret;
}
else
{
return -1;
}
}
STGSHARPGRAPHIC_API void VecMulVec(__m128* ptr1, __m128* ptr2, __m128* ret)
STGSHARPGRAPHIC_API __m128* __cdecl mulps_const(__m128* ptr, float value)
{
*ret = _mm_mul_ps(*ptr1, *ptr2);
float c[4] = { value, value, value, value };
__m128* ret = _aligned_malloc(sizeof(__m128),16);
__m128 valueVec = _mm_loadu_ps(&c);
if (NULL != ret)
{
*ret = _mm_mul_ps(*ptr,valueVec);
return ret;
}
else
{
return -1;
}
}
STGSHARPGRAPHIC_API __m128* __cdecl mulps(__m128* ptr1, __m128* ptr2)
{
__m128* ret = _aligned_malloc(sizeof(__m128), 16);
if (NULL != ret)
{
*ret = _mm_mul_ps(*ptr1, *ptr2);
return ret;
}
else
{
return -1;
}
}
STGSHARPGRAPHIC_API void __cdecl deinitM128(__m128* ptr)
{
free(ptr);
}
@@ -0,0 +1,27 @@
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\vc143.pdb
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\vc143.idb
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\dllmain.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\glad.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\linear.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\linear.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\dllmain.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\glad.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgshqrpgraphic.ilk
d:\nitloadindustry\研究项目\1-flagship\huftdt cooperation\2023固火方案4\cfs\cadc_flight_simulator\x64\debug\stgshqrpgraphic.dll
d:\nitloadindustry\研究项目\1-flagship\huftdt cooperation\2023固火方案4\cfs\cadc_flight_simulator\x64\debug\stgshqrpgraphic.pdb
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpgraphic.dll
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.ilk
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpgraphic.pdb
d:\nitloadindustry\研究项目\1-flagship\huftdt cooperation\2023固火方案4\cfs\cadc_flight_simulator\x64\debug\stgshqrpgraphic.lib
d:\nitloadindustry\研究项目\1-flagship\huftdt cooperation\2023固火方案4\cfs\cadc_flight_simulator\x64\debug\stgshqrpgraphic.exp
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpgraphic.lib
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpgraphic.exp
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\cl.command.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\cl.read.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\cl.write.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\link.command.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\link.read.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\link.write.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgshqrpgraphic\x64\debug\stgsharpgraphic.tlog\stgsharpgraphic.write.1u.tlog
@@ -6,19 +6,19 @@ INCLUDELIB MSVCRT
INCLUDELIB OLDNAMES
_DATA SEGMENT
COMM m128ptr:BYTE:048H
COMM sseFunc:BYTE:018H
COMM pack:BYTE:038H
_DATA ENDS
msvcjmc SEGMENT
__018B5678_khrplatform@h DB 01H
__79FC18F0_glad@h DB 01H
__E7EC9AD1_concurrencysal@h DB 01H
__ADCB3D40_sal@h DB 01H
__63527AC6_vadefs@h DB 01H
__979672E1_vcruntime@h DB 01H
__1B5F14A0_stdint@h DB 01H
__018B5678_khrplatform@h DB 01H
__79FC18F0_glad@h DB 01H
__B193B045_corecrt@h DB 01H
__887B5571_stddef@h DB 01H
__1B5F14A0_stdint@h DB 01H
__986CAB3E_glfw3@h DB 01H
__47F55FD8_winpackagefamily@h DB 01H
__43D6A374_winapifamily@h DB 01H
@@ -112,18 +112,17 @@ __0F1BF9AE_imm@h DB 01H
__0B5A2696_windows@h DB 01H
__F7492337_framework@h DB 01H
__C508448F_StgSharpGraphic@h DB 01H
__203A43BB_SSGinternal@h DB 01H
__B45635C8_mmintrin@h DB 01H
__FF268430_corecrt_malloc@h DB 01H
__61F92E22_malloc@h DB 01H
__17431EB5_xmmintrin@h DB 01H
__203A43BB_SSGinternal@h DB 01H
__52DA9D07_StgSharpGraphic@c DB 01H
msvcjmc ENDS
PUBLIC loadGLApi
PUBLIC initGL
PUBLIC initGLAD
PUBLIC __JustMyCode_Default
PUBLIC ??_C@_05NIBAEAOK@Stg?$CD?$CB@ ; `string'
EXTRN gladLoadGLLoader:PROC
EXTRN glfwInit:PROC
EXTRN glfwWindowHint:PROC
@@ -134,60 +133,40 @@ EXTRN glfwMakeContextCurrent:PROC
EXTRN glfwSwapBuffers:PROC
EXTRN glfwSwapInterval:PROC
EXTRN glfwGetProcAddress:PROC
EXTRN _RTC_InitBase:PROC
EXTRN _RTC_Shutdown:PROC
EXTRN __CheckForDebuggerJustMyCode:PROC
EXTRN glad_glClearColor:QWORD
; COMDAT pdata
pdata SEGMENT
$pdata$loadGLApi DD imagerel $LN3
DD imagerel $LN3+206
$pdata$loadGLApi DD imagerel $LN4
DD imagerel $LN4+173
DD imagerel $unwind$loadGLApi
pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$initGL DD imagerel $LN3
DD imagerel $LN3+87
$pdata$initGL DD imagerel $LN4
DD imagerel $LN4+70
DD imagerel $unwind$initGL
pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$initGLAD DD imagerel $LN3
DD imagerel $LN3+49
$pdata$initGLAD DD imagerel $LN4
DD imagerel $LN4+32
DD imagerel $unwind$initGLAD
pdata ENDS
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
_RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
_RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase
rtc$IMZ ENDS
; COMDAT ??_C@_05NIBAEAOK@Stg?$CD?$CB@
CONST SEGMENT
??_C@_05NIBAEAOK@Stg?$CD?$CB@ DB 'Stg#!', 00H ; `string'
CONST ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$initGLAD DD 025050f01H
DD 010a230fH
DD 07003001dH
DD 05002H
$unwind$initGLAD DD 010401H
DD 04204H
xdata ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$initGL DD 025050f01H
DD 010a230fH
DD 07003001dH
DD 05002H
$unwind$initGL DD 010401H
DD 04204H
xdata ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$loadGLApi DD 035061401H
DD 010f3314H
DD 07008001eH
DD 050066007H
$unwind$loadGLApi DD 020601H
DD 030023206H
xdata ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
@@ -196,200 +175,142 @@ __JustMyCode_Default PROC ; COMDAT
00000 c2 00 00 ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; Function compile flags: /Ogtpy
; File D:\NitloadIndustry\Ñо¿ÏîÄ¿\1-Flagship\TH2020\ProjectFile\Ô´´úÂë\StgShqrpGraphic\StgSharpGraphic.c
; COMDAT initGLAD
_TEXT SEGMENT
initGLAD PROC ; COMDAT
; 46 : {
; 45 : {
$LN3:
00000 40 55 push rbp
00002 57 push rdi
00003 48 81 ec e8 00
00 00 sub rsp, 232 ; 000000e8H
0000a 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
0000f 48 8d 0d 00 00
$LN4:
00000 48 83 ec 28 sub rsp, 40 ; 00000028H
00004 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__52DA9D07_StgSharpGraphic@c
00016 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 47 : return gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
0001b 48 8d 0d 00 00
0000b e8 00 00 00 00 call __CheckForDebuggerJustMyCode
00010 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:glfwGetProcAddress
00022 e8 00 00 00 00 call gladLoadGLLoader
; 48 :
; 49 : }
; 46 : return gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
; 47 : }
00027 48 8d a5 c8 00
00 00 lea rsp, QWORD PTR [rbp+200]
0002e 5f pop rdi
0002f 5d pop rbp
00030 c3 ret 0
00017 48 83 c4 28 add rsp, 40 ; 00000028H
0001b e9 00 00 00 00 jmp gladLoadGLLoader
initGLAD ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; Function compile flags: /Ogtpy
; File D:\NitloadIndustry\Ñо¿ÏîÄ¿\1-Flagship\TH2020\ProjectFile\Ô´´úÂë\StgShqrpGraphic\StgSharpGraphic.c
; COMDAT initGL
_TEXT SEGMENT
initGL PROC ; COMDAT
; 33 : {
; 32 : {
$LN3:
00000 40 55 push rbp
00002 57 push rdi
00003 48 81 ec e8 00
00 00 sub rsp, 232 ; 000000e8H
0000a 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
0000f 48 8d 0d 00 00
$LN4:
00000 48 83 ec 28 sub rsp, 40 ; 00000028H
00004 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__52DA9D07_StgSharpGraphic@c
00016 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
0000b e8 00 00 00 00 call __CheckForDebuggerJustMyCode
00010 e8 00 00 00 00 call glfwInit
00015 ba 03 00 00 00 mov edx, 3
0001a b9 02 20 02 00 mov ecx, 139266 ; 00022002H
0001f e8 00 00 00 00 call glfwWindowHint
00024 ba 03 00 00 00 mov edx, 3
00029 b9 03 20 02 00 mov ecx, 139267 ; 00022003H
0002e e8 00 00 00 00 call glfwWindowHint
00033 ba 01 20 03 00 mov edx, 204801 ; 00032001H
00038 b9 08 20 02 00 mov ecx, 139272 ; 00022008H
; 34 : glfwInit();
; 33 : glfwInit();
; 34 : glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
; 35 : glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
; 36 : glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
; 37 :
; 38 : #ifdef __APPLE__
; 39 : glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
; 40 : #endif // __APPLE__
; 41 : }
0001b e8 00 00 00 00 call glfwInit
; 35 : glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
00020 ba 03 00 00 00 mov edx, 3
00025 b9 02 20 02 00 mov ecx, 139266 ; 00022002H
0002a e8 00 00 00 00 call glfwWindowHint
; 36 : glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
0002f ba 03 00 00 00 mov edx, 3
00034 b9 03 20 02 00 mov ecx, 139267 ; 00022003H
00039 e8 00 00 00 00 call glfwWindowHint
; 37 : glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
0003e ba 01 20 03 00 mov edx, 204801 ; 00032001H
00043 b9 08 20 02 00 mov ecx, 139272 ; 00022008H
00048 e8 00 00 00 00 call glfwWindowHint
; 38 :
; 39 : #ifdef __APPLE__
; 40 : glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
; 41 : #endif // __APPLE__
; 42 : }
0004d 48 8d a5 c8 00
00 00 lea rsp, QWORD PTR [rbp+200]
00054 5f pop rdi
00055 5d pop rbp
00056 c3 ret 0
0003d 48 83 c4 28 add rsp, 40 ; 00000028H
00041 e9 00 00 00 00 jmp glfwWindowHint
initGL ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; Function compile flags: /Ogtpy
; File D:\NitloadIndustry\Ñо¿ÏîÄ¿\1-Flagship\TH2020\ProjectFile\Ô´´úÂë\StgShqrpGraphic\StgSharpGraphic.c
; COMDAT loadGLApi
_TEXT SEGMENT
__$ReturnAddress$ = 224
__$ReturnAddress$ = 48
loadGLApi PROC ; COMDAT
; 14 : {
; 15 : {
$LN3:
00000 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
00005 55 push rbp
00006 56 push rsi
00007 57 push rdi
00008 48 81 ec f0 00
00 00 sub rsp, 240 ; 000000f0H
0000f 48 8d 6c 24 30 lea rbp, QWORD PTR [rsp+48]
00014 48 8d 0d 00 00
$LN4:
00000 40 53 push rbx
00002 48 83 ec 20 sub rsp, 32 ; 00000020H
00006 48 8b d9 mov rbx, rcx
00009 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__52DA9D07_StgSharpGraphic@c
0001b e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 15 :
; 16 : pack.createWindow = glfwCreateWindow;
00020 48 8d 05 00 00
00010 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
00015 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:glfwCreateWindow
00027 48 89 05 00 00
0001c 48 89 05 00 00
00 00 mov QWORD PTR pack, rax
; 17 : pack.makeContextCurrent = glfwMakeContextCurrent;
0002e 48 8d 05 00 00
00023 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:glfwMakeContextCurrent
00035 48 89 05 08 00
0002a 48 89 05 08 00
00 00 mov QWORD PTR pack+8, rax
; 18 : pack.swapInterval = glfwSwapInterval;
0003c 48 8d 05 00 00
00031 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:glfwSwapInterval
00043 48 89 05 10 00
00038 0f 10 05 00 00
00 00 movups xmm0, XMMWORD PTR pack
0003f 48 89 05 10 00
00 00 mov QWORD PTR pack+16, rax
; 19 : pack.clearColor = glClearColor;
0004a 48 8b 05 00 00
00046 48 8b 05 00 00
00 00 mov rax, QWORD PTR glad_glClearColor
00051 48 89 05 18 00
0004d 48 89 05 18 00
00 00 mov QWORD PTR pack+24, rax
; 20 : pack.windowShouldClose = glfwWindowShouldClose;
00058 48 8d 05 00 00
00054 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:glfwWindowShouldClose
0005f 48 89 05 20 00
0005b 0f 10 0d 10 00
00 00 movups xmm1, XMMWORD PTR pack+16
00062 48 89 05 20 00
00 00 mov QWORD PTR pack+32, rax
; 21 : pack.swapBuffer = glfwSwapBuffers;
00066 48 8d 05 00 00
00069 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:glfwSwapBuffers
0006d 48 89 05 28 00
00070 0f 11 03 movups XMMWORD PTR [rbx], xmm0
00073 48 89 05 28 00
00 00 mov QWORD PTR pack+40, rax
; 22 :
; 23 : //these are for callback
; 24 : pack.SetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
00074 48 8d 05 00 00
0007a 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:glfwSetFramebufferSizeCallback
0007b 48 89 05 30 00
00081 0f 10 05 20 00
00 00 movups xmm0, XMMWORD PTR pack+32
00088 48 89 05 30 00
00 00 mov QWORD PTR pack+48, rax
0008f 48 8b c3 mov rax, rbx
00092 0f 11 4b 10 movups XMMWORD PTR [rbx+16], xmm1
00096 f2 0f 10 0d 30
00 00 00 movsd xmm1, QWORD PTR pack+48
0009e 0f 11 43 20 movups XMMWORD PTR [rbx+32], xmm0
000a2 f2 0f 11 4b 30 movsd QWORD PTR [rbx+48], xmm1
; 25 :
; 26 : glfwCreateWindow(800,600,"Stg#!", NULL,NULL);
00082 48 c7 44 24 20
00 00 00 00 mov QWORD PTR [rsp+32], 0
0008b 45 33 c9 xor r9d, r9d
0008e 4c 8d 05 00 00
00 00 lea r8, OFFSET FLAT:??_C@_05NIBAEAOK@Stg?$CD?$CB@
00095 ba 58 02 00 00 mov edx, 600 ; 00000258H
0009a b9 20 03 00 00 mov ecx, 800 ; 00000320H
0009f e8 00 00 00 00 call glfwCreateWindow
; 16 :
; 17 : pack.createWindow = glfwCreateWindow;
; 18 : pack.makeContextCurrent = glfwMakeContextCurrent;
; 19 : pack.swapInterval = glfwSwapInterval;
; 20 : pack.clearColor = glClearColor;
; 21 : pack.windowShouldClose = glfwWindowShouldClose;
; 22 : pack.swapBuffer = glfwSwapBuffers;
; 23 :
; 24 : //these are for callback
; 25 : pack.SetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
; 26 :
; 27 :
; 28 :
; 29 : return pack;
; 28 : return pack;
; 29 : }
000a4 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:pack
000ab 48 8b bd e0 00
00 00 mov rdi, QWORD PTR __$ReturnAddress$[rbp]
000b2 48 8b f0 mov rsi, rax
000b5 b9 38 00 00 00 mov ecx, 56 ; 00000038H
000ba f3 a4 rep movsb
000bc 48 8b 85 e0 00
00 00 mov rax, QWORD PTR __$ReturnAddress$[rbp]
; 30 : }
000c3 48 8d a5 c0 00
00 00 lea rsp, QWORD PTR [rbp+192]
000ca 5f pop rdi
000cb 5e pop rsi
000cc 5d pop rbp
000cd c3 ret 0
000a7 48 83 c4 20 add rsp, 32 ; 00000020H
000ab 5b pop rbx
000ac c3 ret 0
loadGLApi ENDP
_TEXT ENDS
END
File diff suppressed because it is too large Load Diff
+19 -49
View File
@@ -6,7 +6,8 @@ INCLUDELIB MSVCRT
INCLUDELIB OLDNAMES
_DATA SEGMENT
COMM m128ptr:BYTE:048H
COMM sseFunc:BYTE:018H
COMM pack:BYTE:038H
_DATA ENDS
msvcjmc SEGMENT
__47F55FD8_winpackagefamily@h DB 01H
@@ -105,44 +106,32 @@ __AE6FAD4A_ime_cmodes@h DB 01H
__0F1BF9AE_imm@h DB 01H
__0B5A2696_windows@h DB 01H
__F7492337_framework@h DB 01H
__1B5F14A0_stdint@h DB 01H
__018B5678_khrplatform@h DB 01H
__79FC18F0_glad@h DB 01H
__887B5571_stddef@h DB 01H
__1B5F14A0_stdint@h DB 01H
__986CAB3E_glfw3@h DB 01H
__C508448F_StgSharpGraphic@h DB 01H
__203A43BB_SSGinternal@h DB 01H
__B45635C8_mmintrin@h DB 01H
__FF268430_corecrt_malloc@h DB 01H
__61F92E22_malloc@h DB 01H
__17431EB5_xmmintrin@h DB 01H
__203A43BB_SSGinternal@h DB 01H
__BA7172FA_dllmain@c DB 01H
msvcjmc ENDS
PUBLIC DllMain
PUBLIC __JustMyCode_Default
EXTRN _RTC_InitBase:PROC
EXTRN _RTC_Shutdown:PROC
EXTRN __CheckForDebuggerJustMyCode:PROC
; COMDAT pdata
pdata SEGMENT
$pdata$DllMain DD imagerel $LN9
DD imagerel $LN9+67
$pdata$DllMain DD imagerel $LN10
DD imagerel $LN10+26
DD imagerel $unwind$DllMain
pdata ENDS
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
_RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
_RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase
rtc$IMZ ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$DllMain DD 025051c01H
DD 0117231cH
DD 07010001fH
DD 0500fH
$unwind$DllMain DD 010401H
DD 04204H
xdata ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
@@ -151,38 +140,25 @@ __JustMyCode_Default PROC ; COMDAT
00000 c2 00 00 ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; Function compile flags: /Ogtpy
; File D:\NitloadIndustry\Ñо¿ÏîÄ¿\1-Flagship\TH2020\ProjectFile\Ô´´úÂë\StgShqrpGraphic\dllmain.c
; COMDAT DllMain
_TEXT SEGMENT
tv64 = 192
hModule$ = 240
ul_reason_for_call$ = 248
lpReserved$ = 256
hModule$ = 48
ul_reason_for_call$ = 56
lpReserved$ = 64
DllMain PROC ; COMDAT
; 17 : {
$LN9:
00000 4c 89 44 24 18 mov QWORD PTR [rsp+24], r8
00005 89 54 24 10 mov DWORD PTR [rsp+16], edx
00009 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
0000e 55 push rbp
0000f 57 push rdi
00010 48 81 ec f8 00
00 00 sub rsp, 248 ; 000000f8H
00017 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
0001c 48 8d 0d 00 00
$LN10:
00000 48 83 ec 28 sub rsp, 40 ; 00000028H
00004 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__BA7172FA_dllmain@c
00023 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
0000b e8 00 00 00 00 call __CheckForDebuggerJustMyCode
00010 b8 01 00 00 00 mov eax, 1
; 18 : switch (ul_reason_for_call)
00028 8b 85 f8 00 00
00 mov eax, DWORD PTR ul_reason_for_call$[rbp]
0002e 89 85 c0 00 00
00 mov DWORD PTR tv64[rbp], eax
; 19 : {
; 20 : case DLL_PROCESS_ATTACH:
; 21 :
@@ -194,16 +170,10 @@ $LN9:
; 27 : break;
; 28 : }
; 29 : return TRUE;
00034 b8 01 00 00 00 mov eax, 1
; 30 : }
00039 48 8d a5 d8 00
00 00 lea rsp, QWORD PTR [rbp+216]
00040 5f pop rdi
00041 5d pop rbp
00042 c3 ret 0
00015 48 83 c4 28 add rsp, 40 ; 00000028H
00019 c3 ret 0
DllMain ENDP
_TEXT ENDS
END
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TechDemo", "TechDemo\TechDemo.vcxproj", "{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Debug|x64.ActiveCfg = Debug|x64
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Debug|x64.Build.0 = Debug|x64
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Debug|x86.ActiveCfg = Debug|Win32
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Debug|x86.Build.0 = Debug|Win32
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Release|x64.ActiveCfg = Release|x64
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Release|x64.Build.0 = Release|x64
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Release|x86.ActiveCfg = Release|Win32
{ABA78F6F-405C-4CBE-AE07-5887316FD8C6}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9A635048-C6AB-49C5-A0DC-CD5FF52997D3}
EndGlobalSection
EndGlobal
+38
View File
@@ -0,0 +1,38 @@
// TechDemo.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <stdio.h>
#include <stdint.h>
#include <xmmintrin.h>
__m128 __cdecl addps(__m128* ptr1, __m128* ptr2);
int main()
{
float c[4] = { 1,2,3,4 };
float c1[4] = { 1,2,3,4 };
__m128 m = _mm_loadu_ps(&c);
__m128 m1 = _mm_loadu_ps(&c1);
__m128 m3 = addps(&m,&m1);
printf("%f\t%f\t%f\t%f\t\n",
m3.m128_f32[0], m3.m128_f32[1], m3.m128_f32[2], m3.m128_f32[3]);
}
__m128 addps(__m128* ptr1, __m128* ptr2)
{
return _mm_add_ps(*ptr1,*ptr2);
}
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单
// 入门使用技巧:
// 1. 使用解决方案资源管理器窗口添加/管理文件
// 2. 使用团队资源管理器窗口连接到源代码管理
// 3. 使用输出窗口查看生成输出和其他消息
// 4. 使用错误列表窗口查看错误
// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{aba78f6f-405c-4cbe-ae07-5887316fd8c6}</ProjectGuid>
<RootNamespace>TechDemo</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TechDemo.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="TechDemo.c">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\TechDemo\x64\Debug\TechDemo.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.20348.0:
Debug|x64|D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\TechDemo\|

Some files were not shown because too many files have changed in this diff Show More