* Fix warning C4146: unary minus operator applied to unsigned type, result still unsigned
* Fix warning C4068: unknown pragma 'nounroll'
* Fix warning C4068: unknown pragma 'unroll'
* Fix warning C4068: unknown pragma 'clang'
* Fix warning C4305: 'initializing': truncation from 'double' to 'float'
* Fix warning C4267: 'argument': conversion from 'size_t' to 'utils::FixedCapacityVector<filament::uberz::WritableArchive::Material,std::allocator<T>,true>::size_type', possible loss of data
* Fix warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data
* Fix warning C4244: 'initializing': conversion from 'A' to 'T', possible loss of data
* Fix warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
* Fix warning C4293: '>>': shift count negative or too big, undefined behavior
* Fix diagnostic warning C4189: 'channels': local variable is initialized but not referenced
* Use [[maybe_unused]] where possible and revert aa79bd6fa8.
* Revert unary minus for non-MSVC compilers
* Add macro for enabling warnings temporarily
* Get rid of UTILS_HAS_CXX17
* Revisit warning related macros
Co-authored-by: Levente Koncz <levente.koncz@shapr3d.com>
80 lines
2.1 KiB
C++
80 lines
2.1 KiB
C++
/*
|
|
* Copyright (C) 2022 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef UBERZ_READABLE_ARCHIVE_H
|
|
#define UBERZ_READABLE_ARCHIVE_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <uberz/ArchiveEnums.h>
|
|
|
|
#include <filament/MaterialEnums.h>
|
|
|
|
namespace filament::uberz {
|
|
|
|
// ArchiveSpec is a parse-free binary format. The client simply casts a word-aligned content blob
|
|
// into a ReadableArchive struct pointer, then calls the following function to convert all the
|
|
// offset fields into pointers.
|
|
void convertOffsetsToPointers(struct ReadableArchive* archive);
|
|
|
|
UTILS_WARNING_PUSH
|
|
UTILS_WARNING_ENABLE_PADDED
|
|
|
|
// Precompiled set of materials bundled with a list of features flags that each material supports.
|
|
// This is the readable counterpart to WriteableArchive.
|
|
// Used by gltfio; users do not need to access this class directly.
|
|
struct ReadableArchive {
|
|
uint32_t magic;
|
|
uint32_t version;
|
|
uint64_t specsCount;
|
|
union {
|
|
struct ArchiveSpec* specs;
|
|
uint64_t specsOffset;
|
|
};
|
|
};
|
|
|
|
static constexpr Shading INVALID_SHADING_MODEL = (Shading) 0xff;
|
|
static constexpr BlendingMode INVALID_BLENDING = (BlendingMode) 0xff;
|
|
|
|
struct ArchiveSpec {
|
|
Shading shadingModel;
|
|
BlendingMode blendingMode;
|
|
uint16_t flagsCount;
|
|
uint32_t packageByteCount;
|
|
union {
|
|
struct ArchiveFlag* flags;
|
|
uint64_t flagsOffset;
|
|
};
|
|
union {
|
|
uint8_t* package;
|
|
uint64_t packageOffset;
|
|
};
|
|
};
|
|
|
|
struct ArchiveFlag {
|
|
union {
|
|
const char* name;
|
|
uint64_t nameOffset;
|
|
};
|
|
ArchiveFeature value;
|
|
};
|
|
|
|
UTILS_WARNING_POP
|
|
|
|
} // namespace filament::uberz
|
|
|
|
#endif // UBERZ_READABLE_ARCHIVE_H
|