mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 21:33:00 +02:00
Add nvtt to android build
This commit is contained in:
parent
3e3a585b92
commit
d087530423
4 changed files with 37 additions and 29 deletions
|
@ -112,6 +112,13 @@ def packages = [
|
|||
versionId: 'UTberAIFraEfF9IVjoV66u1DTPTopgeY',
|
||||
checksum: '57fd02baa069176ba18597a29b6b4fc7',
|
||||
],
|
||||
nvtt: [
|
||||
file: 'nvtt_armv8-libcpp.zip',
|
||||
versionId: 'vLqrqThvpq4gp75BHMAqO6HhfTXaa0An',
|
||||
checksum: 'eb46d0b683e66987190ed124aabf8910',
|
||||
sharedLibFolder: 'lib',
|
||||
includeLibs: ['libnvtt.so', 'libnvmath.so', 'libnvimage.so', 'libnvcore.so'],
|
||||
],
|
||||
openssl: [
|
||||
file: 'openssl-1.1.0g_armv8.tgz',
|
||||
versionId: 'DmahmSGFS4ltpHyTdyQvv35WOeUOiib9',
|
||||
|
|
29
cmake/macros/TargetNvtt.cmake
Normal file
29
cmake/macros/TargetNvtt.cmake
Normal file
|
@ -0,0 +1,29 @@
|
|||
if (NOT ANDROID)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Copyright 2015 High Fidelity, Inc.
|
||||
# Created by Bradley Austin Davis on 2015/10/10
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
macro(TARGET_NVTT)
|
||||
if (ANDROID)
|
||||
set(NVTT_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/nvtt)
|
||||
set(NVTT_LIB_DIR "${NVTT_INSTALL_DIR}/lib")
|
||||
set(NVTT_INCLUDE_DIRS "${NVTT_INSTALL_DIR}/include" CACHE TYPE INTERNAL)
|
||||
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvcore.so")
|
||||
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvmath.so")
|
||||
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvimage.so")
|
||||
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvtt.so")
|
||||
set(NVTT_LIBRARIES ${NVTT_LIBS} CACHE TYPE INTERNAL)
|
||||
else()
|
||||
add_dependency_external_projects(nvtt)
|
||||
find_package(NVTT REQUIRED)
|
||||
add_paths_to_fixup_libs(${NVTT_DLL_PATH})
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${NVTT_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${NVTT_LIBRARIES})
|
||||
endmacro()
|
|
@ -1,11 +1,4 @@
|
|||
set(TARGET_NAME image)
|
||||
setup_hifi_library()
|
||||
link_hifi_libraries(shared gpu)
|
||||
|
||||
if (NOT ANDROID)
|
||||
add_dependency_external_projects(nvtt)
|
||||
find_package(NVTT REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${NVTT_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${NVTT_LIBRARIES})
|
||||
add_paths_to_fixup_libs(${NVTT_DLL_PATH})
|
||||
endif()
|
||||
target_nvtt()
|
||||
|
|
|
@ -28,12 +28,8 @@
|
|||
|
||||
using namespace gpu;
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#define CPU_MIPMAPS 1
|
||||
#else
|
||||
#define CPU_MIPMAPS 1
|
||||
#include <nvtt/nvtt.h>
|
||||
#endif
|
||||
|
||||
static const glm::uvec2 SPARSE_PAGE_SIZE(128);
|
||||
static const glm::uvec2 MAX_TEXTURE_SIZE(4096);
|
||||
|
@ -679,7 +675,6 @@ void generateLDRMips(gpu::Texture* texture, QImage&& image, const std::atomic<bo
|
|||
|
||||
void generateMips(gpu::Texture* texture, QImage&& image, const std::atomic<bool>& abortProcessing = false, int face = -1) {
|
||||
#if CPU_MIPMAPS
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
PROFILE_RANGE(resource_parse, "generateMips");
|
||||
|
||||
if (image.format() == QIMAGE_HDR_FORMAT) {
|
||||
|
@ -687,16 +682,6 @@ void generateMips(gpu::Texture* texture, QImage&& image, const std::atomic<bool>
|
|||
} else {
|
||||
generateLDRMips(texture, std::move(image), abortProcessing, face);
|
||||
}
|
||||
|
||||
#else
|
||||
//texture->setAutoGenerateMips(false);
|
||||
texture->assignStoredMip(0, image.byteCount(), image.constBits());
|
||||
for (uint16 level = 1; level < texture->getNumMips(); ++level) {
|
||||
QSize mipSize(texture->evalMipWidth(level), texture->evalMipHeight(level));
|
||||
QImage mipImage = image.scaled(mipSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
texture->assignStoredMip(level, mipImage.byteCount(), mipImage.constBits());
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
texture->setAutoGenerateMips(true);
|
||||
#endif
|
||||
|
@ -737,15 +722,9 @@ gpu::TexturePointer TextureUsage::process2DTextureColorFromImage(QImage&& srcIma
|
|||
bool validAlpha = image.hasAlphaChannel();
|
||||
bool alphaAsMask = false;
|
||||
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
if (image.format() != QImage::Format_ARGB32) {
|
||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
#else
|
||||
if (image.format() != QImage::Format_RGBA8888) {
|
||||
image = image.convertToFormat(QImage::Format_RGBA8888);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (validAlpha) {
|
||||
processTextureAlpha(image, validAlpha, alphaAsMask);
|
||||
|
|
Loading…
Reference in a new issue