PVRTexLib crashes on 64-bit

This topic contains 8 replies, has 2 voices, and was last updated by  Greg 2 years, 2 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #50212

    Greg
    Member

    latest version crashes when I try to create ETC2/PVRTC textures

    Crash occurs only on 64-bit!
    32-bit works fine

    It crashes here:

    	~MetaDataBlock[]
    	{
    		if [Data] 
    			delete [] Data;
    		Data = NULL;
    	}

    I’m executing with this code:

    Bool CompressPVRTC2[Int x, Int y, Ptr data, Int type, Int quality, Ptr &compressed_data, Int &compressed_size]
    {
       compressed_data=NULL;
       compressed_size=0;
    
       using namespace pvrtexture;
       CPVRTextureHeader header[PVRStandard8PixelType.PixelTypeID, y, x];
       CPVRTexture       texture[header, data];
    
       if[Transcode[texture, EPVRTPixelFormat[type], ePVRTVarTypeUnsignedByteNorm, ePVRTCSpacelRGB, ECompressorQuality[quality], false]] // dithering makes smooth gradients [like sky] very bad so always disable them
       {
          Ptr data=texture.getDataPtr [];
          Int size=texture.getDataSize[];
          if[data && size>0]
          {
             memcpy[compressed_data=malloc[size], data, compressed_size=size];
             return true;
          }
       }
       return false;
    }
    Attachments:
    #50214

    Greg
    Member

    Also, please note that I’m using Visual Studio 2015.

    And had to define the missing symbols manually:

    #ifdef _WIN32 // TODO: check if in the future this entire block can be removed once a new version of PVRTexLib is released
    #define _NO_CRT_STDIO_INLINE
    #include <stdio.h>
    #include <corecrt_wstdio.h>
    extern “C” FILE* __iob_func[unsigned i] {return __acrt_iob_func[i];}
    int _vsnprintf_l[char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, va_list _ArgList]
    {
        int const _Result = __stdio_common_vsprintf[_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Buffer, _BufferCount, _Format, _Locale, _ArgList];
        return _Result < 0 ? -1 : _Result;
    }
    int _vscprintf_l[char const* const _Format, _locale_t   const _Locale, va_list           _ArgList]
    {
        int const _Result = __stdio_common_vsprintf[_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, _Locale, _ArgList];
        return _Result < 0 ? -1 : _Result;
    }
    int _vsprintf_p_l[char*       const _Buffer, size_t      const _BufferCount, char const* const _Format, _locale_t   const _Locale, va_list           _ArgList]
    {
        int const _Result = __stdio_common_vsprintf_p[_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Buffer, _BufferCount, _Format, _Locale, _ArgList];
        return _Result < 0 ? -1 : _Result;
    }
    int _vscprintf_p_l[char const* const _Format, _locale_t   const _Locale, va_list           _ArgList]
    {
        int const _Result = __stdio_common_vsprintf_p[_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, _Locale, _ArgList];
        return _Result < 0 ? -1 : _Result;
    }
    int _vsnprintf[char* const _Buffer, size_t const _BufferCount, char const* const _Format, va_list _ArgList] {return _vsnprintf_l[_Buffer, _BufferCount, _Format, NULL, _ArgList];}
    int _vscprintf[char const* const _Format, va_list _ArgList] {return _vscprintf_l[_Format, NULL, _ArgList];}
    int _vsprintf_p[char*       const _Buffer, size_t      const _BufferCount, char const* const _Format, va_list           _ArgList] {return _vsprintf_p_l[_Buffer, _BufferCount, _Format, NULL, _ArgList];}
    int _vscprintf_p[char const* const _Format, va_list           _ArgList] {return _vscprintf_p_l[_Format, NULL, _ArgList];}
    int vsprintf[char*       const _Buffer, char const* const _Format, va_list           _ArgList] {return _vsnprintf_l[_Buffer, [size_t]-1, _Format, NULL, _ArgList];}
    int vfprintf[FILE*       const _Stream, char const* const _Format, va_list           _ArgList] {return _vfprintf_l[_Stream, _Format, NULL, _ArgList];}
    int vprintf[char const* const _Format, va_list           _ArgList] {return _vfprintf_l[stdout, _Format, NULL, _ArgList];}
    #endif
    #50217

    Greg
    Member

    I’ve just verified this and when I compile with VS 2013 toolset, then it works OK.

    So please add support for VS 2015, thanks!

    #50243

    Joe Davis
    Member

    Hi Greg,

    Are you using the PVRTexLib dynamic library or the static one? We’re planning to deprecate the static library in future releases due to the maintenance cost of supporting multiple versions of Visual Studio.

    #50249

    Greg
    Member

    Hi Joe,

    I’m using the static library.

    Please kindly do not remove static libraries, as it’s seriously much less hassle with them.
    You don’t need to support multiple versions of Visual Studio, just support one, that is compatible with latest version of Visual Studio, it’s important to stay up to date with technology.

    Right now distributing both dll + static lib is the best option, so developers can choose what’s best for them.

    Please please please do not remove the static lib

    #50252

    Joe Davis
    Member

    Hi Greg,

    Many of our users are stuck on older revisions of Visual Studio. We have to consider very carefully how much time is spent configuring and maintaining static libraries, particularly as the DLL can be used by everyone. We will take your feedback into consideration though.

    #50253

    Greg
    Member

    Hi Joe,

    I’m aware of that, my recommendation is tell them to upgrade.

    It is better to support newer VS rather than older VS in my opinion.

    Besides:
    VS 2015 Community is free
    latest versions of VS will usually generate the most optimized code
    Win10 is also free if that matters

    I had the same dilemma recently, I was using VS 2008 for some things, up until few weeks ago, but I’ve finally decided to make the jump to 2015, and I don’t regret it.

    #51065

    Joe Davis
    Member

    Hi Greg,

    Apologies for the delayed response. Unfortunately, it’s not as easy as recommending our users to upgrade to the latest version of Visual Studio. For many complex projects that are heavily tied into a particular version of the IDE, for example game engines that use many third party binaries that are compiled for a specific version of Visual Studio, upgrading isn’t viable. This leaves us with two options; only provide dynamic libraries that work for everyone, or allocate resources to maintaining many static libraries. We’ve chosen to discontinue the static libraries so we can allocate resources to more pertinent tasks.

    #51085

    Greg
    Member

    Hi,

    I’m a game engine developer myself, I’m the creator of http://esenthel.com (Windows Mac Linux Android iOS Web game engine).

    I’m using heaps of 3rd party libs:
    -AdMob
    -ISPC Texture Compressor
    -Bullet
    -Chartboost
    -Diff Match Patch
    -Facebook
    -FBX
    -Flac
    -FreeType
    -JpegTurbo
    -LZ4
    -LZHAM
    -LZMA
    -Mpg123
    -Oculus
    -Ogg
    -OpenAL
    -Opus
    -PhysX
    -Png
    -PVRTC
    -Recast
    -Snappy
    -SQLite
    -SteamWorks
    -Theora
    -Tiff
    -Vorbis
    -VPX
    -Webp
    -Zlib

    And none of them are holding me back from using them with VS 2015. Only FBX, Steam and PhysX require DLL’s, while all others for Windows I can use as static LIB’s.

    I was even able to make your PVRTexLib static lib work with VS 2015 using a trick.

    I hope you reconsider providing static libs for VS 2015, thank you.

Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic.