Software renderer fails on MacOS

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Software renderer fails on MacOS

Post by Devon7 »

The Irrlicht Software renderer fails on Xcode 3.2.6 MacOS 10.6.8 NVIDIA GeForce 9400M,
leaving most of the window contents and title blank.

Areas obscured by other windows appear properly rendered when uncovered
but that might well be a coincidence of leftover uncleared VRAM.
Whatever is onscreen and visible the whole time stays blank.
Taking a screen shot may cause the whole window to render once but remain static.
A second screen shot may get a single update but later screen shots don't.

Code: Select all

Irrlicht Engine version 1.9.0
Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386
Loaded mesh: ../../media/sydney.md2
Loaded texture: /Users/devon/hack/irrlicht-1.9.0/media/sydney.bmp
Peace
--Devon

P.S. The gcc-4.2.1 fatal compile error is fixed in another patch further down.

P.P.S. This patch guarantees HelloWorld will work as-is out-of-the-box in MacOS X
by using OpenGL instead of Software when compiled for Apple platforms.

Code: Select all

 
Index: examples/01.HelloWorld/main.cpp
===================================================================
--- examples/01.HelloWorld/main.cpp (revision 4800)
+++ examples/01.HelloWorld/main.cpp (working copy)
@@ -82,7 +82,19 @@
 #pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
 #endif
 
+/*
+the Irrlicht Software renderer fails on
+   Xcode 3.2.6 MacOS 10.6.8 NVIDIA GeForce 9400M
+*/
+#ifdef __APPLE__
+#define DRIVER_TYPE video::EDT_OPENGL
+#define DRIVER_NAME L"OpenGL"
+#else
+#define DRIVER_TYPE video::EDT_SOFTWARE
+#define DRIVER_NAME L"Software"
+#endif
 
+
 /*
 This is the main method. We can now use main() on every platform.
 */
@@ -122,7 +134,7 @@
    dimensions, etc.
    */
    IrrlichtDevice *device =
-       createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
+       createDevice( DRIVER_TYPE, dimension2d<u32>(640, 480), 16,
            false, false, false, 0);
 
    if (!device)
@@ -150,8 +162,8 @@
    The text is placed at the position (10,10) as top left corner and
    (260,22) as lower right corner.
    */
-   guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
+   guienv->addStaticText(L"Hello World! This is the Irrlicht " DRIVER_NAME L" renderer!",
 
    /*
    To show something interesting, we load a Quake 2 model and display it.
A better patch would fix the Software driver.
Last edited by Devon7 on Sun May 04, 2014 3:19 am, edited 9 times in total.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Software renderer fails on MacOS

Post by CuteAlien »

Could you please tell what exactly is the compile error which you fix with you second patch? You seem to just out-define the code, but it would be nicer to get it working instead. It's new stuff and just got added last week. I have no access to OSX for testing, but if you could tell me about the error it causes I might be able to fix it.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Re: Software renderer fails on MacOS

Post by Devon7 »

Here are all 18 fatal compiler errors — really the same 9 manifesting twice — revised to show full details as requested.

Code: Select all

CompileC /Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/Objects-normal/x86_64/Irrlicht.o ../Irrlicht.cpp normal x86_64 objective-c++ com.apple.compilers.gcc.4_2
cd /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -gdwarf-2 -I/Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/Irrlicht.hmap -F/Users/devon/hack/built/Debug -I/Users/devon/hack/built/Debug/include -I../../../include -I/Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/DerivedSources/x86_64 -I/Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/DerivedSources -DMACOSX -D_DEBUG -include /var/folders/R-/R-yMZuYlGY4FbjMtSYCmA++++TM/-Caches-/com.apple.Xcode.502/SharedPrecompiledHeaders/MacOSX_Prefix-eyrxsikqnrljgkcwptoxetoieplx/MacOSX_Prefix.pch -c /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../Irrlicht.cpp -o /Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/Objects-normal/x86_64/Irrlicht.o
 
In file included from /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/irrlicht.h:39,
                 from /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../Irrlicht.cpp:16:
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h: In member function 'void irr::IProfiler::add(irr::s32, const irr::core::stringw&, const irr::core::stringw&)':
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:354: error: invalid conversion from 'irr::SProfileData (*)(objc_object*)' to 'irr::u32'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:354: error:   initializing argument 1 of 'irr::SProfileData::SProfileData(irr::u32)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:357: error: request for member 'reset' in 'irr::data', which is of non-class type 'irr::SProfileData ()(objc_object*)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:358: error: request for member 'GroupIndex' in 'irr::data', which is of non-class type 'irr::SProfileData ()(objc_object*)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:359: error: request for member 'Name' in 'irr::data', which is of non-class type 'irr::SProfileData ()(objc_object*)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:361: error: invalid conversion from 'irr::SProfileData (*)(objc_object*)' to 'irr::u32'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:361: error:   initializing argument 1 of 'irr::SProfileData::SProfileData(irr::u32)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h: In member function 'const irr::SProfileData* irr::IProfiler::getProfileDataById(irr::u32)':
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:404: error: invalid conversion from 'irr::SProfileData (*)(objc_object*)' to 'irr::u32'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:404: error:   initializing argument 1 of 'irr::SProfileData::SProfileData(irr::u32)'
 

Code: Select all

CompileC /Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/Objects-normal/x86_64/CIrrDeviceMacOSX.o ../MacOSX/CIrrDeviceMacOSX.mm normal x86_64 objective-c++ com.apple.compilers.gcc.4_2
cd /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -gdwarf-2 -I/Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/Irrlicht.hmap -F/Users/devon/hack/built/Debug -I/Users/devon/hack/built/Debug/include -I../../../include -I/Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/DerivedSources/x86_64 -I/Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/DerivedSources -DMACOSX -D_DEBUG -include /var/folders/R-/R-yMZuYlGY4FbjMtSYCmA++++TM/-Caches-/com.apple.Xcode.502/SharedPrecompiledHeaders/MacOSX_Prefix-eyrxsikqnrljgkcwptoxetoieplx/MacOSX_Prefix.pch -c /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm -o /Users/devon/hack/build/MacOSX.build/Debug/libIrrlicht.a.build/Objects-normal/x86_64/CIrrDeviceMacOSX.o
 
In file included from /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/irrlicht.h:39,
                 from /Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm:28:
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h: In member function 'void irr::IProfiler::add(irr::s32, const irr::core::stringw&, const irr::core::stringw&)':
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:354: error: invalid conversion from 'irr::SProfileData (*)(objc_object*)' to 'irr::u32'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:354: error:   initializing argument 1 of 'irr::SProfileData::SProfileData(irr::u32)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:357: error: request for member 'reset' in 'irr::data', which is of non-class type 'irr::SProfileData ()(objc_object*)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:358: error: request for member 'GroupIndex' in 'irr::data', which is of non-class type 'irr::SProfileData ()(objc_object*)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:359: error: request for member 'Name' in 'irr::data', which is of non-class type 'irr::SProfileData ()(objc_object*)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:361: error: invalid conversion from 'irr::SProfileData (*)(objc_object*)' to 'irr::u32'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:361: error:   initializing argument 1 of 'irr::SProfileData::SProfileData(irr::u32)'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h: In member function 'const irr::SProfileData* irr::IProfiler::getProfileDataById(irr::u32)':
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:404: error: invalid conversion from 'irr::SProfileData (*)(objc_object*)' to 'irr::u32'
/Users/devon/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/../../../include/IProfiler.h:404: error:   initializing argument 1 of 'irr::SProfileData::SProfileData(irr::u32)'
 
Last edited by Devon7 on Mon Apr 28, 2014 1:06 pm, edited 2 times in total.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Software renderer fails on MacOS

Post by Nadro »

Which compiler did you use? GCC or Clang? I don't have access to XCode 3.x, so I can't check it too, on XCode 5 with Clang 4.x all works fine.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Software renderer fails on MacOS

Post by CuteAlien »

OK, those are not typical c++ errors but something Mac-specific. Without really knowing anything about mac programming those errros look to me like you don't compile as c++ maybe. Could it be it's compiled as Objective-c instead of Objective-C++ somehow? Thought it surprises me that only the new code is affected then. Any OS X coders who can help me out there in fixing this (without just kicking the code out...)?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Software renderer fails on MacOS

Post by Nadro »

I may try to setup older compiler on my OS X and prepare feedback today.

@Devon7
Can you set a IProfile.h to "C++ header" filetype in XCode and check if it solve a problem?
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Re: Software renderer fails on MacOS

Post by Devon7 »

/Developer/usr/bin/gcc-4.2 -x objective-c++ ... .../Irrlicht.cpp -o .../Irrlicht.o
seems wrong for a .cpp file,
no surprise that including "irrlicht.h" produces nine fatal errors,
the surprise is that there are no other errors.

/Developer/usr/bin/gcc-4.2 -x objective-c++ ... .../CIrrDeviceMacOSX.mm -o .../CIrrDeviceMacOSX.o
seems appropriate for a .mm file
but including "irrlicht.h" produces the same nine fatal errors.

Peace
--Devon

P.S. I'll edit the error listings to show the details you requested
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Re: Software renderer fails on MacOS

Post by Devon7 »

Changing irrlicht.h and IProfiler.h from sourcecode.c.h to sourcecode.cpp.h has no effect.
Last edited by Devon7 on Thu May 01, 2014 4:43 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Software renderer fails on MacOS

Post by CuteAlien »

When looking at the line where it has problems - I wonder if it might have trouble with the "friend" keyword. Could you please try one change - in IProfiler.h in the SProfileData struct please out-comment the line with "private:" so the variables become public for a test.
Because all the lines it has troubles are when it tries to access private members of SProfileData.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Re: Software renderer fails on MacOS

Post by Devon7 »

include/IProfiler.h
...
/// private:

has no effect.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Software renderer fails on MacOS

Post by CuteAlien »

Thanks for testing, was worth a try.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Re: Software renderer fails on MacOS

Post by Devon7 »

Compiles and runs under a freshly booted MacOS 10.6.8 with a fully reset Xcode 3.2.6:
Apple > Restart... > Restart
defaults delete com.apple.Xcode
rm -fr ~/Library/'Application Support'/Developer/Shared/Xcode ~/Library/'Application Support'/Xcode ~/Library/Caches/xcodebuild ~/Library/Preferences/com.apple.Xcode.plist ~/hack/irrlicht-1.9.0
Open -a Xcode

Xcode > Empty Caches... > Empty
svn checkout svn://svn.code.sf.net/p/irrlicht/code/trunk irrlicht-code
cp -pR irrlicht-code ~/hack/irrlicht-1.9.0
Open ~/hack/irrlicht-1.9.0/source/Irrlicht/MacOSX/MacOSX.xcodeproj

apply this patch

Code: Select all

Index: include/IProfiler.h
===================================================================
--- include/IProfiler.h (revision 4803)
+++ include/IProfiler.h (working copy)
@@ -346,8 +346,10 @@
        groupIdx = addGroup(groupName);
    }
 
-   SProfileData data(id);
-   s32 idx = ProfileDatas.binary_search(data);
+   u32 id_u32 = id;
+   SProfileData data(id_u32);
+   SProfileData data_SProfileData = data;
+   s32 idx = ProfileDatas.binary_search(data_SProfileData);
    if ( idx < 0 )
    {
        data.reset();
@@ -394,8 +396,10 @@
 
 const SProfileData* IProfiler::getProfileDataById(u32 id)
 {
-   SProfileData data(id);
-    s32 idx = ProfileDatas.binary_search(data);
+   u32 id_u32 = id;
+   SProfileData data(id_u32);
+   SProfileData data_SProfileData = data;
+    s32 idx = ProfileDatas.binary_search(data_SProfileData);
    if ( idx >= 0 )
        return &ProfileDatas[idx];
    return NULL;
 
Why does this patch work? Divide and conquer. The error messages show gcc-4.2 is confused about type conversions.
Isolating the confusing operations into separate statements removes the confusion.
No doubt it compiles into the exact same object code as before.
Last edited by Devon7 on Mon Apr 28, 2014 7:29 pm, edited 6 times in total.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Software renderer fails on MacOS

Post by Nadro »

Can you also check if it works properly when you will rename IProfiler.h to IProfiler.hpp?
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Devon7
Posts: 9
Joined: Sun Apr 27, 2014 6:41 pm

Re: Software renderer fails on MacOS

Post by Devon7 »

renaming IProfiler.h to IProfiler.hpp and likewise all references
include/irrlicht.h:39:#include "IProfiler.h"
source/Irrlicht/COctreeSceneNode.cpp:16:#include "IProfiler.h"
source/Irrlicht/CProfiler.h:9:#include "IProfiler.h"
source/Irrlicht/CSceneManager.cpp:19:#include "IProfiler.h"
has no effect.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Software renderer fails on MacOS

Post by Nadro »

Thanks for info.

UPDATE:
I couldn't setup older compiler on my OS X. Due to 05.05.2014 I'll be offline - holidays. After back to home I'll try to check it again.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply