Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ target_breakpad()
target_json()
target_glm()
target_discord_rpc()
target_quazip()

# perform standard include and linking for found externals
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
Expand Down
13 changes: 6 additions & 7 deletions libraries/image/src/image/TextureProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@

using namespace gpu;

#if defined(NVTT_API)
#include <nvtt/nvtt.h>

#undef _CRT_SECURE_NO_WARNINGS
#include <Etc.h>
#include <EtcFilter.h>
#endif

static const glm::uvec2 SPARSE_PAGE_SIZE(128);
static const glm::uvec2 MAX_TEXTURE_SIZE_GLES(2048);
Expand Down Expand Up @@ -353,7 +355,7 @@ std::pair<gpu::TexturePointer, glm::ivec2> processImage(std::shared_ptr<QIODevic
// Validate that the image loaded
if (imageWidth == 0 || imageHeight == 0 || image.getFormat() == Image::Format_Invalid) {
QString reason(image.getFormat() == Image::Format_Invalid ? "(Invalid Format)" : "(Size is invalid)");
qCWarning(imagelogging) << "Failed to load" << QString::fromStdString(filename) << ":" << qPrintable(reason);
qCWarning(imagelogging) << "Failed to load" << QString::fromStdString(filename) << ":" << qPrintable(reason);
return { nullptr, { imageWidth, imageHeight } };
}

Expand Down Expand Up @@ -500,11 +502,9 @@ struct MyErrorHandler : public nvtt::ErrorHandler {
}
};

#if defined(NVTT_API)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can remove that if-statement there, since you changed it so if NVTT_API is not defined, nvtt.h won't be included. Meaning nvtt::TaskDispatcher won't be available if NVTT_API is not defined and the build will fail.

@RTUnreal RTUnreal Aug 30, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is-statement is encased in another NVTT_API check, which I think might be an error, because convertImageToLDRTexture and convertImageToHDRTexture are referenced in non-NVTT_API-checked code, meaning we have a hard dependency to nvtt.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
Yeah, I wouldn't be surprised if we depend on NVTT. We never tried without it, and it is actually a huge library with a LOT of functionality. We do depend on GLM though, so maybe that can take over? I don't know too much about those things.

class SequentialTaskDispatcher : public nvtt::TaskDispatcher {
public:
SequentialTaskDispatcher(const std::atomic<bool>& abortProcessing = false) : _abortProcessing(abortProcessing) {
}
SequentialTaskDispatcher(const std::atomic<bool>& abortProcessing = false) : _abortProcessing(abortProcessing) {}

const std::atomic<bool>& _abortProcessing;

Expand All @@ -518,7 +518,6 @@ class SequentialTaskDispatcher : public nvtt::TaskDispatcher {
}
}
};
#endif

void convertToFloatFromPacked(const unsigned char* source, int width, int height, size_t srcLineByteStride, gpu::Element sourceFormat,
glm::vec4* output, size_t outputLinePixelStride) {
Expand Down Expand Up @@ -771,12 +770,12 @@ void convertImageToLDRTexture(gpu::Texture* texture, Image&& image, BackendTarge
}
} else {
int numMips = 1;

if (buildMips) {
numMips += (int)log2(std::max(width, height)) - baseMipLevel;
}
assert(numMips > 0);
Etc::RawImage *mipMaps = new Etc::RawImage[numMips];
Etc::RawImage* mipMaps = new Etc::RawImage[numMips];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone more knowledgable in C++ than I should review this single line.
I believe we only use ETC on Android, so I am unsure if GCC would complain about this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that was something I missed. My auto-formatter changed it and I forgot to revert it

Etc::Image::Format etcFormat = Etc::Image::Format::DEFAULT;

if (mipFormat == gpu::Element::COLOR_COMPRESSED_ETC2_RGB) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ target_opengl()

if (WIN32)
add_compile_definitions(_USE_MATH_DEFINES)
endif()
endif()
2 changes: 2 additions & 0 deletions tools/nitpick/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ endif()

link_hifi_libraries(entities-renderer platform physics)

target_quazip()

# perform standard include and linking for found externals
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
if (${${EXTERNAL}_UPPERCASE}_REQUIRED)
Expand Down
Loading