diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-08 00:46:19 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-08 00:47:32 +0400 |
commit | 8d084e8c8f48dd2f07d4a3fbd4a941a7bcc0dcfb (patch) | |
tree | 5bf15f4f74f3e5a307cfa3f734b2cd086dca69bd /source/blender | |
parent | a8705e99ee8ec9de2f25c3bac1e9895c2f98c224 (diff) |
Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
Diffstat (limited to 'source/blender')
106 files changed, 558 insertions, 165 deletions
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 2debe516dd7..346d5bc64b8 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -26,11 +26,13 @@ set(INC ../blenkernel ../blenlib ../editors/include + ../gpu ../makesdna ../makesrna ../python ../imbuf ../../../intern/guardedalloc + ../../../intern/glew-mx ../../../intern/locale ) @@ -58,7 +60,7 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 1c573fa4a59..b6cf052a980 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -35,10 +35,12 @@ incs = [ 'intern', '#/intern/guardedalloc', '#/intern/locale', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../blenkernel', '../blenlib', '../editors/include', + '../gpu', '../imbuf', '../makesdna', '../makesrna', @@ -47,7 +49,7 @@ incs = [ incs.extend(Split(env['BF_FREETYPE_INC'])) -defs = ['GLEW_STATIC'] +defs = env['BF_GL_DEFINITIONS'] if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': defs.append('_WIN32') diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index fd201fed9e7..f4a3a0c10dd 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -38,6 +38,7 @@ set(INC ../nodes ../render/extern/include ../../../intern/guardedalloc + ../../../intern/glew-mx ../../../intern/iksolver/extern ../../../intern/memutil ../../../intern/mikktspace @@ -272,7 +273,7 @@ set(SRC intern/pbvh_intern.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) if(WITH_AUDASPACE) list(APPEND INC diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 25f8422afed..9243c85167b 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -45,7 +45,8 @@ incs = [ '#/intern/raskter', '#/intern/rigidbody', '#/extern/bullet2/src', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/audaspace/intern', '#/intern/elbeem/extern', '#/intern/iksolver/extern', @@ -65,14 +66,11 @@ incs = [ '../nodes', '../render/extern/include', '../windowmanager', - env['BF_OPENGL_INC'], env['BF_ZLIB_INC'], ] incs = ' '.join(incs) -defs = [ - 'GLEW_STATIC', - ] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_SMOKE']: defs.append('WITH_SMOKE') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 3aa4e0abbba..81c03d8081b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -72,11 +72,10 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm); #include "BLI_sys_types.h" /* for intptr_t support */ -#include "GL/glew.h" - #include "GPU_buffers.h" #include "GPU_draw.h" #include "GPU_extensions.h" +#include "GPU_glew.h" #include "GPU_material.h" /* very slow! enable for testing only! */ diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index cad062ac63d..bfc70c91181 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -34,8 +34,6 @@ * \ingroup bke */ -#include "GL/glew.h" - #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" @@ -62,6 +60,7 @@ #include "GPU_buffers.h" #include "GPU_draw.h" #include "GPU_extensions.h" +#include "GPU_glew.h" #include "GPU_material.h" #include <string.h> diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 40a4bc22ce9..ce7804d9878 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -41,8 +41,6 @@ * is likely to be a little slow. */ -#include "GL/glew.h" - #include "BLI_math.h" #include "BLI_jitter.h" #include "BLI_bitmap.h" @@ -58,6 +56,7 @@ #include "MEM_guardedalloc.h" #include "GPU_extensions.h" +#include "GPU_glew.h" extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */ diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index ccedb6f6b71..3e763016efb 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1644,7 +1644,7 @@ void BKE_pbvh_raycast_project_ray_root (PBVH *bvh, bool original, float ray_star } -//#include <GL/glew.h> +//#include "GPU_glew.h" typedef struct { DMSetMaterial setMaterial; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 89245d2300d..90ac712e55a 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -33,8 +33,6 @@ /* Part of the code copied from elbeem fluid library, copyright by Nils Thuerey */ -#include <GL/glew.h> - #include "MEM_guardedalloc.h" #include <float.h> @@ -84,6 +82,8 @@ #include "RE_shader_ext.h" +#include "GPU_glew.h" + /* UNUSED so far, may be enabled later */ /* #define USE_SMOKE_COLLISION_DM */ diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 2e96eecebcf..0bd9517dcfd 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -72,10 +72,9 @@ # include "BLI_array.h" #endif -#include "GL/glew.h" - #include "GPU_draw.h" #include "GPU_extensions.h" +#include "GPU_glew.h" #include "GPU_material.h" #include "CCGSubSurf.h" diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index d6030a967d5..b9f50a6cdf1 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -23,10 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -57,4 +59,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript index 91d480978c4..ed4b794cbce 100644 --- a/source/blender/editors/animation/SConscript +++ b/source/blender/editors/animation/SConscript @@ -31,17 +31,19 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 9aa17f1e503..fc211f0e60b 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -23,11 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager - ../../gpu ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -74,4 +75,6 @@ if(WITH_OPENNL) ) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript index c68045c9398..97bc1a138b3 100644 --- a/source/blender/editors/armature/SConscript +++ b/source/blender/editors/armature/SConscript @@ -31,20 +31,21 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/opennl/extern', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', - '../../gpu', '../../windowmanager', ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 904ad4892ed..5dc9679777f 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -24,10 +24,12 @@ set(INC ../../blenkernel ../../blenlib ../../imbuf + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -50,4 +52,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/gpencil/SConscript b/source/blender/editors/gpencil/SConscript index 8b891fcb8cf..ab42bad52dc 100644 --- a/source/blender/editors/gpencil/SConscript +++ b/source/blender/editors/gpencil/SConscript @@ -31,7 +31,8 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/elbeem/extern', '../include', '../../blenfont', @@ -46,7 +47,7 @@ incs = [ '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h index 9fa603966b6..cd26bb22ada 100644 --- a/source/blender/editors/include/BIF_gl.h +++ b/source/blender/editors/include/BIF_gl.h @@ -33,7 +33,7 @@ #ifndef __BIF_GL_H__ #define __BIF_GL_H__ -#include "GL/glew.h" +#include "GPU_glew.h" #ifdef __APPLE__ diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index e13517adbb3..b921d17104c 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -30,6 +30,7 @@ set(INC ../../python ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -70,4 +71,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript index 1936e17a7bb..303ab7ff286 100644 --- a/source/blender/editors/interface/SConscript +++ b/source/blender/editors/interface/SConscript @@ -31,7 +31,8 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', @@ -45,7 +46,7 @@ incs = [ '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt index b1cf6db3144..033d034cf4e 100644 --- a/source/blender/editors/mask/CMakeLists.txt +++ b/source/blender/editors/mask/CMakeLists.txt @@ -25,10 +25,12 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -48,4 +50,6 @@ set(SRC mask_intern.h ) +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_mask "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/mask/SConscript b/source/blender/editors/mask/SConscript index 9dd521e3a7c..bcbaaa34960 100644 --- a/source/blender/editors/mask/SConscript +++ b/source/blender/editors/mask/SConscript @@ -29,14 +29,16 @@ Import ('env') sources = env.Glob('*.c') -defs = [] +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 0cb2dd1eb68..db20d42f39d 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -32,6 +32,7 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -86,4 +87,6 @@ if(WITH_BULLET) add_definitions(-DWITH_BULLET) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 6fa48c12eca..122a7501e58 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -29,11 +29,12 @@ Import ('env') sources = env.Glob('*.c') -defs = [] +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../uvedit', '../../blenfont', diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 1bb35b65918..9b380ff8d48 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -33,10 +33,11 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS - + ${GLEW_INCLUDE_PATH} ) set(SRC @@ -62,6 +63,8 @@ set(SRC object_intern.h ) +add_definitions(${GL_DEFINITIONS}) + if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 892d71befb4..40d555226f3 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -23,11 +23,13 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/elbeem/extern ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -64,4 +66,6 @@ if(WITH_BULLET) add_definitions(-DWITH_BULLET) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index 9436280de43..983d1c4b4ba 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -31,20 +31,22 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/rigidbody', - '#/extern/glew/include', '#/intern/elbeem/extern', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 24015bd4ea3..42dafc076ed 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -32,6 +32,7 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -64,6 +65,8 @@ if(WITH_HEADLESS) add_definitions(-DWITH_HEADLESS) endif() +add_definitions(${GL_DEFINITIONS}) + if(WITH_FREESTYLE) list(APPEND INC ../../freestyle diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript index 41576f9b485..cbb7988695b 100644 --- a/source/blender/editors/render/SConscript +++ b/source/blender/editors/render/SConscript @@ -31,7 +31,8 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/elbeem/extern', '../include', '../../blenfont', @@ -48,7 +49,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index ecf5e962c80..559c86bf48c 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -31,8 +31,6 @@ #include <string.h> #include <stddef.h> -#include <GL/glew.h> - #include "MEM_guardedalloc.h" #include "BLI_math.h" @@ -69,6 +67,7 @@ #include "RNA_define.h" #include "GPU_extensions.h" +#include "GPU_glew.h" #include "wm_window.h" diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index 4ff1767f582..413d40b9f9c 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -30,6 +30,7 @@ set(INC ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -51,4 +52,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript index 28a6cbb02e6..f5442c7ea63 100644 --- a/source/blender/editors/screen/SConscript +++ b/source/blender/editors/screen/SConscript @@ -31,7 +31,8 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', @@ -45,7 +46,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 18db57c9f21..0fa5f2d9837 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -32,6 +32,7 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -64,4 +65,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript index b0118fbbf53..233f562fcc7 100644 --- a/source/blender/editors/sculpt_paint/SConscript +++ b/source/blender/editors/sculpt_paint/SConscript @@ -29,11 +29,12 @@ Import ('env') sources = env.Glob('*.c') -defs = [] +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../uvedit', '../../blenfont', diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt index e0dc2709cf3..96a1e74c882 100644 --- a/source/blender/editors/space_action/CMakeLists.txt +++ b/source/blender/editors/space_action/CMakeLists.txt @@ -22,10 +22,12 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -42,4 +44,6 @@ set(SRC action_intern.h ) +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_action/SConscript b/source/blender/editors/space_action/SConscript index 2776bd2989a..2e2081b3c6e 100644 --- a/source/blender/editors/space_action/SConscript +++ b/source/blender/editors/space_action/SConscript @@ -29,16 +29,20 @@ Import ('env') sources = env.Glob('*.c') +defs = env['BF_GL_DEFINITIONS'] + incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', ] incs = ' '.join(incs) -env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), [], libtype=['core'], priority=[40] ) +env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), defs, libtype=['core'], priority=[40] ) diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt index 9e045a39a0c..01a099e3701 100644 --- a/source/blender/editors/space_buttons/CMakeLists.txt +++ b/source/blender/editors/space_buttons/CMakeLists.txt @@ -23,10 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -46,6 +48,8 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript index 61f9b6f496e..07fe17e302b 100644 --- a/source/blender/editors/space_buttons/SConscript +++ b/source/blender/editors/space_buttons/SConscript @@ -31,12 +31,14 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', '../../bmesh', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -44,7 +46,8 @@ incs = [ '../../windowmanager', ] incs = ' '.join(incs) -defs = [] + +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index 7689aa28169..4659e612b41 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -27,11 +27,12 @@ set(INC ../../blenfont ../../blenlib ../../imbuf + ../../gpu ../../makesdna ../../makesrna ../../windowmanager - ../../gpu ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -56,6 +57,8 @@ set(SRC clip_intern.h ) +add_definitions(${GL_DEFINITIONS}) + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/space_clip/SConscript b/source/blender/editors/space_clip/SConscript index d4483eda6e3..8fec4ebf0fa 100644 --- a/source/blender/editors/space_clip/SConscript +++ b/source/blender/editors/space_clip/SConscript @@ -28,10 +28,13 @@ Import ('env') sources = env.Glob('*.c') -defs = [] + +defs = env['BF_GL_DEFINITIONS'] + incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt index 241a48c1e2d..ecfb1f0e0df 100644 --- a/source/blender/editors/space_console/CMakeLists.txt +++ b/source/blender/editors/space_console/CMakeLists.txt @@ -23,10 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -45,4 +47,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_console/SConscript b/source/blender/editors/space_console/SConscript index 0395a33cd97..87d12fe34bd 100644 --- a/source/blender/editors/space_console/SConscript +++ b/source/blender/editors/space_console/SConscript @@ -28,16 +28,19 @@ Import ('env') sources = env.Glob('*.c') -defs = [] + +defs = env['BF_GL_DEFINITIONS'] incs = [ '../include', - '#/extern/glew/include', '#/intern/guardedalloc', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../../makesdna', '../../makesrna', '../../blenkernel', '../../blenlib', + '../../gpu', '../../windowmanager', '../../blenfont', ] diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index 3b2db3ee7bc..fc007a659b4 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -25,11 +25,13 @@ set(INC ../../blenlib ../../blenloader ../../imbuf + ../../gpu ../../makesdna ../../makesrna ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -86,6 +88,8 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript index d42394454eb..85c3e073922 100644 --- a/source/blender/editors/space_file/SConscript +++ b/source/blender/editors/space_file/SConscript @@ -30,12 +30,14 @@ Import ('env') sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', '../../blenloader', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -44,7 +46,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_OPENJPEG']: defs.append('WITH_OPENJPEG') diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index d3fb87204fb..0a29810ff3d 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -23,10 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -56,4 +58,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_graph/SConscript b/source/blender/editors/space_graph/SConscript index 8ddeb0ccfe8..35e09749743 100644 --- a/source/blender/editors/space_graph/SConscript +++ b/source/blender/editors/space_graph/SConscript @@ -31,19 +31,21 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/audaspace/intern', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 62ac3c2d985..30bfc2fbdfd 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -23,14 +23,15 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib - ../../imbuf ../../bmesh + ../../imbuf + ../../gpu ../../makesdna ../../makesrna ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc - ../../gpu + ../../../../intern/glew-mx ) set(INC_SYS @@ -71,4 +72,6 @@ if(WITH_IMAGE_CINEON) add_definitions(-DWITH_CINEON) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index d878a726b55..e983db431b4 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -31,12 +31,14 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', '../../bmesh', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -46,7 +48,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt index 94b40a9f40a..46ea251de03 100644 --- a/source/blender/editors/space_info/CMakeLists.txt +++ b/source/blender/editors/space_info/CMakeLists.txt @@ -26,10 +26,12 @@ set(INC ../../blenloader ../../imbuf ../../bmesh + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -52,4 +54,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_info/SConscript b/source/blender/editors/space_info/SConscript index 2a1419984c6..378940805da 100644 --- a/source/blender/editors/space_info/SConscript +++ b/source/blender/editors/space_info/SConscript @@ -31,13 +31,15 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', '../../blenloader', '../../bmesh', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -45,7 +47,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index af2e8476511..19525c87923 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -24,10 +24,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -47,6 +49,8 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() +add_definitions(${GL_DEFINITIONS}) + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript index ae8e929a684..067073fab22 100644 --- a/source/blender/editors/space_logic/SConscript +++ b/source/blender/editors/space_logic/SConscript @@ -31,12 +31,14 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../interface', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -44,7 +46,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index a74fc3191b7..ab0dfa30121 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -23,10 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -49,4 +51,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_nla/SConscript b/source/blender/editors/space_nla/SConscript index a00337e0b58..9e743d918b9 100644 --- a/source/blender/editors/space_nla/SConscript +++ b/source/blender/editors/space_nla/SConscript @@ -31,18 +31,20 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 6b0460ce5cd..34887f8388d 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -32,6 +32,7 @@ set(INC ../../windowmanager ../../compositor ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -64,4 +65,6 @@ if(WITH_COMPOSITOR) add_definitions(-DWITH_COMPOSITOR) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript index 94756b96035..435a78f1b7e 100644 --- a/source/blender/editors/space_node/SConscript +++ b/source/blender/editors/space_node/SConscript @@ -31,7 +31,8 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', @@ -47,7 +48,8 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] + cf = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): #cf.append('/WX') diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index 4db47b75502..b716f0671bd 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -24,10 +24,12 @@ set(INC ../../blenlib ../../blenfont ../../imbuf + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -50,4 +52,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_outliner/SConscript b/source/blender/editors/space_outliner/SConscript index db8041f0235..cc02c9555a9 100644 --- a/source/blender/editors/space_outliner/SConscript +++ b/source/blender/editors/space_outliner/SConscript @@ -28,15 +28,18 @@ Import ('env') sources = env.Glob('*.c') -defs = [] + +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt index 26c4183f7df..2eb31576c57 100644 --- a/source/blender/editors/space_script/CMakeLists.txt +++ b/source/blender/editors/space_script/CMakeLists.txt @@ -22,10 +22,12 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -47,4 +49,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_script/SConscript b/source/blender/editors/space_script/SConscript index acb0bf9f20b..e749780a4aa 100644 --- a/source/blender/editors/space_script/SConscript +++ b/source/blender/editors/space_script/SConscript @@ -31,10 +31,12 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenkernel', '../../blenlib', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -42,7 +44,7 @@ incs = [ '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index db5729a5762..4cf9c0c95c2 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -24,10 +24,12 @@ set(INC ../../blenkernel ../../blenlib ../../imbuf + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -60,4 +62,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript index 5aae30244a7..954f8abff69 100644 --- a/source/blender/editors/space_sequencer/SConscript +++ b/source/blender/editors/space_sequencer/SConscript @@ -31,19 +31,21 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/audaspace/intern', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs.append(env['BF_PTHREADS_INC']) diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index bfeeb93372a..5367efbf84b 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -23,10 +23,12 @@ set(INC ../../blenfont ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -48,6 +50,8 @@ set(SRC text_intern.h ) +add_definitions(${GL_DEFINITIONS}) + if(WITH_PYTHON) list(APPEND INC ../../python diff --git a/source/blender/editors/space_text/SConscript b/source/blender/editors/space_text/SConscript index 3f617f95c58..8ee9bd745dd 100644 --- a/source/blender/editors/space_text/SConscript +++ b/source/blender/editors/space_text/SConscript @@ -28,14 +28,18 @@ Import ('env') sources = env.Glob('*.c') -defs = [] + +defs = env['BF_GL_DEFINITIONS'] + incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt index b42ae3ab725..90af405eaa8 100644 --- a/source/blender/editors/space_time/CMakeLists.txt +++ b/source/blender/editors/space_time/CMakeLists.txt @@ -22,10 +22,12 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -39,4 +41,6 @@ set(SRC time_intern.h ) +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_time "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_time/SConscript b/source/blender/editors/space_time/SConscript index bf1b918f4f1..5a9e9a4cb42 100644 --- a/source/blender/editors/space_time/SConscript +++ b/source/blender/editors/space_time/SConscript @@ -31,15 +31,17 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] env.BlenderLib('bf_editors_space_time', sources, incs, defs, libtype=['core'], priority=[65]) diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index 97c328dbac2..320267a4a7c 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -31,6 +31,7 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ../../../../intern/smoke/extern ) @@ -76,7 +77,7 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript index e6658ab3c49..a21da940906 100644 --- a/source/blender/editors/space_view3d/SConscript +++ b/source/blender/editors/space_view3d/SConscript @@ -28,11 +28,13 @@ Import ('env') sources = env.Glob('*.c') -defs = [ 'GLEW_STATIC' ] + +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/smoke/extern', '#/source/gameengine/BlenderRoutines', '../include', diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 3ad5d94efd6..0c360474b78 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -30,6 +30,7 @@ set(INC ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -54,4 +55,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript index 4f47062e3a3..e249856b747 100644 --- a/source/blender/editors/transform/SConscript +++ b/source/blender/editors/transform/SConscript @@ -31,20 +31,21 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', '../../bmesh', + '../../gpu', '../../ikplugin', '../../makesdna', '../../makesrna', - '../../gpu', '../../windowmanager', ] -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 4400870f1b8..f4189a18da4 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -24,10 +24,12 @@ set(INC ../../blenkernel ../../blenlib ../../bmesh + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -91,7 +93,7 @@ set(SRC ../include/UI_view2d.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) diff --git a/source/blender/editors/util/SConscript b/source/blender/editors/util/SConscript index 0876fe48c91..d695a848f4e 100644 --- a/source/blender/editors/util/SConscript +++ b/source/blender/editors/util/SConscript @@ -28,16 +28,19 @@ Import ('env') sources = env.Glob('*.c') -defs = [ 'GLEW_STATIC' ] + +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenfont', '../../blenkernel', '../../blenlib', '../../bmesh', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 45edbde7482..74ba1672485 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -24,10 +24,12 @@ set(INC ../../blenlib ../../blenfont ../../bmesh + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -57,4 +59,6 @@ if(WITH_OPENNL) ) endif() +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/uvedit/SConscript b/source/blender/editors/uvedit/SConscript index 413503191cd..7153d25188b 100644 --- a/source/blender/editors/uvedit/SConscript +++ b/source/blender/editors/uvedit/SConscript @@ -27,13 +27,14 @@ Import ('env') -defs = [] +defs = env['BF_GL_DEFINITIONS'] sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/opennl/extern', '../include', '../../blenfont', diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 13e46bc7de8..63eea9486ed 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -36,6 +36,7 @@ set(INC ../nodes ../nodes/intern + ../../../intern/glew-mx ../../../intern/guardedalloc ../../../intern/smoke/extern ) @@ -49,6 +50,7 @@ set(SRC intern/gpu_codegen.c intern/gpu_draw.c intern/gpu_extensions.c + intern/gpu_init_exit.c intern/gpu_material.c intern/gpu_simple_shader.c intern/gpu_select.c @@ -56,10 +58,13 @@ set(SRC GPU_buffers.h GPU_draw.h GPU_extensions.h + GPU_glew.h + GPU_init_exit.h GPU_material.h GPU_simple_shader.h GPU_select.h intern/gpu_codegen.h + intern/gpu_extensions_private.h ) data_to_c_simple(shaders/gpu_shader_material.glsl SRC) @@ -79,7 +84,7 @@ if(WITH_MOD_SMOKE) add_definitions(-DWITH_SMOKE) endif() -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) if(WITH_IMAGE_DDS) add_definitions(-DWITH_DDS) diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 04c4119df6e..3daf8585539 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -55,8 +55,6 @@ typedef struct GPUShader GPUShader; /* GPU extensions support */ void GPU_extensions_disable(void); -void GPU_extensions_init(void); /* call this before running any of the functions below */ -void GPU_extensions_exit(void); int GPU_print_error(const char *str); int GPU_glsl_support(void); diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h new file mode 100644 index 00000000000..94217863fd6 --- /dev/null +++ b/source/blender/gpu/GPU_glew.h @@ -0,0 +1,37 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2012 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Jason Wilkins. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file source/blender/gpu/GPU_glew.h + * \ingroup gpu + */ + +#ifndef __GPU_GLEW_H__ +#define __GPU_GLEW_H__ + +#include "glew-mx.h" + +#endif /* __GPU_GLEW_H__ */ diff --git a/source/blender/gpu/GPU_init_exit.h b/source/blender/gpu/GPU_init_exit.h new file mode 100644 index 00000000000..e89c970b7d9 --- /dev/null +++ b/source/blender/gpu/GPU_init_exit.h @@ -0,0 +1,46 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Jason Wilkins. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/gpu/GPU_init_exit.h + * \ingroup gpu + */ + +#ifndef __GPU_INIT_EXIT_H__ +#define __GPU_INIT_EXIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void GPU_init(void); +void GPU_exit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __GPU_INIT_EXIT_H__ */ diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 8d44ad87916..a111401343e 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -34,6 +34,8 @@ #include "DNA_listBase.h" +#include "BLI_sys_types.h" /* for bool */ + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript index e9320f08eff..f11ecafc986 100644 --- a/source/blender/gpu/SConscript +++ b/source/blender/gpu/SConscript @@ -30,13 +30,14 @@ Import ('env') sources = env.Glob('intern/*.c') sources += env.Glob('shaders/*.c') -defs = [ 'GLEW_STATIC' ] +defs = env['BF_GL_DEFINITIONS'] incs = [ '.', + '#/intern/glew-mx', '#/intern/guardedalloc', + env['BF_GLEW_INC'], '#/intern/smoke/extern', - '#/extern/glew/include', '../blenkernel', '../blenlib', '../bmesh', @@ -46,7 +47,6 @@ incs = [ '../makesrna', '../nodes', '../nodes/intern', - env['BF_OPENGL_INC'], ] if env['WITH_BF_GAMEENGINE']: diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 5d2c9cd3a90..b5a576b509c 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -36,7 +36,7 @@ #include <stddef.h> #include <string.h> -#include "GL/glew.h" +#include "GPU_glew.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 6b46db89a93..322d37055db 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -31,7 +31,7 @@ * Convert material node-trees to GLSL. */ -#include "GL/glew.h" +#include "GPU_glew.h" #include "MEM_guardedalloc.h" @@ -242,12 +242,12 @@ GPUFunction *GPU_lookup_function(const char *name) return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name); } -void GPU_codegen_init(void) +void gpu_codegen_init(void) { GPU_code_generate_glsl_lib(); } -void GPU_codegen_exit(void) +void gpu_codegen_exit(void) { extern Material defmaterial; // render module abuse... diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index b6db923e5c2..69213925931 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -35,7 +35,7 @@ #include "DNA_listBase.h" #include "GPU_material.h" -#include "GL/glew.h" +#include "GPU_glew.h" struct ListBase; struct GPUShader; @@ -106,7 +106,7 @@ struct GPUNodeLink { int type; int users; - GPUTexture *dynamictex; + struct GPUTexture *dynamictex; GPUBuiltin builtin; GPUOpenGLBuiltin oglbuiltin; @@ -146,7 +146,7 @@ typedef struct GPUInput { float *dynamicvec; /* vector data in case it is dynamic */ int dynamictype; /* origin of the dynamic uniform (GPUDynamicType) */ void *dynamicdata; /* data source of the dynamic uniform */ - GPUTexture *tex; /* input texture, only set at runtime */ + struct GPUTexture *tex; /* input texture, only set at runtime */ int shaderloc; /* id from opengl */ char shadername[32]; /* name in shader */ @@ -185,8 +185,8 @@ void GPU_pass_unbind(GPUPass *pass); void GPU_pass_free(GPUPass *pass); -void GPU_codegen_init(void); -void GPU_codegen_exit(void); +void gpu_codegen_init(void); +void gpu_codegen_exit(void); /* Material calls */ diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 7295f0259c5..a4435a7d276 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -38,7 +38,7 @@ #include <string.h> -#include "GL/glew.h" +#include "GPU_glew.h" #include "BLI_blenlib.h" #include "BLI_linklist.h" @@ -1878,6 +1878,37 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][ return count; } +static void gpu_multisample(bool enable) +{ + if (GLEW_VERSION_1_3 || GLEW_ARB_multisample) { +#ifdef __linux__ + /* changing multisample enablement from the default (enabled) causes problems on some + * systems (NVIDIA/Linux) when the pixel format doesn't have a multisample buffer */ + bool toggle_ok = true; + + if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_UNIX, GPU_DRIVER_ANY)) { + int samples = 0; + glGetIntegerv(GL_SAMPLES, &samples); + + if (samples == 0) + toggle_ok = false; + } + + if (toggle_ok) { + if (enable) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); + } +#else + if (enable) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); +#endif + } +} + /* Default OpenGL State */ void GPU_state_init(void) @@ -1950,9 +1981,7 @@ void GPU_state_init(void) glCullFace(GL_BACK); glDisable(GL_CULL_FACE); - /* calling this makes drawing very slow when AA is not set up in ghost - * on Linux/NVIDIA. */ - // glDisable(GL_MULTISAMPLE); + gpu_multisample(false); } #ifdef DEBUG diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 7fabb2feb51..04f8e68431a 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -33,7 +33,7 @@ */ -#include "GL/glew.h" +#include "GPU_glew.h" #include "DNA_image_types.h" @@ -48,7 +48,9 @@ #include "GPU_draw.h" #include "GPU_extensions.h" #include "GPU_simple_shader.h" -#include "gpu_codegen.h" + +#include "intern/gpu_codegen.h" +#include "intern/gpu_extensions_private.h" #include <stdlib.h> #include <stdio.h> @@ -110,8 +112,6 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver) /* GPU Extensions */ -static int gpu_extensions_init = 0; - void GPU_extensions_disable(void) { GG.extdisabled = 1; @@ -122,18 +122,11 @@ int GPU_max_texture_size(void) return GG.maxtexsize; } -void GPU_extensions_init(void) +void gpu_extensions_init(void) { GLint r, g, b; const char *vendor, *renderer; - /* can't avoid calling this multiple times, see wm_window_add_ghostwindow */ - if (gpu_extensions_init) return; - gpu_extensions_init= 1; - - glewInit(); - GPU_codegen_init(); - /* glewIsSupported("GL_VERSION_2_0") */ if (GLEW_ARB_multitexture) @@ -233,10 +226,8 @@ void GPU_extensions_init(void) GPU_simple_shaders_init(); } -void GPU_extensions_exit(void) +void gpu_extensions_exit(void) { - gpu_extensions_init = 0; - GPU_codegen_exit(); GPU_simple_shaders_exit(); GPU_invalid_tex_free(); } diff --git a/source/blender/gpu/intern/gpu_extensions_private.h b/source/blender/gpu/intern/gpu_extensions_private.h new file mode 100644 index 00000000000..a4124b8fa3d --- /dev/null +++ b/source/blender/gpu/intern/gpu_extensions_private.h @@ -0,0 +1,32 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file gpu_extensions_private.h + * \ingroup gpu + */ + +#ifndef __GPU_EXTENSIONS_PRIVATE_H__ +#define __GPU_EXTENSIONS_PRIVATE_H__ + +/* call this before running any of the functions below */ +void gpu_extensions_init(void); +void gpu_extensions_exit(void); + +#endif /* __GPU_EXTENSIONS_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c new file mode 100644 index 00000000000..912774cd345 --- /dev/null +++ b/source/blender/gpu/intern/gpu_init_exit.c @@ -0,0 +1,68 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Jason Wilkins + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file source/blender/gpu/intern/gpu_init_exit.c + * \ingroup gpu + */ + +#include "BLI_sys_types.h" +#include "GPU_init_exit.h" /* interface */ +#include "GPU_extensions.h" /* library */ + +#include "intern/gpu_codegen.h" +#include "intern/gpu_extensions_private.h" + +/** + * although the order of initialization and shutdown should not matter + * (except for the extensions), I chose alphabetical and reverse alphabetical order + */ + +static bool initialized = false; + +void GPU_init(void) +{ + /* can't avoid calling this multiple times, see wm_window_add_ghostwindow */ + if (initialized) + return; + + initialized = true; + + gpu_extensions_init(); /* must come first */ + + gpu_codegen_init(); +} + + + +void GPU_exit(void) +{ + gpu_codegen_exit(); + + gpu_extensions_exit(); /* must come last */ + + initialized = false; +} diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 75fed46f62a..f91fd7a8c1e 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -35,8 +35,6 @@ #include <math.h> #include <string.h> -#include "GL/glew.h" - #include "MEM_guardedalloc.h" #include "DNA_lamp_types.h" diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c index 1d448231dda..afd6af9efae 100644 --- a/source/blender/gpu/intern/gpu_select.c +++ b/source/blender/gpu/intern/gpu_select.c @@ -31,15 +31,14 @@ */ #include "GPU_select.h" #include "GPU_extensions.h" - +#include "GPU_glew.h" + #include "BLI_utildefines.h" #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" -#include <GL/glew.h> - /* Ad hoc number of queries to allocate to skip doing many glGenQueries */ #define ALLOC_QUERIES 200 diff --git a/source/blender/gpu/intern/gpu_simple_shader.c b/source/blender/gpu/intern/gpu_simple_shader.c index 0cb712d220f..c0d7ebd4abb 100644 --- a/source/blender/gpu/intern/gpu_simple_shader.c +++ b/source/blender/gpu/intern/gpu_simple_shader.c @@ -42,7 +42,7 @@ * - Optimize for case where no texture matrix is used. */ -#include "GL/glew.h" +#include "GPU_glew.h" #include "BLI_math.h" #include "BLI_utildefines.h" diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 17bbfb1cc84..4e7a564e9d4 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -38,7 +38,8 @@ incs = [ '#/intern/guardedalloc', '#/intern/atomic', '#/intern/memutil', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/audaspace/intern', '#/intern/cycles/blender', '#/intern/smoke/extern', @@ -57,7 +58,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_SMOKE']: defs.append('WITH_SMOKE') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index c5f62439b9e..9a53ebcec03 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -293,6 +293,7 @@ blender_include_dirs( ../../../../intern/audaspace/intern ../../../../intern/cycles/blender ../../../../intern/guardedalloc + ../../../../intern/glew-mx ../../../../intern/atomic ../../../../intern/memutil ../../../../intern/smoke/extern @@ -328,4 +329,6 @@ set(SRC rna_mesh_utils.h ) +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 9fda79feb74..d1eab5ca9db 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -53,11 +53,12 @@ makesrna_tool = env.Clone() rna = env.Clone() makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ') -defs = [] +defs = env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/audaspace/intern', '#/intern/cycles/blender', '#/intern/smoke/extern', @@ -66,6 +67,7 @@ incs = [ '../../blenlib', '../../bmesh', '../../editors/include', + '../../gpu', '../../ikplugin', '../../imbuf', '../../makesdna', diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 71c84fd1e8a..06e9f8f5b67 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -40,7 +40,6 @@ set(INC set(INC_SYS ${ZLIB_INCLUDE_DIRS} - ${GLEW_INCLUDE_PATH} ) set(SRC diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index c112f525398..c15a562abc0 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -34,7 +34,6 @@ incs = [ './intern', '#/intern/guardedalloc', '#/intern/elbeem/extern', - '#/extern/glew/include', '#/intern/opennl/extern', '../render/extern/include', '../bmesh', diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 2293415aef0..9eb6c1674a3 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -38,6 +38,7 @@ set(INC ../makesrna ../render/extern/include ../../../intern/guardedalloc + ../../../intern/glew-mx ) set(INC_SYS @@ -279,6 +280,8 @@ if(WITH_COMPOSITOR) add_definitions(-DWITH_COMPOSITOR) endif() +add_definitions(${GL_DEFINITIONS}) + if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index becf6e79d44..aed846355c3 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -39,7 +39,8 @@ incs = [ './shader', './texture', '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../blenfont', '../blenkernel', '../blenlib', @@ -48,12 +49,11 @@ incs = [ '../makesdna', '../makesrna', '../render/extern/include', - env['BF_OPENGL_INC'], env['BF_ZLIB_INC'], ] incs = ' '.join(incs) -defs = [] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: incs += ' ' + env['BF_PYTHON_INC'] diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index a5b52a3dd63..9988e0981aa 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -33,7 +33,8 @@ incs = [ '.', '#/intern/guardedalloc', '#/intern/memutil', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '#/intern/audaspace/intern', '#/intern/cycles/blender', '../blenfont', @@ -62,7 +63,7 @@ sources = env.Glob('bmesh/*.c') env.BlenderLib( libname = 'bf_python_bmesh', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # generic -defs = ['GLEW_STATIC'] +defs = env['BF_GL_DEFINITIONS'] if is_debug: defs.append('_DEBUG') @@ -79,7 +80,7 @@ env.BlenderLib( libname = 'bf_python_mathutils', sources = Split(sources), inclu # bpy -defs = [] +defs = env['BF_GL_DEFINITIONS'] if is_debug: defs.append('_DEBUG') diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index aec2faa89e6..155247a4249 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -22,8 +22,10 @@ set(INC . ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -46,6 +48,6 @@ set(SRC py_capi_utils.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index b8dcf9d8491..c599ce26f6c 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -33,7 +33,7 @@ #include <Python.h> #include "bgl.h" /*This must come first */ -#include <GL/glew.h> +#include "GPU_glew.h" #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 70b4df7d6fe..a75db23d20b 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -260,5 +260,6 @@ if(WITH_PLAYER) add_definitions(-DWITH_PLAYER) endif() +add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 5f993297840..088bddc8a76 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -40,12 +40,12 @@ set(INC ../../gameengine/BlenderRoutines ../../../intern/ghost ../../../intern/guardedalloc + ../../../intern/glew-mx ../../../intern/memutil ) set(INC_SYS ${ZLIB_INCLUDE_DIRS} - ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_PATH} ) @@ -78,7 +78,7 @@ set(SRC wm_window.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) @@ -107,6 +107,8 @@ endif() if(WITH_HEADLESS) add_definitions(-DWITH_HEADLESS) +elseif(WITH_X11) + add_definitions(-DWITH_X11) endif() if(WITH_PYTHON) diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index 00d363e1539..b93192d5067 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -36,7 +36,8 @@ incs = [ '#/intern/guardedalloc', '#/intern/memutil', '#/source/gameengine/BlenderRoutines', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../blenfont', '../blenkernel', '../blenlib', @@ -54,7 +55,7 @@ incs = [ ] incs = ' '.join(incs) -defs = [ 'GLEW_STATIC' ] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') @@ -78,4 +79,7 @@ if env['WITH_BF_COMPOSITOR']: if env['WITH_BF_PYTHON_SECURITY']: defs.append("WITH_PYTHON_SECURITY") +if env['OURPLATFORM'] in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'aix4', 'aix5'): + defs.append("WITH_X11") + env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] ) diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 2f20e8c234f..7440570f4a0 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -32,7 +32,6 @@ #include <stdlib.h> #include <string.h> -#include <GL/glew.h> #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -57,6 +56,7 @@ #include "GPU_draw.h" #include "GPU_extensions.h" +#include "GPU_glew.h" #include "RE_engine.h" diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index b1f693502f6..20f5f8d3e3e 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -110,6 +110,7 @@ #include "GPU_buffers.h" #include "GPU_extensions.h" #include "GPU_draw.h" +#include "GPU_init_exit.h" #include "BKE_depsgraph.h" #include "BKE_sound.h" @@ -195,7 +196,8 @@ void WM_init(bContext *C, int argc, const char **argv) wm_init_reports(C); /* reports cant be initialized before the wm */ if (!G.background) { - GPU_extensions_init(); + GPU_init(); + GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); GPU_set_anisotropic(U.anisotropic_filter); GPU_set_gpu_mipmapping(U.use_gpu_mipmap); @@ -502,7 +504,8 @@ void WM_exit_ext(bContext *C, const bool do_python) if (!G.background) { GPU_global_buffer_pool_free(); GPU_free_unused_buffers(); - GPU_extensions_exit(); + + GPU_exit(); } BKE_reset_undo(); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index ec806fb7c61..46a20d3bf88 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -55,7 +55,6 @@ #include "BKE_global.h" #include "BKE_main.h" -#include "BIF_gl.h" #include "RNA_access.h" @@ -74,6 +73,8 @@ #include "GPU_draw.h" #include "GPU_extensions.h" +#include "GPU_init_exit.h" +#include "GPU_glew.h" #include "UI_interface.h" @@ -319,8 +320,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) /* nothing to do for 'temp' windows, * because WM_window_open_temp always sets window title */ } - else { - + else if (win->ghostwin) { /* this is set to 1 if you don't have startup.blend open */ if (G.save_over && G.main->name[0]) { char str[sizeof(G.main->name) + 24]; @@ -353,7 +353,7 @@ float wm_window_pixelsize(wmWindow *win) } /* belongs to below */ -static void wm_window_add_ghostwindow(const char *title, wmWindow *win) +static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; static int multisamples = -1; @@ -377,8 +377,11 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) if (ghostwin) { GHOST_RectangleHandle bounds; + /* the new window has already been made drawable upon creation */ + wm->windrawable = win; + /* needed so we can detect the graphics card below */ - GPU_extensions_init(); + GPU_init(); win->ghostwin = ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ @@ -444,8 +447,7 @@ void wm_window_add_ghostwindows(wmWindowManager *wm) wm_init_state.start_x = 0; wm_init_state.start_y = 0; - -#if !defined(__APPLE__) && !defined(WIN32) /* X11 */ +#ifdef WITH_X11 /* X11 */ /* X11, start maximized but use default sane size */ wm_init_state.size_x = min_ii(wm_init_state.size_x, WM_WIN_INIT_SIZE_X); wm_init_state.size_y = min_ii(wm_init_state.size_y, WM_WIN_INIT_SIZE_Y); @@ -474,7 +476,7 @@ void wm_window_add_ghostwindows(wmWindowManager *wm) wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE; } - wm_window_add_ghostwindow("Blender", win); + wm_window_add_ghostwindow(wm, "Blender", win); } /* happens after fileread */ if (win->eventstate == NULL) @@ -1426,9 +1428,9 @@ void wm_window_set_swap_interval (wmWindow *win, int interval) GHOST_SetSwapInterval(win->ghostwin, interval); } -int wm_window_get_swap_interval (wmWindow *win) +bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut) { - return GHOST_GetSwapInterval(win->ghostwin); + return GHOST_GetSwapInterval(win->ghostwin, intervalOut); } diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index bf96e020a48..9c9c79d2f54 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -58,8 +58,8 @@ void wm_window_lower (wmWindow *win); void wm_window_set_size (wmWindow *win, int width, int height); void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r); void wm_window_swap_buffers (wmWindow *win); -void wm_window_set_swap_interval (wmWindow *win, int interval); -int wm_window_get_swap_interval (wmWindow *win); +void wm_window_set_swap_interval(wmWindow *win, int interval); +bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut); float wm_window_pixelsize(wmWindow *win); |