Skip to content

Commit

Permalink
Small compilation fixes
Browse files Browse the repository at this point in the history
 - gltfio: Enable -Wall -Werror for gltfio_core
 - gltfio: Fix various errors that were missed warnings
 - matdbg: switch from std::atomic_uint64_t to
   std::atomic<uint64_t> for older clang
  • Loading branch information
poweifeng committed Nov 14, 2023
1 parent 485ae1b commit 6eeb062
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 15 deletions.
11 changes: 6 additions & 5 deletions libs/gltfio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ if (WEBGL_PTHREADS)
target_compile_definitions(gltfio_core PUBLIC -DFILAMENT_WASM_THREADS)
endif()

set(GLTFIO_WARNINGS -Wall -Werror)
if (NOT MSVC)
target_compile_options(gltfio_core PRIVATE ${GLTFIO_WARNINGS})
endif()

if (NOT WEBGL AND NOT ANDROID AND NOT IOS)

# ==================================================================================================
Expand All @@ -185,10 +190,6 @@ if (NOT WEBGL AND NOT ANDROID AND NOT IOS)
target_link_libraries(${TARGET} PUBLIC filamat gltfio_core)
target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
set_target_properties(${TARGET} PROPERTIES FOLDER Libs)

# ==================================================================================================
# Compiler flags
# ==================================================================================================
if (NOT MSVC)
target_compile_options(${TARGET} PRIVATE -Wno-deprecated-register)
endif()
Expand Down Expand Up @@ -229,7 +230,7 @@ if (TNT_DEV AND NOT WEBGL AND NOT ANDROID AND NOT IOS)

target_link_libraries(${TEST_TARGET} PRIVATE ${TARGET} gtest uberarchive)
if (NOT MSVC)
target_compile_options(${TEST_TARGET} PRIVATE -Wno-deprecated-register)
target_compile_options(${TEST_TARGET} PRIVATE ${GLTFIO_WARNINGS})
endif()
set_target_properties(${TEST_TARGET} PROPERTIES FOLDER Tests)
endif()
Expand Down
1 change: 0 additions & 1 deletion libs/gltfio/include/gltfio/ResourceLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class UTILS_PUBLIC ResourceLoader {
private:
bool loadResources(FFilamentAsset* asset, bool async);
void normalizeSkinningWeights(FFilamentAsset* asset) const;
AssetPool* mPool;
struct Impl;
Impl* pImpl;
};
Expand Down
1 change: 0 additions & 1 deletion libs/gltfio/src/AssetLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ void FAssetLoader::createRenderable(const cgltf_node* node, Entity entity, const

void FAssetLoader::createMaterialVariants(const cgltf_mesh* mesh, Entity entity,
FFilamentAsset* fAsset, FFilamentInstance* instance) {
const cgltf_data* srcAsset = fAsset->mSourceAsset->hierarchy;
UvMap uvmap {};
for (cgltf_size prim = 0, n = mesh->primitives_count; prim < n; ++prim) {
const cgltf_primitive& srcPrim = mesh->primitives[prim];
Expand Down
2 changes: 1 addition & 1 deletion libs/gltfio/src/FFilamentAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace utils {

namespace filament::gltfio {

class Wireframe;
struct Wireframe;

// Encapsulates VertexBuffer::setBufferAt() or IndexBuffer::setBuffer().
struct BufferSlot {
Expand Down
2 changes: 1 addition & 1 deletion libs/gltfio/src/Ktx2Provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Texture* Ktx2Provider::pushTexture(const uint8_t* data, size_t byteCount,
}

JobSystem* js = &mEngine->getJobSystem();
item->job = jobs::createJob(*js, mDecoderRootJob, [this, item] {
item->job = jobs::createJob(*js, mDecoderRootJob, [item] {
using Result = ktxreader::Ktx2Reader::Result;
const bool success = Result::SUCCESS == item->async->doTranscoding();
item->transcoderState.store(success ? TranscoderState::SUCCESS : TranscoderState::ERROR);
Expand Down
2 changes: 1 addition & 1 deletion libs/gltfio/src/StbProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Texture* StbProvider::pushTexture(const uint8_t* data, size_t byteCount,
}

JobSystem* js = &mEngine->getJobSystem();
info->decoderJob = jobs::createJob(*js, mDecoderRootJob, [this, info] {
info->decoderJob = jobs::createJob(*js, mDecoderRootJob, [info] {
auto& source = info->sourceBuffer;
int width, height, comp;

Expand Down
4 changes: 0 additions & 4 deletions libs/gltfio/test/gltfio_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ using namespace backend;
using namespace gltfio;
using namespace utils;

constexpr uint32_t WIDTH = 64;
constexpr uint32_t HEIGHT = 64;

char const* ANIMATED_MORPH_CUBE_GLB = "AnimatedMorphCube.glb";

static std::ifstream::pos_type getFileSize(const char* filename) {
Expand Down Expand Up @@ -178,7 +175,6 @@ do { \
TEST_F(glTFIOTest, AnimatedMorphCubeTransforms) {
FilamentAsset const& morphCubeAsset = *mData[ANIMATED_MORPH_CUBE_GLB]->getAsset();
auto const& transformManager = mEngine->getTransformManager();
auto const& renderableManager = mEngine->getRenderableManager();
Entity const* renderables = morphCubeAsset.getRenderableEntities();

EXPECT_EQ(morphCubeAsset.getRenderableEntityCount(), 1u);
Expand Down
2 changes: 1 addition & 1 deletion libs/matdbg/src/ApiHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ApiHandler : public CivetHandler {
// This variable is to implement a *hanging* effect for /api/status. The call to /api/status
// will always block until statusMaterialId is updated again. The client is expected to keep
// calling /api/status (a constant "pull" to simulate a push).
std::atomic_uint64_t mCurrentStatus = 0;
std::atomic<uint64_t> mCurrentStatus = 0;
};

} // filament::matdbg
Expand Down

0 comments on commit 6eeb062

Please sign in to comment.