Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2455 closed enhancement (fixed)

Texture System Update

Reported by: IronNerd Owned by: IronNerd
Priority: Nice to Have Milestone: Alpha 16
Component: Core engine Keywords:
Cc: Patch:

Description

This is a precursor to changes in OglTex that will be required for the OpenGL 2 update.

The change is mostly refactoring to make the interface more consistent with the rest of the project, but it has some incidental improvements. Free is automatically called in the destructor, making it harder to accidentally leak memory and requiring a mild update to the get_average_colour function. Some sections of code have been made shorter or more readable by the update.

This will probably be due for another (smaller) revisit mid-way through the renderer update, sometime after cubemaps have native support and external references to member variables have been mostly reduced to the codecs.

Attachments (2)

Tex.patch (54.1 KB ) - added by IronNerd 10 years ago.
Tex_v2.patch (54.2 KB ) - added by IronNerd 10 years ago.

Download all attachments as: .zip

Change History (12)

by IronNerd, 10 years ago

Attachment: Tex.patch added

comment:1 by Josh, 10 years ago

The actual patch style looks good, but I had some issues running/compiling with your patch on linux.

First, a build warning:

==== Building lowlevel (debug) ====
cursor.cpp
ogl_tex.cpp
tex.cpp
tex_dds.cpp
tex_tga.cpp
tex_png.cpp
tex_codec.cpp
tex_bmp.cpp
tex_jpg.cpp
../../../source/lib/tex/tex_jpg.cpp: In function ‘Status jpg_decode_impl(rpU8, size_t, jpeg_decompress_struct*, Tex*)’:
../../../source/lib/tex/tex_jpg.cpp:502:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  Status ret = INFO::OK;
         ^
Linking lowlevel

The second issue was a segfault on start. Here is the backtrace from gdb (Gnu DeBugger):

#0  malloc_consolidate (av=av@entry=0x7ffff4408740 <main_arena>) at malloc.c:4088
#1  0x00007ffff40c80e1 in _int_malloc (av=0x7ffff4408740 <main_arena>, bytes=1048576) at malloc.c:3379
#2  0x00007ffff40ca4d0 in __GI___libc_malloc (bytes=1048576) at malloc.c:2859
#3  0x00000000006aac7f in malloc (sz=1048576) at ../../../source/ps/Profile.cpp:534
#4  0x00007fffb5a4bdf3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#5  0x00007fffb5a4c184 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#6  0x00007fffb5a2fc7a in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#7  0x00007fffb5824d6c in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#8  0x00007fffb4f837d0 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#9  0x00007fffb4f84a6c in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#10 0x00007fffb53b7af5 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
#11 0x0000000000a22243 in upload_compressed_level (level=0, level_w=2048, level_h=1024, level_data=0x7fffcb58d080 "\233\255\233\255", level_data_size=1048576, 
    cbData=0x7fffffffd3f0) at ../../../source/lib/res/graphics/ogl_tex.cpp:886
#12 0x0000000000a553b6 in tex_util_foreach_mipmap (w=2048, h=1024, bpp=4, pixels=0x7fffcb58d080 "\233\255\233\255", levels_to_skip=0, data_padding=4, 
    cb=0xa221cc <upload_compressed_level(size_t, size_t, size_t, uint8_t const*, size_t, void*)>, cbData=0x7fffffffd3f0) at ../../../source/lib/tex/tex.cpp:151
#13 0x0000000000a22327 in upload_impl (t=0x7fffea6341a0, fmt=33776, int_fmt=33776, levels_to_skip=0, uploaded_size=0x7fffea634200)
    at ../../../source/lib/res/graphics/ogl_tex.cpp:903
#14 0x0000000000a22629 in ogl_tex_upload (ht=196611, fmt_ovr=0, q_flags_ovr=0, int_fmt_ovr=0) at ../../../source/lib/res/graphics/ogl_tex.cpp:960
#15 0x000000000076cebd in CTextureManagerImpl::LoadTexture (this=0x1608480, texture=..., path=...) at ../../../source/graphics/TextureManager.cpp:219
#16 0x000000000076d0fe in CTextureManagerImpl::TryLoadingCached (this=0x1608480, texture=...) at ../../../source/graphics/TextureManager.cpp:266
#17 0x000000000076af12 in CTexture::TryLoad (this=0x1856940) at ../../../source/graphics/TextureManager.cpp:557
#18 0x000000000076ae5f in CTexture::GetHandle (this=0x1856940) at ../../../source/graphics/TextureManager.cpp:544
#19 0x00000000007afd8c in CShaderProgram::BindTexture (this=0x241fa20, id=..., tex=...) at ../../../source/graphics/ShaderProgram.cpp:700
---Type <return> to continue, or q <return> to quit---
#20 0x0000000000990e32 in GUIRenderer::Draw (Calls=..., Z=20) at ../../../source/gui/GUIRenderer.cpp:358
#21 0x00000000009e23d8 in CGUISpriteInstance::Draw (this=0x17e0d80, Size=..., CellID=0, Sprites=..., Z=20) at ../../../source/gui/CGUISprite.cpp:42
#22 0x000000000094cb42 in CGUI::DrawSprite (this=0x16fcb60, Sprite=..., CellID=0, Z=@0x7fffffffd868: 20, Rect=...) at ../../../source/gui/CGUI.cpp:393
#23 0x000000000097a139 in CImage::Draw (this=0x10478b0) at ../../../source/gui/CImage.cpp:55
#24 0x00000000009562ea in GUI<int>::RecurseObject (RR=1, pObject=0x10478b0, pFunc=&virtual table offset 56) at ../../../source/gui/GUIutil.h:320
#25 0x000000000095632d in GUI<int>::RecurseObject (RR=1, pObject=0x17cf620, pFunc=&virtual table offset 56) at ../../../source/gui/GUIutil.h:326
#26 0x000000000095632d in GUI<int>::RecurseObject (RR=1, pObject=0x1792a90, pFunc=&virtual table offset 56) at ../../../source/gui/GUIutil.h:326
#27 0x000000000094ca32 in CGUI::Draw (this=0x16fcb60) at ../../../source/gui/CGUI.cpp:373
#28 0x000000000097edef in CGUIManager::Draw (this=0x15e6c90) at ../../../source/gui/GUIManager.cpp:391
#29 0x00000000006f20df in Render () at ../../../source/ps/GameSetup/GameSetup.cpp:224
#30 0x00000000004a4f0e in Frame () at ../../../source/main.cpp:357
#31 0x00000000004a56d7 in RunGameOrAtlas (argc=1, argv=0x7fffffffdf18) at ../../../source/main.cpp:472
#32 0x00000000004a5a08 in main (argc=1, argv=0x7fffffffdf18) at ../../../source/main.cpp:514

Here is the output of valgrind(linux memory debugger) from start to exit:

joshua@Ubuntu-PC:~/0ad/build/workspaces/gcc$ valgrind --suppressions=/home/joshua/valgrind_suppress_flgrx.supp ../../../binaries/system/pyrogenesis_dbg
==12397== Memcheck, a memory error detector
==12397== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==12397== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==12397== Command: ../../../binaries/system/pyrogenesis_dbg
==12397== 
==12397== Invalid read of size 8
==12397==    at 0x88A2948: wcscmp (wcscmp.S:500)
==12397==    by 0x7E3C884: std::moneypunct<wchar_t, false>::~moneypunct() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E3C8F8: std::moneypunct<wchar_t, false>::~moneypunct() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E33534: std::locale::_Impl::~_Impl() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E3366C: std::locale::~locale() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x6F4719: FixLocales() (GameSetup.cpp:783)
==12397==    by 0x6F48FE: EarlyInit() (GameSetup.cpp:828)
==12397==    by 0x4A59F6: main (main.cpp:512)
==12397==  Address 0x12109908 is 0 bytes after a block of size 8 alloc'd
==12397==    at 0x4C2AFE7: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x7E3DF91: std::moneypunct<wchar_t, false>::_M_initialize_moneypunct(__locale_struct*, char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E35A37: std::locale::_Impl::_Impl(char const*, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E36501: std::locale::locale(char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x6F470A: FixLocales() (GameSetup.cpp:783)
==12397==    by 0x6F48FE: EarlyInit() (GameSetup.cpp:828)
==12397==    by 0x4A59F6: main (main.cpp:512)
==12397== 
==12397== Invalid read of size 8
==12397==    at 0x88A2948: wcscmp (wcscmp.S:500)
==12397==    by 0x7E3C794: std::moneypunct<wchar_t, true>::~moneypunct() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E3C808: std::moneypunct<wchar_t, true>::~moneypunct() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E33534: std::locale::_Impl::~_Impl() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E3366C: std::locale::~locale() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x6F4719: FixLocales() (GameSetup.cpp:783)
==12397==    by 0x6F48FE: EarlyInit() (GameSetup.cpp:828)
==12397==    by 0x4A59F6: main (main.cpp:512)
==12397==  Address 0x12109b38 is 0 bytes after a block of size 8 alloc'd
==12397==    at 0x4C2AFE7: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x7E3D991: std::moneypunct<wchar_t, true>::_M_initialize_moneypunct(__locale_struct*, char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E35A84: std::locale::_Impl::_Impl(char const*, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E36501: std::locale::locale(char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x6F470A: FixLocales() (GameSetup.cpp:783)
==12397==    by 0x6F48FE: EarlyInit() (GameSetup.cpp:828)
==12397==    by 0x4A59F6: main (main.cpp:512)
==12397== 
Cache: 500 (total: 3951) MiB
==12397== Warning: set address range perms: large range [0x128d9000, 0x31cd9000) (noaccess)
TIMER| InitVfs: 327.54 ms
Sound: AlcInit success, using OpenAL Soft
TIMER| CONFIG_Init: 1.03584 s
TIMER| RunHardwareDetection: 1.90972 s
TIMER| write_sys_info: 87.6816 ms
==12397== Thread 9:
==12397== Syscall param sendmsg(mmsg[0].msg_hdr) points to uninitialised byte(s)
==12397==    at 0x88FB87B: sendmmsg (sendmmsg.c:36)
==12397==    by 0xAEA38FD: __libc_res_nsend (res_send.c:1140)
==12397==    by 0xAEA0D48: __libc_res_nquery (res_query.c:226)
==12397==    by 0xAEA16F8: __libc_res_nsearch (res_query.c:582)
==12397==    by 0x40713B57: _nss_dns_gethostbyname4_r (dns-host.c:314)
==12397==    by 0x88CBADF: gaih_inet (getaddrinfo.c:849)
==12397==    by 0x88CF913: getaddrinfo (getaddrinfo.c:2473)
==12397==    by 0x5B01B23: ??? (in /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0)
==12397==    by 0x5B0D2A3: ??? (in /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0)
==12397==    by 0x5B0ABCA: ??? (in /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0)
==12397==    by 0x85E9F6D: start_thread (pthread_create.c:311)
==12397==    by 0x88F99CC: clone (clone.S:113)
==12397==  Address 0x402fdfa0 is on thread 9's stack
==12397== 
TIMER| InitRenderer: 1.018 s
TIMER| ps_console: 190.411 ms
TIMER| ps_lang_hotkeys: 259.576 ms
==12397== Thread 1:
==12397== Invalid read of size 8
==12397==    at 0x88A370D: wcsrchr (wcsrchr.S:104)
==12397==    by 0x9F5212: path_name_only(wchar_t const*) (path.cpp:87)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x97D697: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:200)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397==    by 0x6F3CB8: InitPs(bool, CStrW const&, ScriptInterface*, CScriptVal) (GameSetup.cpp:519)
==12397==    by 0x6F51B9: InitGraphics(CmdLineArgs const&, int) (GameSetup.cpp:1026)
==12397==    by 0x4A56CA: RunGameOrAtlas(int, char const**) (main.cpp:469)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397==  Address 0x3e915f00 is 192 bytes inside a block of size 196 alloc'd
==12397==    at 0x4C2A879: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x7E808AE: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_create(unsigned long, unsigned long, std::allocator<wchar_t> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x91B222: wchar_t* std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_construct<wchar_t*>(wchar_t*, wchar_t*, std::allocator<wchar_t> const&, std::forward_iterator_tag) (basic_string.tcc:138)
==12397==    by 0x7E81EFC: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E81F31: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::substr(unsigned long, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x4A69B5: Path::Parent() const (path.h:155)
==12397==    by 0x7352A8: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x97D697: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:200)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397== 
==12397== Invalid read of size 8
==12397==    at 0x88A372A: wcsrchr (wcsrchr.S:113)
==12397==    by 0x9F5227: path_name_only(wchar_t const*) (path.cpp:88)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x97D697: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:200)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397==    by 0x6F3CB8: InitPs(bool, CStrW const&, ScriptInterface*, CScriptVal) (GameSetup.cpp:519)
==12397==    by 0x6F51B9: InitGraphics(CmdLineArgs const&, int) (GameSetup.cpp:1026)
==12397==    by 0x4A56CA: RunGameOrAtlas(int, char const**) (main.cpp:469)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397==  Address 0x3e915f00 is 192 bytes inside a block of size 196 alloc'd
==12397==    at 0x4C2A879: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x7E808AE: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_create(unsigned long, unsigned long, std::allocator<wchar_t> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x91B222: wchar_t* std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_construct<wchar_t*>(wchar_t*, wchar_t*, std::allocator<wchar_t> const&, std::forward_iterator_tag) (basic_string.tcc:138)
==12397==    by 0x7E81EFC: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E81F31: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::substr(unsigned long, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x4A69B5: Path::Parent() const (path.h:155)
==12397==    by 0x7352A8: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x97D697: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:200)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397== 
TIMER| common/modern/styles.xml: 110.358 ms
TIMER| common/modern/sprites.xml: 206.571 ms
TIMER| common/modern/setup.xml: 238.52 ms
TIMER| common/setup.xml: 166.683 ms
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36CD: wcsrchr (wcsrchr.S:76)
==12397==    by 0x9F5212: path_name_only(wchar_t const*) (path.cpp:87)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x94EAEC: CGUI::LoadXmlFile(Path const&, boost::unordered::unordered_set<Path, boost::hash<Path>, std::equal_to<Path>, std::allocator<Path> >&) (CGUI.cpp:923)
==12397==    by 0x97D9A0: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:243)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397==    by 0x6F3CB8: InitPs(bool, CStrW const&, ScriptInterface*, CScriptVal) (GameSetup.cpp:519)
==12397==    by 0x6F51B9: InitGraphics(CmdLineArgs const&, int) (GameSetup.cpp:1026)
==12397==    by 0x4A56CA: RunGameOrAtlas(int, char const**) (main.cpp:469)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36E3: wcsrchr (wcsrchr.S:87)
==12397==    by 0x9F5212: path_name_only(wchar_t const*) (path.cpp:87)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x94EAEC: CGUI::LoadXmlFile(Path const&, boost::unordered::unordered_set<Path, boost::hash<Path>, std::equal_to<Path>, std::allocator<Path> >&) (CGUI.cpp:923)
==12397==    by 0x97D9A0: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:243)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397==    by 0x6F3CB8: InitPs(bool, CStrW const&, ScriptInterface*, CScriptVal) (GameSetup.cpp:519)
==12397==    by 0x6F51B9: InitGraphics(CmdLineArgs const&, int) (GameSetup.cpp:1026)
==12397==    by 0x4A56CA: RunGameOrAtlas(int, char const**) (main.cpp:469)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36CD: wcsrchr (wcsrchr.S:76)
==12397==    by 0x9F5227: path_name_only(wchar_t const*) (path.cpp:88)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x94EAEC: CGUI::LoadXmlFile(Path const&, boost::unordered::unordered_set<Path, boost::hash<Path>, std::equal_to<Path>, std::allocator<Path> >&) (CGUI.cpp:923)
==12397==    by 0x97D9A0: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:243)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397==    by 0x6F3CB8: InitPs(bool, CStrW const&, ScriptInterface*, CScriptVal) (GameSetup.cpp:519)
==12397==    by 0x6F51B9: InitGraphics(CmdLineArgs const&, int) (GameSetup.cpp:1026)
==12397==    by 0x4A56CA: RunGameOrAtlas(int, char const**) (main.cpp:469)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36D2: wcsrchr (wcsrchr.S:79)
==12397==    by 0x9F5227: path_name_only(wchar_t const*) (path.cpp:88)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x734A5D: CCacheLoader::TryLoadingCached(Path const&, MD5 const&, unsigned int, Path&) (CacheLoader.cpp:56)
==12397==    by 0x6F818E: CXeromyces::Load(boost::shared_ptr<IVFS> const&, Path const&) (Xeromyces.cpp:76)
==12397==    by 0x94EAEC: CGUI::LoadXmlFile(Path const&, boost::unordered::unordered_set<Path, boost::hash<Path>, std::equal_to<Path>, std::allocator<Path> >&) (CGUI.cpp:923)
==12397==    by 0x97D9A0: CGUIManager::LoadPage(CGUIManager::SGUIPage&) (GUIManager.cpp:243)
==12397==    by 0x97CC38: CGUIManager::PushPage(CStrW const&, boost::shared_ptr<ScriptInterface::StructuredClone>) (GUIManager.cpp:102)
==12397==    by 0x97CABD: CGUIManager::SwitchPage(CStrW const&, ScriptInterface*, CScriptVal) (GUIManager.cpp:94)
==12397==    by 0x6F3CB8: InitPs(bool, CStrW const&, ScriptInterface*, CScriptVal) (GameSetup.cpp:519)
==12397==    by 0x6F51B9: InitGraphics(CmdLineArgs const&, int) (GameSetup.cpp:1026)
==12397==    by 0x4A56CA: RunGameOrAtlas(int, char const**) (main.cpp:469)
==12397== 
TIMER| common/sprite1.xml: 265.711 ms
TIMER| common/styles.xml: 9.29067 ms
TIMER| common/common_sprites.xml: 211.324 ms
TIMER| common/common_styles.xml: 26.5598 ms
TIMER| common/init.xml: 155.22 ms
TIMER| pregame/sprites.xml: 49.1047 ms
TIMER| pregame/styles.xml: 3.36327 ms
TIMER| pregame/mainmenu.xml: 697.868 ms
TIMER| common/global.xml: 60.9784 ms
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x7270DCF: ??? (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==12397==    by 0x7271383: ??? (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==12397==    by 0x7271B7A: ??? (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==12397==    by 0x7248E5B: SDL_PumpEvents (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==12397==    by 0x7248E98: SDL_PollEvent (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==12397==    by 0x9F5A6B: in_poll_event(SDL_Event_*) (input.cpp:89)
==12397==    by 0x4A477C: PumpEvents() (main.cpp:182)
==12397==    by 0x4A4DBD: Frame() (main.cpp:315)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0xA79F3F: S3tcBlock::PrecalculateColor(unsigned long, unsigned char const*) (tex_dds.cpp:181)
==12397==    by 0xA797EF: S3tcBlock::S3tcBlock(unsigned long, unsigned char const*) (tex_dds.cpp:61)
==12397==    by 0xA7846F: s3tc_decompress_level(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*) (tex_dds.cpp:248)
==12397==    by 0xA553B5: tex_util_foreach_mipmap(unsigned long, unsigned long, unsigned long, unsigned char const*, int, unsigned long, void (*)(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*), void*) (tex.cpp:151)
==12397==    by 0xA78797: s3tc_decompress(Tex*) (tex_dds.cpp:292)
==12397==    by 0xA794FE: dds_transform(Tex*, unsigned long) (tex_dds.cpp:646)
==12397==    by 0xA577AB: tex_codec_transform(Tex*, unsigned long) (tex_codec.cpp:114)
==12397==    by 0xA5630F: Tex::transform(unsigned long) (tex.cpp:481)
==12397==    by 0xA563D3: Tex::transform_to(unsigned long) (tex.cpp:498)
==12397==    by 0xA569F2: Tex::get_average_colour() const (tex.cpp:664)
==12397==    by 0xA22BAD: ogl_tex_get_average_colour(long, unsigned int*) (ogl_tex.cpp:1048)
==12397==    by 0x76CDCB: CTextureManagerImpl::LoadTexture(boost::shared_ptr<CTexture> const&, Path const&) (TextureManager.cpp:193)
==12397== 
==12397== Use of uninitialised value of size 8
==12397==    at 0xA798A8: S3tcBlock::WritePixel(unsigned long, unsigned char*) const (tex_dds.cpp:71)
==12397==    by 0xA7851A: s3tc_decompress_level(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*) (tex_dds.cpp:259)
==12397==    by 0xA553B5: tex_util_foreach_mipmap(unsigned long, unsigned long, unsigned long, unsigned char const*, int, unsigned long, void (*)(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*), void*) (tex.cpp:151)
==12397==    by 0xA78797: s3tc_decompress(Tex*) (tex_dds.cpp:292)
==12397==    by 0xA794FE: dds_transform(Tex*, unsigned long) (tex_dds.cpp:646)
==12397==    by 0xA577AB: tex_codec_transform(Tex*, unsigned long) (tex_codec.cpp:114)
==12397==    by 0xA5630F: Tex::transform(unsigned long) (tex.cpp:481)
==12397==    by 0xA563D3: Tex::transform_to(unsigned long) (tex.cpp:498)
==12397==    by 0xA569F2: Tex::get_average_colour() const (tex.cpp:664)
==12397==    by 0xA22BAD: ogl_tex_get_average_colour(long, unsigned int*) (ogl_tex.cpp:1048)
==12397==    by 0x76CDCB: CTextureManagerImpl::LoadTexture(boost::shared_ptr<CTexture> const&, Path const&) (TextureManager.cpp:193)
==12397==    by 0x76D0FD: CTextureManagerImpl::TryLoadingCached(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:266)
==12397== 
==12397== Invalid free() / delete / delete[] / realloc()
==12397==    at 0x4C2BADC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x9435EE: void boost::checked_delete<unsigned char>(unsigned char*) (checked_delete.hpp:34)
==12397==    by 0x9436D8: boost::detail::sp_counted_impl_p<unsigned char>::dispose() (sp_counted_impl.hpp:78)
==12397==    by 0x4A6254: boost::detail::sp_counted_base::release() (sp_counted_base_gcc_x86.hpp:146)
==12397==    by 0x4A6351: boost::detail::shared_count::~shared_count() (shared_count.hpp:371)
==12397==    by 0x556828: boost::shared_ptr<unsigned char>::~shared_ptr() (shared_ptr.hpp:328)
==12397==    by 0xA56B26: Tex::get_average_colour() const (tex.cpp:660)
==12397==    by 0xA22BAD: ogl_tex_get_average_colour(long, unsigned int*) (ogl_tex.cpp:1048)
==12397==    by 0x76CDCB: CTextureManagerImpl::LoadTexture(boost::shared_ptr<CTexture> const&, Path const&) (TextureManager.cpp:193)
==12397==    by 0x76D0FD: CTextureManagerImpl::TryLoadingCached(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:266)
==12397==    by 0x76AF11: CTexture::TryLoad() (TextureManager.cpp:557)
==12397==    by 0x76AE5E: CTexture::GetHandle() (TextureManager.cpp:544)
==12397==  Address 0x7fefff340 is on thread 1's stack
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0xA79C25: S3tcBlock::PrecalculateAlpha(unsigned long, unsigned char const*) (tex_dds.cpp:144)
==12397==    by 0xA797D8: S3tcBlock::S3tcBlock(unsigned long, unsigned char const*) (tex_dds.cpp:60)
==12397==    by 0xA7846F: s3tc_decompress_level(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*) (tex_dds.cpp:248)
==12397==    by 0xA553B5: tex_util_foreach_mipmap(unsigned long, unsigned long, unsigned long, unsigned char const*, int, unsigned long, void (*)(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*), void*) (tex.cpp:151)
==12397==    by 0xA78797: s3tc_decompress(Tex*) (tex_dds.cpp:292)
==12397==    by 0xA794FE: dds_transform(Tex*, unsigned long) (tex_dds.cpp:646)
==12397==    by 0xA577AB: tex_codec_transform(Tex*, unsigned long) (tex_codec.cpp:114)
==12397==    by 0xA5630F: Tex::transform(unsigned long) (tex.cpp:481)
==12397==    by 0xA563D3: Tex::transform_to(unsigned long) (tex.cpp:498)
==12397==    by 0xA569F2: Tex::get_average_colour() const (tex.cpp:664)
==12397==    by 0xA22BAD: ogl_tex_get_average_colour(long, unsigned int*) (ogl_tex.cpp:1048)
==12397==    by 0x76CDCB: CTextureManagerImpl::LoadTexture(boost::shared_ptr<CTexture> const&, Path const&) (TextureManager.cpp:193)
==12397== 
==12397== Use of uninitialised value of size 8
==12397==    at 0xA79953: S3tcBlock::WritePixel(unsigned long, unsigned char*) const (tex_dds.cpp:88)
==12397==    by 0xA7851A: s3tc_decompress_level(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*) (tex_dds.cpp:259)
==12397==    by 0xA553B5: tex_util_foreach_mipmap(unsigned long, unsigned long, unsigned long, unsigned char const*, int, unsigned long, void (*)(unsigned long, unsigned long, unsigned long, unsigned char const*, unsigned long, void*), void*) (tex.cpp:151)
==12397==    by 0xA78797: s3tc_decompress(Tex*) (tex_dds.cpp:292)
==12397==    by 0xA794FE: dds_transform(Tex*, unsigned long) (tex_dds.cpp:646)
==12397==    by 0xA577AB: tex_codec_transform(Tex*, unsigned long) (tex_codec.cpp:114)
==12397==    by 0xA5630F: Tex::transform(unsigned long) (tex.cpp:481)
==12397==    by 0xA563D3: Tex::transform_to(unsigned long) (tex.cpp:498)
==12397==    by 0xA569F2: Tex::get_average_colour() const (tex.cpp:664)
==12397==    by 0xA22BAD: ogl_tex_get_average_colour(long, unsigned int*) (ogl_tex.cpp:1048)
==12397==    by 0x76CDCB: CTextureManagerImpl::LoadTexture(boost::shared_ptr<CTexture> const&, Path const&) (TextureManager.cpp:193)
==12397==    by 0x76D0FD: CTextureManagerImpl::TryLoadingCached(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:266)
==12397== 
sys_cursor_create: using Xcursor to create 32 x 32 cursor
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36CD: wcsrchr (wcsrchr.S:76)
==12397==    by 0x9F5212: path_name_only(wchar_t const*) (path.cpp:87)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36E3: wcsrchr (wcsrchr.S:87)
==12397==    by 0x9F5212: path_name_only(wchar_t const*) (path.cpp:87)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397== 
==12397== Invalid read of size 8
==12397==    at 0x88A370D: wcsrchr (wcsrchr.S:104)
==12397==    by 0x9F5212: path_name_only(wchar_t const*) (path.cpp:87)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397==  Address 0x409528a0 is 192 bytes inside a block of size 196 alloc'd
==12397==    at 0x4C2A879: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x7E808AE: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_create(unsigned long, unsigned long, std::allocator<wchar_t> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x91B222: wchar_t* std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_construct<wchar_t*>(wchar_t*, wchar_t*, std::allocator<wchar_t> const&, std::forward_iterator_tag) (basic_string.tcc:138)
==12397==    by 0x7E81EFC: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E81F31: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::substr(unsigned long, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x4A69B5: Path::Parent() const (path.h:155)
==12397==    by 0x7352A8: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36CD: wcsrchr (wcsrchr.S:76)
==12397==    by 0x9F5227: path_name_only(wchar_t const*) (path.cpp:88)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397== 
==12397== Conditional jump or move depends on uninitialised value(s)
==12397==    at 0x88A36D2: wcsrchr (wcsrchr.S:79)
==12397==    by 0x9F5227: path_name_only(wchar_t const*) (path.cpp:88)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397== 
==12397== Invalid read of size 8
==12397==    at 0x88A372A: wcsrchr (wcsrchr.S:113)
==12397==    by 0x9F5227: path_name_only(wchar_t const*) (path.cpp:88)
==12397==    by 0x7352C7: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397==    by 0x4A56D6: RunGameOrAtlas(int, char const**) (main.cpp:472)
==12397==    by 0x4A5A07: main (main.cpp:514)
==12397==  Address 0x409528a0 is 192 bytes inside a block of size 196 alloc'd
==12397==    at 0x4C2A879: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12397==    by 0x7E808AE: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_create(unsigned long, unsigned long, std::allocator<wchar_t> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x91B222: wchar_t* std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_construct<wchar_t*>(wchar_t*, wchar_t*, std::allocator<wchar_t> const&, std::forward_iterator_tag) (basic_string.tcc:138)
==12397==    by 0x7E81EFC: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x7E81F31: std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::substr(unsigned long, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==12397==    by 0x4A69B5: Path::Parent() const (path.h:155)
==12397==    by 0x7352A8: CCacheLoader::LooseCachePath(Path const&, MD5 const&, unsigned int) (CacheLoader.cpp:151)
==12397==    by 0x76D2FB: CTextureManagerImpl::ConvertTexture(boost::shared_ptr<CTexture> const&) (TextureManager.cpp:300)
==12397==    by 0x76D8AF: CTextureManagerImpl::MakeProgress() (TextureManager.cpp:371)
==12397==    by 0x76B4A5: CTextureManager::MakeProgress() (TextureManager.cpp:653)
==12397==    by 0x4A4B84: RendererIncrementalLoad() (main.cpp:253)
==12397==    by 0x4A4DB8: Frame() (main.cpp:313)
==12397== 
TIMER| common/modern/styles.xml: 13.0805 ms
TIMER| common/modern/sprites.xml: 104.3 ms
TIMER| common/modern/setup.xml: 7.08308 ms
TIMER| common/setup.xml: 58.6589 ms
TIMER| common/sprite1.xml: 170.772 ms
TIMER| common/styles.xml: 2.43723 ms
TIMER| common/common_sprites.xml: 209.267 ms
TIMER| common/common_styles.xml: 25.6133 ms
TIMER| msgbox/msgbox.xml: 131.382 ms
TIMER| shutdown TexMan: 19.732 ms
TIMER| shutdown Renderer: 245.277 ms
TIMER| shutdown SDL: 842.656 ms
TIMER| shutdown UserReporter: 72.5194 ms
TIMER| shutdown ConfigDB: 895.208 us
AL lib: FreeContext: (0x12291900) Deleting 64 Source(s)
TIMER| resource modules: 419.867 ms
TIMER TOTALS (9 clients)
-----------------------------------------------------
  tc_png_decode: 1915.46 Mc (11x)
  tc_dds_transform: 71.2869 Mc (20x)
  tc_pool_alloc: 39.6423 Mc (132x)
  tc_transform: 727.48 Mc (14x)
  tc_plain_transform: 644.47 Mc (14x)
  tc_ShaderGLSLLink: 3929.94 Mc (4x)
  tc_ShaderGLSLCompile: 9734.7 Mc (8x)
  tc_ShaderValidation: 1403.87 Mc (5x)
  xml_validation: 1181.04 Mc (5x)
-----------------------------------------------------
TIMER| shutdown misc: 30.5854 ms
==12397== 
==12397== HEAP SUMMARY:
==12397==     in use at exit: 1,351,245 bytes in 1,030 blocks
==12397==   total heap usage: 992,407 allocs, 991,380 frees, 223,345,261 bytes allocated
==12397== 
==12397== LEAK SUMMARY:
==12397==    definitely lost: 11,977 bytes in 138 blocks
==12397==    indirectly lost: 126,690 bytes in 145 blocks
==12397==      possibly lost: 3,757 bytes in 2 blocks
==12397==    still reachable: 1,208,821 bytes in 745 blocks
==12397==         suppressed: 0 bytes in 0 blocks
==12397== Rerun with --leak-check=full to see details of leaked memory
==12397== 
==12397== For counts of detected and suppressed errors, rerun with: -v
==12397== Use --track-origins=yes to see where uninitialised values come from
==12397== ERROR SUMMARY: 592 errors from 21 contexts (suppressed: 8629483 from 4461)

Not all those warnings/errors are related to your patch.

by IronNerd, 10 years ago

Attachment: Tex_v2.patch added

comment:2 by IronNerd, 10 years ago

I booted linux in a VM and managed to reproduce the problem. I've uploaded Tex_v2.patch, which should fix both the warning and the crash. Thanks for the detailed outputs!

comment:3 by Josh, 10 years ago

The second patch seems to compile and run fine (except there still are a few possibly related memory warnings from valgrind). This should be committable after someone more familiar with graphics programming approves the patch logic.

Thanks for the effort you're putting into this!

comment:4 by wraitii, 10 years ago

Compiled nicely on my system (using OSX 10.8 sdk). Works in-game. This fits our convention and seems a good change anyway...

Why not go al the way and make "Tex" a class now that it behaves really quite like one?

comment:5 by IronNerd, 10 years ago

This is just the first stage of the change. I intend to officially change it to a class when its metamorphosis is complete and it's actually used like one. By used as a class, I mean that basically everything is done through meaningful functions and not just get/set the member variables to get the job done.

Step 1 (this): Move all of the major functions inside the struct and make it RAII by default

Step 2: Change the Tex_Codec code to actually use this like a class (coded, but not uploaded for review, as it would make the review too big... about this size of a change again)

Step 3: Overhaul the OglTex implementation, which also currently doesn't really use this like a class (This is actually about 2-3 steps if we want to keep review sizes reasonable)

Step 4: Implement native OpenGL cubemap support and change the rendering code to use that instead of its current hack (which uses tex quite like a struct still)

Step 5: Translate this into a real full-fledged class with private members and a meaningful interface.

As you can see, there is still quite a bit of work to do before we can really elevate Tex to its desired status, and the whole work-chain required is many times larger than this small patch. As soon as this one is in, we can move to reviewing step 2 as I implement step 3.

comment:6 by Josh, 10 years ago

Hmm, so some bad news. I noticed that the minimap colors are distorted when your patch is applied.

Normal: https://googledrive.com/host/0BwIjnJSd7iThRXRiN0ExcVVaeDQ/normal-minimap.png With Patch: https://googledrive.com/host/0BwIjnJSd7iThRXRiN0ExcVVaeDQ/with-patch-minimap.png

It seems the terrain textures aren't loaded properly on the minimap.

Edit: Probably something is getting corrupted as with a reload of that map, instead of black it is neon green.

Last edited 10 years ago by Josh (previous) (diff)

comment:7 by IronNerd, 10 years ago

Cannot reproduce, I get this blackness only until the textures are loaded. Please flush your cache and try again.

comment:8 by JoshuaJB, 10 years ago

Resolution: fixed
Status: newclosed

In 14835:

Texture system refactoring and cleanup, fixes #2455, patch by IronNerd.

comment:9 by Josh, 10 years ago

Milestone: BacklogAlpha 16

comment:10 by Josh, 10 years ago

IronNerd: Do you think you'll have time to complete any more work on 0AD? Your contributions were very appreciated and we'd love to see you back, even if it's just small patches.

Note: See TracTickets for help on using tickets.