Build Panda3D with optimized Intel C++ Compiler

I would like to use Intel Compiler suite integrated in Microsoft Visual Studio vs2008
to generate highly optimized code (IPP, SSE4, …)

The issue is that the makepanda generated vs2008 solution is simply calling the script thru

cd .. & makepanda\makepanda --everything --optimize 3 --installer

And so there is no way to alter the switch to Intel environment in VisualStudio.

I don’t have a clue on how to modify to tell vs2008 to use Intel Compiler<>.


(1) what’s the way to pass on the relevant infos to vs2008 in ?


(2) is there a way to simply use the vs2008 project (manually) with no makefile, and
reinclude later the bin and libs in the overall make process ?

Could you please help on this one. Thanks !!

We don’t support the Intel C++ compiler at the moment. You’d need to use ppremake or you’d need to modify and add support for the Intel C++ compiler, which probably won’t be easy.

Hi rdb,
Thanks for your answer.

The point is that Intel compiler after install is embedded in Visual Studio 2008, and I’m already using it successfully when compiling my Panda3D C++ programs.

So here the issue is: is there any way to split the makepanda process in 2 phases so that the generated VS2008 solution can be optimized with Intel options, and then at a later step launch the makeinstaller ?

I’m ready to work on this and to offer it to our community, but I need a minimal guidance on where to put my hands…


Nah, it can’t. Makepanda invokes the MSVC compiler at the low-level.

I’ll try to find a turn around since I do need Intel libs.
Will let you know.

Hi rdb,

I’making progress on the subject, but bear with me for a minute:

I do however have an issue with

private: static class TypeHandle XXX::CacheEntry::_type_handle

This is what is issued during MakePanda (optimize 3)

1>[ 36%] Linking dynamic library built/bin/libpandafx.dll
1>   Creating library built/lib/libpandafx.lib and object built/lib/libpandafx.exp
1>distort_composite.obj : error LNK2001: unresolved external symbol "private: static class TypeHandle Geom::CacheEntry::_type_handle" (?_type_handle@CacheEntry@Geom@@0VTypeHandle@@A)
1>distort_composite.obj : error LNK2001: unresolved external symbol "private: static class TypeHandle GeomVertexData::CacheEntry::_type_handle" (?_type_handle@CacheEntry@GeomVertexData@@0VTypeHandle@@A)
1>libdistort_igate.obj : error LNK2001: unresolved external symbol "private: static class TypeHandle GeomVertexData::CacheEntry::_type_handle" (?_type_handle@CacheEntry@GeomVertexData@@0VTypeHandle@@A)
1>built/bin/libpandafx.dll : fatal error LNK1120: 2 unresolved externals
1>Storing dependency cache.
1>Elapsed Time: 1 hours 36 min
1>Build terminated.

As far as I understand, whenever a static private variable is declared in a class, the c++ requires that you declare it outside too.
ie in c++, you must declare static data not only within the class itself but also outside, if you want to get is used even by the members of its class…

class StaticBase {
  static char myChar;
  static void setMyChar();

void StaticBase::setMyChar() {
  myChar = 'c';

won’t work, unless you previously defined

 char StaticBase::myChar; 

So I noticed that for instance in geomVertexData.h
only the class is defined, but the static variable is not exposed…May this justify the behaviour?

Could you please provide a hint so that I can advance progress.

Many thanks.

All the _type_handle members are defined in the various *.cxx files; in the case of GeomVertexData, they appear in geomVertexData.cxx.


Hi David,

I saw that.

So what could be the issue with the linker not finding the related external symbols at the time of
creating library built/lib/libpandafx.lib?

Where the hell these symbols have gone during (after) compile?

EDIT: I tend to think that it has something to do with Inlining…
ie if a project that uses function inlining defines the functions in a .cpp file rather than in the header file, error LNK2001 can rise.
The header file is included everywhere deemed appropriate, but the functions are only inlined when the .cpp file passes through the compiler; therefore, the linker sees the functions as unresolved externals when used in other modules.


It seems that my assumption about INLINE issues is sort of correct.
I did try to launch makePanda with compiler option /Ob0

ie /Ob0 means Inline are not treated

With this temporary turn around hack, the build progressed from 32% to 45%

The build then stopped with error: identifier “PFNGLDRAWARRAYSINSTANCEDPROC” unidentified.

1>[ 45%] Linking dynamic library built/bin/libp3framework.dll
1>   Creating library built/lib/libp3framework.lib and object built/lib/libp3framework.exp
1>Microsoft (R) Manifest Tool version 6.1.7716.0
1>Copyright (c) Microsoft Corporation 2009. 
1>All rights reserved.
1>[ 45%] Building C++ object built/tmp/glstuff_glpure.obj
1>[ 45%] Linking dynamic library built/bin/libp3glstuff.dll
1>   Creating library built/lib/libp3glstuff.lib and object built/lib/libp3glstuff.exp
1>Microsoft (R) Manifest Tool version 6.1.7716.0
1>Copyright (c) Microsoft Corporation 2009. 
1>All rights reserved.
1>[ 45%] Building C++ object built/tmp/glgsg_config_glgsg.obj
1>panda/src/glgsg/glgsg.h(61): warning #47: incompatible redefinition of macro "WIN32_LEAN_AND_MEAN" (declared at line 22 of "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\include\mutexWin32Impl.h")
1>  #define WIN32_LEAN_AND_MEAN 1
1>          ^
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\include\threadSimpleManager.h(34): warning #47: incompatible redefinition of macro "WIN32_LEAN_AND_MEAN" (declared at line 61 of "panda/src/glgsg/glgsg.h")
1>  #define WIN32_LEAN_AND_MEAN
1>          ^
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\glstuff\glGraphicsStateGuardian_src.h(636): error: identifier "PFNGLDRAWARRAYSINSTANCEDPROC" is undefined
1>    ^
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\glstuff\glGraphicsStateGuardian_src.h(637): error: identifier "PFNGLDRAWELEMENTSINSTANCEDPROC" is undefined
1>    ^
1>compilation aborted for panda/src/glgsg/config_glgsg.cxx (code 2)
1>Storing dependency cache.
1>Elapsed Time: 1 hours 49 min
1>Build terminated.
1>Build log was saved at "file://c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\BuildLog.htm"
1>makepanda - 2 error(s), 52 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

A side effect related to APIENTRYP???

At this point I’d really appreciate some remarks and guidance from developpers…

It is true that an “inline” function definition should always appear in the .I file, and not in the .cxx file. If you see any examples where an inline function is defined in the .cxx file, that’s a mistake in the code. But that doesn’t have anything to do with the _type_handle definitions, so I’m not sure how this relates to your particular problem.

The PFNGLDRAWARRAYSINSTANCEDPROC symbol is supposed to be defined by GL.h or at least glext.h (but it may not be defined in older OpenGL headers). Actually, our own panda_glext.h is supposed to define any of these OpenGL symbols that we are using in case the system headers aren’t current enough to define them, but it appears out our panda_glext.h isn’t current enough to define PFNGLDRAWARRAYSINSTANCEDPROC (it defines only the earlier PFNGLDRAWARRAYSINSTANCEDEXTPROC instead). So, this is a mistake in the Panda code. The correct solution is to upgrade panda_glext.h with a more recent copy of glext.h (this is taken from the glext.h provided at and the headers are modified slightly to integrate with our build). Alternatively, a simpler temporary workaround would be to replace PFNGLDRAWARRAYSINSTANCEDPROC with PFNGLDRAWARRAYSINSTANCEDEXTPROC in the code.


Thanks David,


Just replaced as a quick turn around

in gLGraphicsStateGuardian_src.h and in gLGraphicsStateGuardian_src.cxx

The MakePanda built with the Intel Optimized compiler is going on and as of now has reached the 75% mark…and still building…

I will keep you posted later on !!

Many thanks


OK!!! Here we are :

1>Microsoft (R) Manifest Tool version 6.1.7716.0
1>Copyright (c) Microsoft Corporation 2009. 
1>All rights reserved.
1>[100%] Building installer 
1>Building Panda3D installer. This can take up to an hour.
1>Note: you are using zlib, which is faster, but lzma gives better compression.
1>warning: File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\plugins\*.dle" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:142)
1>warning: File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\plugins\*.dlo" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:143)
1>warning: File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\plugins\*.mll" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:144)
1>warning: File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\bin\*.p3d" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:152)
1>4 warnings:
1>  File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\plugins\*.dle" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:142)
1>  File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\plugins\*.dlo" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:143)
1>  File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\plugins\*.mll" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:144)
1>  File: "c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\bin\*.p3d" -> no files found. (c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\direct\src\directscripts\packpanda.nsi:152)
1>Storing dependency cache.
1>Build successfully finished
1>Build log was saved at "file://c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\BuildLog.htm"
1>makepanda - 0 error(s), 322 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

So now I’ve got an installer file

Panda3D-1.7.1 of 90462ko

compiled with Intel Optimized compiler:

This should feature:

SSE3/SSE4 instructions
loop vectorization
block vectorization

What I’ll do is check if the code is functional and again let you all know!!

First result :

my c++ Panda Programs recompiled with no problem and run as usual (faster of course…)

a couple of Panda Python programs are running ok

If any of you is interested, I’d be more than happy to compile an installer optimized for his windows machine (up to SSe4+)

In the meantimes, let me regenerate a new makePanda with all comments turned on, so that we can explore what can be optimized and done better!!!

Quite interesting!
Can you give a rough estimate (percentage-wise) of the performance gain?

will do as soon as I can find a way to solve this damn issue of “Inline”, since I had to switch them off for the time being (see previous posts).

I would estimate x10 minimum on intensive inner loops, I’ve seen much more x70 in other usages I have for other purposes (video processing).

Give a look at Intel Parallel Studio, you’ll understand!

Next step will be to unlock pararalellism.
Then including IPP (intel performance primitives)

Nevertheless, if you’re interested by a special build based on your machine (processor capability) I’d be more than happy to generate a dedicated install for test.

BTTW. Since I’m coding in C++ I don’t have a clue of Python overhead and possible speed up…

BTW. This is the kind of nice statements one likes to get from his compiler:

1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\include\lvecBase4_src.I(749) (col. 3): remark: BLOCK WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\include\lvecBase4_src.I(735) (col. 3): remark: BLOCK WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\include\lmatrix3_src.I(706) (col. 3): remark: BLOCK WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\built\include\lmatrix3_src.I(740) (col. 3): remark: BLOCK WAS VECTORIZED.


1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\frameBufferProperties.cxx(180) (col. 3): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\frameBufferProperties.cxx(37) (col. 3): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\lru.h(79) (col. 18): remark: BLOCK WAS VECTORIZED.
1>c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(3158) (col. 2): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\frameBufferProperties.cxx(324) (col. 3): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\frameBufferProperties.cxx(387) (col. 3): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\stencilRenderStates.cxx(28) (col. 3): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\graphicsStateGuardian.cxx(2208) (col. 3): remark: LOOP WAS VECTORIZED.
1>c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE-Itry\panda3d\panda\src\display\drawableRegion.cxx(81) (col. 3): remark: LOOP WAS VECTORIZED.
.... and so on

:smiley: :smiley: :smiley:

FYI: exerpt from LibPanda.dll showing use of mmx sse instructions…

  10009952: F2 0F 10 56 10     movsd       xmm2,mmword ptr [esi+10h]
  10009957: 8D 8F 84 00 00 00  lea         ecx,[edi+84h]
  1000995D: F2 0F 10 66 20     movsd       xmm4,mmword ptr [esi+20h]
  10009962: F2 0F 10 76 30     movsd       xmm6,mmword ptr [esi+30h]
  10009967: F2 0F 11 07        movsd       mmword ptr [edi],xmm0
  1000996B: F2 0F 11 57 10     movsd       mmword ptr [edi+10h],xmm2
  10009970: F2 0F 11 67 20     movsd       mmword ptr [edi+20h],xmm4
  10009975: F2 0F 11 77 30     movsd       mmword ptr [edi+30h],xmm6
  1000997A: F2 0F 10 46 40     movsd       xmm0,mmword ptr [esi+40h]
  1000997F: F2 0F 10 56 50     movsd       xmm2,mmword ptr [esi+50h]
  10009984: F2 0F 10 66 60     movsd       xmm4,mmword ptr [esi+60h]
  10009989: F2 0F 10 76 70     movsd       xmm6,mmword ptr [esi+70h]
  1000998E: F2 0F 10 7E 38     movsd       xmm7,mmword ptr [esi+38h]
  10009993: F2 0F 10 4E 08     movsd       xmm1,mmword ptr [esi+8]
  10009998: F2 0F 10 5E 18     movsd       xmm3,mmword ptr [esi+18h]
  1000999D: F2 0F 10 6E 28     movsd       xmm5,mmword ptr [esi+28h]
  100099A2: F2 0F 11 47 40     movsd       mmword ptr [edi+40h],xmm0
  100099A7: F2 0F 11 57 50     movsd       mmword ptr [edi+50h],xmm2
  100099AC: F2 0F 11 67 60     movsd       mmword ptr [edi+60h],xmm4
  100099B1: F2 0F 11 77 70     movsd       mmword ptr [edi+70h],xmm6
  100099B6: F2 0F 11 4F 08     movsd       mmword ptr [edi+8],xmm1
  100099BB: F2 0F 11 5F 18     movsd       mmword ptr [edi+18h],xmm3
  100099C0: F2 0F 11 6F 28     movsd       mmword ptr [edi+28h],xmm5
  100099C5: F2 0F 11 7F 38     movsd       mmword ptr [edi+38h],xmm7
  100099CA: F2 0F 10 4E 48     movsd       xmm1,mmword ptr [esi+48h]
  100099CF: F2 0F 10 5E 58     movsd       xmm3,mmword ptr [esi+58h]
  100099D4: F2 0F 10 6E 68     movsd       xmm5,mmword ptr [esi+68h]
  100099D9: F2 0F 10 7E 78     movsd       xmm7,mmword ptr [esi+78h]
  10017240: F2 0F 10 0D 08 4B  movsd       xmm1,mmword ptr ds:[10E64B08h]
            E6 10
  10017248: F2 0F 5E 4C 24 04  divsd       xmm1,mmword ptr [esp+4]
  1001724E: F2 0F 10 01        movsd       xmm0,mmword ptr [ecx]
  10017252: F2 0F 10 51 08     movsd       xmm2,mmword ptr [ecx+8]
  10017257: F2 0F 59 C1        mulsd       xmm0,xmm1
  1001725B: F2 0F 59 D1        mulsd       xmm2,xmm1
  1001725F: F2 0F 11 01        movsd       mmword ptr [ecx],xmm0
  10017263: F2 0F 11 51 08     movsd       mmword ptr [ecx+8],xmm2
  10017268: C2 08 00           ret         8

Any updates on this? Performance results? I’d be interested in trying out an installer…

As per recurring request on the IRC, here is a PRELIMINARY ‘how to’ for those of you that
may be interested in using Intel Parallel Studio to generate extended SSE2/3/4 instructions
and use optimization C compiler.

Please note that I’m in no way a specialist in Compilers/linkers and that I submit this with
the intent that some of you can use and improve it so that Intel Compiler & tools could be part
of the Panda3D build system.

In term of performance, this should be noticeable for those of us that use C++ Panda programming with a lot of non panda processing involved in the application.

Let’s share our experience on this!

Having said so, here is the state of the current exploration:

b[/b] assumption you’re on Windows, have a decent processor(!), and use Visual Studio 2008

b[/b] if you don’t have yet the Intel Performance compiler, you can get a trial version at:

b[/b] once installed and set-up, you have Intel Compiler & other tools integrated in your
Visual Studio development suite.
OK, So download latest Panda source code (ie Panda_1.8 as of today)!

b[/b] now, you need to use two slightly modified generation files and
The aim is for the build system to recognize Intel Compiler (and its bunch of tricky options)
I prepared these files, and they’re downloadable at

(4) run the build with option
makepanda --verbose --everything --no-directcam --no-opencv --no-pandatool --no-maya2012 --optimize 4 --installer

you can try others options at your leasure, some will fail, try again

(5) Note that I included per default some performance compile flags, in case you want to change them

per default compile to the specific capabilities of your machine (ie supposely the machine
performing compilation)

if you want to generate to a different Intel architecture, replace 
/QxHost with /arch:SSxxx ie /arch::SSE3, /arch::SSE4.1, ...

> if you don't want to use intel optimized headers, remove
cmd += " /Quse-intel-optimized-headers"	

> if you don't want to enable parallelization, remove
cmd += " /Qparallel"

> if you're interested in getting optimization (ugly) warnings/reports, add
cmd += " /Qopt-report:2 /Qopt-report-phase:hlo /Qopt-report-phase:hpo"	# some optimization reports

BTW: Depending on the options you selected, get ready for a substantial compile time and make sure
you’ve got a comfortable sofa, enough drinks and a nice video movie to watch…

Please note too that depending on the options you may need to :

get ddraw.lib
Microsoft no longer include this library in the latest version of DirectX SDK,
since usage of directdraw is discouraged for new programs.
Anyway you can get a working version from previous DirectX SDK (2009), such as: … x?id=10084

edit slight modifications in glGraphicsBuffer_src.h ie

OK, if everything goes fine you should eventually get

1>Makepanda Final Status Report
1>Makepanda: Regular build
1>Makepanda: Compiler: MSVC
1>Makepanda: Optimize: 4
1>Makepanda: Don't generate API reference manual
1>Makepanda: Build installer, using zlib
1>Makepanda: Version ID: 1.8.0
1>Makepanda: I cannot locate SDK for DX8
1>Makepanda: I have automatically added this command-line option: --no-dx8
1>Makepanda: Using DX9 sdk: C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)
1>Makepanda: The registry does not appear to contain a pointer to the MAYA6 SDK.
1>Makepanda: I have automatically added this command-line option: --no-maya6
1>Makepanda: The registry does not appear to contain a pointer to MAX2011
1>Makepanda: I have automatically added this command-line option: --no-max2011
1>Makepanda: I cannot locate SDK for PhysX
1>Makepanda: I have automatically added this command-line option: --no-physx
1>Makepanda: I cannot locate SDK for SpeedTree
1>Makepanda: I have automatically added this command-line option: --no-speedtree
1>Makepanda: thirdparty/win-libs-vc9/awesomium/lib/Awesomium.lib not found.  Skipping Package AWESOMIUM
1>Makepanda: thirdparty/win-libs-vc9/fltk/lib/fltk.lib not found.  Skipping Package FLTK
1>Makepanda: Elapsed Time: 16 min 25 sec
1>Build successfully finished, elapsed time: 16 min 25 sec
1>Build log was saved at "file://c:\Users\jc\Desktop\PANDA_BUILD_BOT\SOURCE_BOT_RELEASE_1.8_INtel\panda3d\built\BuildLog.htm"
1>makepanda - 0 error(s), 5 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

and get a install file.

Let me know how it goes.