Skip to content

Commit

Permalink
Some appMalloc optimizations
Browse files Browse the repository at this point in the history
- CTextureData::Decompress using appMalloc(noinit)
- indicating init/noinit flag for appMalloc in profiler

Other: optimized DXT texture decompression
- NVTT: using "optimize by speed" mode
- common.project: using "fast floating point" mode for Visual C++ (-fp:fast), otherwise NVTT's "optimize by speed" was failed to locate modern __libm_sse2_sqrt_precise function (UCRT function)
  • Loading branch information
gildor2 committed Jul 15, 2020
1 parent 815c831 commit 80da7e3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Core/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ inline void OutOfMemory(int size)
void* appMalloc(int size, int alignment, bool noInit)
{
guard(appMalloc);
PROFILE_LABEL(noInit ? "NoInit" : "Zero");

#if DEBUG_MEMORY
// Reserve some amount of memory for possibility to log memory when crashed
Expand Down
2 changes: 1 addition & 1 deletion Unreal/UnrealMaterial/UnTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ byte* CTextureData::Decompress(int MipLevel)

int pixelSize = PixelFormatInfo[Format].Float ? 16 : 4;
int size = USize * VSize * pixelSize;
byte* dst = new byte [size];
byte* dst = (byte*)appMalloc(size, DEFAULT_ALIGNMENT, true);

#if 0
{
Expand Down
4 changes: 4 additions & 0 deletions common.project
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ USE_SYSTEM_LIBS = 0
STDDEFS += _NO_CRT_STDIO_INLINE # UCRT (VS 2015+): without that, all printf functions will use some "common" function
!include $WDKCRT/msvcrt.project
!if "$VC_VER" >= 2015 # support for OLDCRT with modern compliers
OPTIONS += -fp:fast
OPTIONS += -Zc:threadSafeInit- # disable calls to C++11 thread-safe static object initializers
STDDEFS += _ACRTIMP_ALT= # remove dllimport from some CRT functions (there're just a few)
!endif
Expand Down Expand Up @@ -93,8 +94,10 @@ OBJDIR = $R/obj/libs-$PLATFORM
!endif

push(INCLUDES)
push(OPTIMIZE)
INCLUDES = $R/libs/nvtt
LIBINCLUDES += $R/libs/nvtt
OPTIMIZE = speed

sources(NV_LIBS) = {
# $R/libs/nvtt/nvcore/*.cpp
Expand All @@ -104,6 +107,7 @@ sources(NV_LIBS) = {
# $R/libs/nvtt/nvtt/bc7/*.cpp
}

pop(OPTIMIZE)
pop(INCLUDES)


Expand Down
Binary file modified umodel
Binary file not shown.
Binary file modified umodel.exe
Binary file not shown.

0 comments on commit 80da7e3

Please sign in to comment.