From 7f2ce261b22ca76b47a2c68bc4067f8d1f6df22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sun, 15 Sep 2013 22:25:43 +0000 Subject: [PATCH] [OSMESA] - enable x86 optimisations for GCC builds svn path=/trunk/; revision=60155 --- .../dll/opengl/mesa/src/mesa/CMakeLists.txt | 13 ++ .../src/mesa/drivers/osmesa/CMakeLists.txt | 4 +- .../opengl/mesa/src/mesa/x86/CMakeLists.txt | 31 ++++ .../dll/opengl/mesa/src/mesa/x86/matypes.h | 162 ++++++++++++++++++ 4 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 reactos/dll/opengl/mesa/src/mesa/x86/CMakeLists.txt create mode 100644 reactos/dll/opengl/mesa/src/mesa/x86/matypes.h diff --git a/reactos/dll/opengl/mesa/src/mesa/CMakeLists.txt b/reactos/dll/opengl/mesa/src/mesa/CMakeLists.txt index acc36dd0cd3..a21b68fff48 100644 --- a/reactos/dll/opengl/mesa/src/mesa/CMakeLists.txt +++ b/reactos/dll/opengl/mesa/src/mesa/CMakeLists.txt @@ -14,6 +14,19 @@ add_definitions( -D_GLAPI_NO_EXPORTS # prevent _glapi_* from being declared __declspec(dllimport) ) +if((ARCH STREQUAL "i386") AND (NOT MSVC)) + add_definitions( + -DUSE_X86_ASM + -DUSE_MMX_ASM + -DUSE_3DNOW_ASM + -DUSE_SSE_ASM + ) + add_subdirectory(x86) + set(mesa_asm_lib mesa_x86) +else() + set(mesa_asm_lib) +endif() + add_subdirectory(drivers/common) add_subdirectory(drivers/osmesa) add_subdirectory(main) diff --git a/reactos/dll/opengl/mesa/src/mesa/drivers/osmesa/CMakeLists.txt b/reactos/dll/opengl/mesa/src/mesa/drivers/osmesa/CMakeLists.txt index a1246bb73d6..7c39a6c1976 100644 --- a/reactos/dll/opengl/mesa/src/mesa/drivers/osmesa/CMakeLists.txt +++ b/reactos/dll/opengl/mesa/src/mesa/drivers/osmesa/CMakeLists.txt @@ -15,7 +15,9 @@ target_link_libraries(osmesa mesa_vbo mesa_program mesa_math - mesa_glsl) + mesa_glsl + ${mesa_asm_lib} +) set_module_type(osmesa win32dll) add_importlibs(osmesa msvcrt kernel32 ntdll) diff --git a/reactos/dll/opengl/mesa/src/mesa/x86/CMakeLists.txt b/reactos/dll/opengl/mesa/src/mesa/x86/CMakeLists.txt new file mode 100644 index 00000000000..3648858aa26 --- /dev/null +++ b/reactos/dll/opengl/mesa/src/mesa/x86/CMakeLists.txt @@ -0,0 +1,31 @@ + +list(APPEND SOURCE + common_x86.c + x86_xform.c + 3dnow.c + sse.c + common_x86_asm.S + x86_xform2.S + x86_xform3.S + x86_xform4.S + x86_cliptest.S + mmx_blend.S + 3dnow_xform1.S + 3dnow_xform2.S + 3dnow_xform3.S + 3dnow_xform4.S + 3dnow_normal.S + sse_xform1.S + sse_xform2.S + sse_xform3.S + sse_xform4.S + sse_normal.S + read_rgba_span_x86.S + rtasm/x86sse.c +) + +add_library(mesa_x86 STATIC ${SOURCE}) + +if(NOT MSVC) + add_compile_flags("-Wno-format") +endif() diff --git a/reactos/dll/opengl/mesa/src/mesa/x86/matypes.h b/reactos/dll/opengl/mesa/src/mesa/x86/matypes.h new file mode 100644 index 00000000000..a3855f7ff46 --- /dev/null +++ b/reactos/dll/opengl/mesa/src/mesa/x86/matypes.h @@ -0,0 +1,162 @@ +/* + * This file is automatically generated from the Mesa internal type + * definitions. Do not edit directly. + */ + +#ifndef __ASM_TYPES_H__ +#define __ASM_TYPES_H__ + + + +/* ============================================================= + * Offsets for struct gl_context + */ + +#define CTX_DRIVER_CTX 880 + +#define CTX_LIGHT_ENABLED 39952 +#define CTX_LIGHT_SHADE_MODEL 39956 +#define CTX_LIGHT_COLOR_MAT_FACE 39964 +#define CTX_LIGHT_COLOR_MAT_MODE 39968 +#define CTX_LIGHT_COLOR_MAT_MASK 39972 +#define CTX_LIGHT_COLOR_MAT_ENABLED 39976 +#define CTX_LIGHT_ENABLED_LIST 39988 +#define CTX_LIGHT_NEED_VERTS 44341 +#define CTX_LIGHT_FLAGS 44344 +#define CTX_LIGHT_BASE_COLOR 44348 + + +/* ============================================================= + * Offsets for struct vertex_buffer + */ + +#define VB_SIZE 0 +#define VB_COUNT 4 + +#define VB_ELTS 8 +#define VB_OBJ_PTR 60 +#define VB_EYE_PTR 12 +#define VB_CLIP_PTR 16 +#define VB_PROJ_CLIP_PTR 20 +#define VB_CLIP_OR_MASK 24 +#define VB_CLIP_MASK 28 +#define VB_NORMAL_PTR 68 +#define VB_EDGE_FLAG 36 +#define VB_TEX0_COORD_PTR 92 +#define VB_TEX1_COORD_PTR 96 +#define VB_TEX2_COORD_PTR 100 +#define VB_TEX3_COORD_PTR 104 +#define VB_INDEX_PTR 84 +#define VB_COLOR_PTR 72 +#define VB_SECONDARY_COLOR_PTR 76 +#define VB_FOG_COORD_PTR 80 +#define VB_PRIMITIVE 52 + + +/* + * Flags for struct vertex_buffer + */ + +#define VERT_BIT_OBJ 0x1 +#define VERT_BIT_NORM 0x4 +#define VERT_BIT_RGBA 0x8 +#define VERT_BIT_SPEC_RGB 0x10 +#define VERT_BIT_FOG_COORD 0x20 +#define VERT_BIT_TEX0 0x100 +#define VERT_BIT_TEX1 0x200 +#define VERT_BIT_TEX2 0x400 +#define VERT_BIT_TEX3 0x800 + + +/* ============================================================= + * Offsets for GLvector4f + */ + +#define V4F_DATA 0 +#define V4F_START 4 +#define V4F_COUNT 8 +#define V4F_STRIDE 12 +#define V4F_SIZE 16 +#define V4F_FLAGS 20 + +/* + * Flags for GLvector4f + */ + +#define VEC_MALLOC 0x10 +#define VEC_NOT_WRITEABLE 0x40 +#define VEC_BAD_STRIDE 0x100 + +#define VEC_SIZE_1 0x1 +#define VEC_SIZE_2 0x3 +#define VEC_SIZE_3 0x7 +#define VEC_SIZE_4 0xf + + +/* ============================================================= + * Offsets for GLmatrix + */ + +#define MATRIX_DATA 0 +#define MATRIX_INV 4 +#define MATRIX_FLAGS 8 +#define MATRIX_TYPE 12 + + +/* ============================================================= + * Offsets for struct gl_light + */ + +#define LIGHT_NEXT 0 +#define LIGHT_PREV 4 + +#define LIGHT_AMBIENT 8 +#define LIGHT_DIFFUSE 24 +#define LIGHT_SPECULAR 40 +#define LIGHT_EYE_POSITION 56 +#define LIGHT_SPOT_DIRECTION 72 +#define LIGHT_SPOT_EXPONENT 88 +#define LIGHT_SPOT_CUTOFF 92 +#define LIGHT_COS_CUTOFF 100 +#define LIGHT_CONST_ATTEN 104 +#define LIGHT_LINEAR_ATTEN 108 +#define LIGHT_QUADRATIC_ATTEN 112 +#define LIGHT_ENABLED 116 + +#define LIGHT_FLAGS 120 + +#define LIGHT_POSITION 124 +#define LIGHT_VP_INF_NORM 140 +#define LIGHT_H_INF_NORM 152 +#define LIGHT_NORM_DIRECTION 164 +#define LIGHT_VP_INF_SPOT_ATTEN 180 + +#define LIGHT_SPOT_EXP_TABLE 184 +#define LIGHT_MAT_AMBIENT 4280 +#define LIGHT_MAT_DIFFUSE 4304 +#define LIGHT_MAT_SPECULAR 4328 + +#define SIZEOF_GL_LIGHT 4352 + +/* + * Flags for struct gl_light + */ + +#define LIGHT_SPOT 0x1 +#define LIGHT_LOCAL_VIEWER 0x2 +#define LIGHT_POSITIONAL 0x4 + +#define LIGHT_NEED_VERTICES 0x6 + + +/* ============================================================= + * Offsets for struct gl_lightmodel + */ + +#define LIGHT_MODEL_AMBIENT 0 +#define LIGHT_MODEL_LOCAL_VIEWER 16 +#define LIGHT_MODEL_TWO_SIDE 17 +#define LIGHT_MODEL_COLOR_CONTROL 20 + + +#endif /* __ASM_TYPES_H__ */