Skip to content

Commit

Permalink
igl | Add IGL_WITH_TEXTURE_LOADER to Tiny_MeshLarge
Browse files Browse the repository at this point in the history
Summary: Decoupled IGLU and texture loading. Added `IGL_WITH_TEXTURE_LOADER` macro.

Reviewed By: MichaelTay

Differential Revision: D49669714

fbshipit-source-id: 8e20fafedf256889b9535692df84ff01af8b9854
  • Loading branch information
corporateshark authored and facebook-github-bot committed Sep 27, 2023
1 parent 9abe2e5 commit 7d81394
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions samples/desktop/Tiny/Tiny_MeshLarge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@

#if IGL_WITH_IGLU
#include <IGLU/imgui/Session.h>
#endif // IGL_WITH_IGLU

#if IGL_WITH_TEXTURE_LOADER
#include <IGLU/texture_loader/ktx1/TextureLoaderFactory.h>
#include <IGLU/texture_loader/ktx2/TextureLoaderFactory.h>
#endif
#endif // IGL_WITH_TEXTURE_LOADER

namespace {

Expand All @@ -146,11 +149,11 @@ constexpr bool kEnableValidationLayers = true;
std::string contentRootFolder;

#if IGL_WITH_IGLU

std::unique_ptr<iglu::imgui::Session> imguiSession_;

igl::shell::InputDispatcher inputDispatcher_;
#endif // IGL_WITH_IGLU

#if IGL_WITH_TEXTURE_LOADER
void loadKtxTexture(const igl::IDevice& device,
igl::ICommandQueue& commandQueue,
const std::string filename,
Expand Down Expand Up @@ -199,7 +202,7 @@ void loadKtxTexture(const igl::IDevice& device,
}
}
}
#endif // IGL_WITH_IGLU
#endif // IGL_WITH_TEXTURE_LOADER

const char* kCodeComputeTest = R"(
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
Expand Down Expand Up @@ -2251,7 +2254,7 @@ void loadCubemapTexture(const std::string& fileNameKTX, std::shared_ptr<ITexture
return;
}

#if IGL_WITH_IGLU
#if IGL_WITH_TEXTURE_LOADER
loadKtxTexture(*device_, *commandQueue_, fileNameKTX, tex, !kEnableCompression);
#else
auto texRef = gli::load_ktx(fileNameKTX);
Expand Down Expand Up @@ -2439,7 +2442,7 @@ std::shared_ptr<ITexture> createTexture(const LoadedImage& img) {

if (kEnableCompression && img.channels == 4 &&
std::filesystem::exists(img.compressedFileName.c_str())) {
#if IGL_WITH_IGLU
#if IGL_WITH_TEXTURE_LOADER
loadKtxTexture(*device_, *commandQueue_, img.compressedFileName, tex, false);
#else
// Uploading the texture
Expand Down

0 comments on commit 7d81394

Please sign in to comment.