Download Latest Version demo_binaries.zip (260.6 kB)
Email in envelope

Get an email when there's a new version of GoFXMath

Home / doc / DOXYGEN / latex
Name Modified Size InfoDownloads / Week
Parent folder
ssemat44_8h.tex 2015-03-08 6.2 kB
ssemat__math__defs_8h.tex 2015-03-08 879 Bytes
ssevec_8h.tex 2015-03-08 28.1 kB
ssevec__math__defs_8h.tex 2015-03-08 18.0 kB
vec2_8h.tex 2015-03-08 868 Bytes
vec3_8h.tex 2015-03-08 894 Bytes
vec4_8h.tex 2015-03-08 894 Bytes
vecmath_8h.tex 2015-03-08 11.1 kB
group___s_i_m_d_vec_math.tex 2015-03-08 109.1 kB
group___s_i_s_d_mat_math.tex 2015-03-08 33.4 kB
group___s_i_s_d_scalar_math.tex 2015-03-08 16.0 kB
group___s_i_s_d_vec_math.tex 2015-03-08 60.2 kB
group___scalar_math_consts.tex 2015-03-08 21.3 kB
group___vec_math_defs.tex 2015-03-08 344 Bytes
hierarchy.tex 2015-03-08 719 Bytes
index.tex 2015-03-08 5.9 kB
make.bat 2015-03-08 677 Bytes
Makefile 2015-03-08 508 Bytes
mat44_8h.tex 2015-03-08 1.4 kB
math__defs_8h.tex 2015-03-08 15.4 kB
matmath_8h.tex 2015-03-08 4.2 kB
md__main__page.tex 2015-03-08 5.9 kB
modules.tex 2015-03-08 737 Bytes
namespacegfxmath.tex 2015-03-08 135.0 kB
namespaces.tex 2015-03-08 269 Bytes
quaternion_8h.tex 2015-03-08 829 Bytes
refman.tex 2015-03-08 4.8 kB
scalar__math_8h.tex 2015-03-08 4.0 kB
annotated.tex 2015-03-08 1.1 kB
classgfxmath_1_1_mat44.tex 2015-03-08 24.6 kB
classgfxmath_1_1_quaternion.eps 2015-03-08 3.8 kB
classgfxmath_1_1_quaternion.pdf 2015-03-08 2.8 kB
classgfxmath_1_1_quaternion.tex 2015-03-08 22.9 kB
classgfxmath_1_1_sse_mat44.tex 2015-03-08 37.5 kB
classgfxmath_1_1_vec2.tex 2015-03-08 19.3 kB
classgfxmath_1_1_vec3.tex 2015-03-08 34.6 kB
classgfxmath_1_1_vec4.eps 2015-03-08 3.8 kB
classgfxmath_1_1_vec4.pdf 2015-03-08 2.8 kB
classgfxmath_1_1_vec4.tex 2015-03-08 44.2 kB
dir_d44c64559bbebec7f509842c48db8b23.tex 2015-03-08 1.2 kB
doxygen.sty 2015-03-08 10.9 kB
files.tex 2015-03-08 2.3 kB
group___s_i_m_d_mat_math.tex 2015-03-08 480 Bytes
Totals: 43 Items   700.1 kB 0



G○FXMath

Introduction

The (G○F)(X) Math library (abbreviated GoFXMath) is a lightweight, but powerful, data-oriented math library focused on the development of graphics-oriented applications in C++.

Design

Given that the GoFXMath library is designed with data in mind, much of its functionality is overloaded between two major sections: SISD code and SIMD code.

SISD


The SISD code is all standard C++, and generally does not leverage the hardware or compiler for optimizations more than is absolutely necessary, keeping the code relatively fast without sacrificing too much readability. Given that the compiler will typically optimize standard C++ operations far better than most programmers ever could anyway, this doesn't affect the performance of the SISD code much.

SIMD


The SIMD side, on the other hand, almost exclusively utilizes intel® SSE intrinsics, and frequently makes use of some very low-level techniques. However, while these will somewhat reduce readability, many of the more common operations (such as absolute value, negation, etc.) have been written into helper functions. Additionally, the many of the intel® SSE functions have been given wrapper functions to improve their readability, and maintainability for future changes to SSE functions or additions of similar functionality from other libraries such as ARM NEON™. For example, _mm_mul_ps(__m128) is wrapped in VecMul(SseVec). It should be noted that almost all the functions in the SIMD portions are marked as inline, including the wrapper functions, and are fully defined in the header files. As well, GoFXMath library does not make use of .inl files, or split header files for inline functions; the declarations and definitions are fully contained in the same files.

It should be noted that the defined functions and constants for the GoFXMath library rely on big-endian logic for the SSE registers. That is to say that the logic incorporated positions the values in "reverse" order in the register from what the built-in sse functions use. The reason for this is to improve readability of complex SSE logic, and to prevent extra loading/unloading overhead when switching between the standard registers and the SSE registers. What this means is that when loading a Vec4 into or out from an SSE register, its values will not need to be reversed on each transfer, and can simply be loaded and unloaded in-order. Similarly, when calling one of the SetSseVec functions, the arguments passed are to be used in the same logical order for the desired vector (e.g. SetSseVec3(x,y,z) loads the SSE register with the values like this: <1.0f, z, y, x> where the 1.0f is used with calculations involving transformation matrices.

Requirements

The GoFXMath library doesn't have any particular dependencies attached to it. It has been built and tested with Visual C++ 2013 (32 and 64-bit versions, on Windows 7 64-bit), MinGW-w64 g++4.9.2 (64-bit version on Windows 7 64-bit), and GNU g++4.8.2 (Ubuntu 14.04.2 LTS 64-bit). As of yet, it has not been tested on an Apple machine, though the standard XCode C++ compiler should yield similarly successful results.

The GoFXMath library does make use of some C++11 features, so any compiler that should have any hope of building or using it would need to be up to at least the same level of C++11 standards as Visual C++ 12.

Additionally, as mentioned in the SIMD section, the GoFXMath library makes heavy use of intel® SSE functions. While most of this functionality is defined in earlier forms of the SSE intrinsics, some require SSE-4.1. However, most currently used, standard, consumer-grade CPUs should be able to accommodate this requirement, as it has had fairly wide support for quite some time.

Tests and Demo Projects

The prepackaged distribution files, in addition to the binaries and documentation, also contain the compiled test projects and a demo project written for OpenGL (using GLEW and GLFW).

Tests


The tests should build and run on any Windows 7 or higher machine, as well as any Linux distribution capable of running g++4.8.2 compiled libraries. The tests have been built with the Catch Testing Framework. Note that there are (sometimes significantly) more than one assertion-per-test, in many, if not most, of the test cases. The tests are written this way due to the fact that the catch framework offers a method of posing an assert while not forcing a halt on a specific test case, and all the tests have been written with this method in mind. There are also numerous fringe-cases when working with matrices and vectors (especially SSE vectors) that must be accounted for to maintain the expected mathematical behavior.

More information on how to run (or even add to) the tests can be found on the Catch Testing Framework github page.

Demo


There are included windows and linux executables for the demo project. Naturally, the source code is included alongside the executable. As mentioned in the beginning of this section, the demo project uses GLEW and GLFW, and will require both to be properly linked before it can be built.

Source: README.md, updated 2015-03-08