Commit Graph

96 Commits

Author SHA1 Message Date
Ben Doherty
cf91e42847 Switch ASSERT macros to new stream API (#7881) 2024-05-24 20:46:34 +00:00
Romain Guy
cb9bfaeb83 Fix build warnings (#7189)
The latest macOS toolchain triggers warnings for duplicate libraries at
link time. This is caused by our dependency chains.

Also remove an inlining warning in Kotlin and unnecessary warnings in
build.sh when doing a clean or generating web docs.
2023-09-20 10:16:55 -07:00
Mathias Agopian
4503ad1e34 fix -ffast-math and -fno-finite-math-only
- remove -ffast-math in place where it didn't seem too useful
- added -fno-finite-math-only everywhere we use -ffast-math so that
  isinf/isnan work.
2023-03-30 16:15:42 -07:00
Koncz Levente
c2fcaf7a6b Add RGTC + BPTC support (#6320)
* Add RGTC support
* Add BPTC support
2022-12-06 11:18:35 -08:00
gaborvalasek
39cb238065 Fix MSVC warnings (#5926)
* 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>
2022-08-24 11:41:10 -07:00
Johnathon Selstad
1e3ddd612e Organize Subprojects into Folders in the IDE (#5934)
* Begin Sorting SubProjects into Folders

* Add more subprojects to folders

* Add even more subprojects to folders

* Add further subprojects to folders

* Move the last two projects

* Move Resources to a Resources subfolder

* Remove spaces to be stylistically coherent

* Revert Improper CMake Modifications

* Revert erroneous line removals

* Only specify sdl2's folder on WIN32

* Add the shader subprojects to a Generated folder

* Move shaders to Filament/Shaders
2022-08-17 12:42:21 -07:00
Mathias Agopian
5b71274fa5 get rid of utils::StaticString
In most places this is simply replaced by `std::string_view`.

We also change a few internal/private headers so they accept 
`std::string_view` instead of `utils::CString`.
2022-08-02 09:51:13 -07:00
Mathias Agopian
88768e8003 Fix Conflict with glibc 2.35+ macro.
Fix #5720
2022-07-11 15:25:02 -07:00
Mathias Agopian
718e7ab064 remove a bunch of <functional> includes
This forces us to use an explicit hash class in a few place, but it
is cleaner.

remove utils::lower_bound and utils::upper_bound, which were not used.
2022-06-03 08:35:57 -07:00
Pei Jia
edb9ca71e5 included header files are now in alphabetic order 2022-05-11 15:04:53 -07:00
Pei Jia
ad9ce72f61 header files added, for compatibility of clang c++17. Don't forget to add -std=c++17. 2022-05-11 15:04:53 -07:00
Philip Rideout
9aeec3a759 Add Ktx2Reader and BasisEncoder and use them in samples.
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
2022-04-15 10:48:48 -07:00
Philip Rideout
df03fdf3d7 mipgen: fixups / clarification regarding sRGB.
The `g_linearized` variable was being used for two purposes: to denote
the linearity of the source format AND the linearity of the destination
format. This was confusing and is now split is `sourceIsLinear` and
`destIsLinear`.

This change has no effect on the the look of the suzanne demo.
2022-04-11 14:28:34 -07:00
Philip Rideout
b60518caa5 Add libs/ktxreader, rename some things to prep for KTX2.
Changes:

- Remove the strange header-only variant of libs/image
- Rename KtxBundle => Ktx1Bundle
- Move image/KtxUtility => ktxreader/Ktx1Reader
- Add unit test for Ktx1Reader and test stub for KTX2.

Notes:

- Ktx1Bundle does not depend on Filament and is used by cmgen
  and mipgen to generate KTX files.

- Ktx1Reader has a dependency on Filament and should therefore live in
  a separate library, which it now does.
2022-04-06 10:56:37 -07:00
Joel Winarske
687f4aff13 Flags to support embedded Linux (#4911)
- FILAMENT_SKIP_SDL2=ON is used to  skip dependencies of sdl2 and sdl2 CMake

- FILAMENT_LINUX_IS_MOBILE is used for Mobile build

Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
2021-12-01 08:31:06 -08:00
Romain Guy
8875806c5d Use locale-independent string->float conversion (#4885)
* Use locale-independent string->float conversion

strtof and friends are locale aware and won't parse decimal numbers
with a period ("12.6" for instance) in locales that use another
character for the decimal period ("," in French for instance).

This change introduces a new function called strtof_c that forces
the use of a specific locale (called "C") to make sure we always
parse floats in the desired "C" format ("12.6").

With C++17 we should be able to use std::from_chars but this API
is not implemented in clang for floats at the moment.

* Fix Linux
2021-11-23 12:32:54 -08:00
Ben Doherty
64c5dc63ab Audit usage of UTILS_PUBLIC and fix bluegl linking warning (#3988) 2021-07-12 17:09:13 -07:00
Ben Doherty
ff935e05f2 image: Respect sRGB option for compressed formats (#4039) 2021-05-26 20:37:58 -07:00
Romain Guy
c66915209e Update our build to the latest and greatest (#3902)
The new requirements are as follow:
- CMake 3.19
- Ninja 1.10
- Android Studio 4.2
- Android NDK 22.1
- Gradle 7.0
- Kotlin 1.5
2021-05-06 10:13:10 -07:00
Philip Rideout
2fe4f6cbe7 AutomationEngine: fix regression with screenshots. 2020-10-28 12:58:54 -07:00
Philip Rideout
d84bb82e44 Merge duplicated implementations of toLinear(). 2020-10-22 17:03:06 -07:00
Philip Rideout
20abfec7d3 Minor change to adhere to CODE_STYLE. 2020-10-12 11:15:45 -07:00
Romain Guy
06b191cd53 Fix broken IBLs (#2850) 2020-07-22 14:02:49 -07:00
Aleksi Sapon
ecbdeb9e6d Remove case KtxBundle::R11F_G11F_B10F in toPixelDataFormat 2020-07-22 13:20:54 -07:00
Romain Guy
c28d9ddb9d Fix support of paletted images and alpha channel in imageio (#2420) 2020-04-18 16:32:05 -07:00
Ben Doherty
acc36e8d9b Deprecating Clang on Windows in CMakeLists (#2243) 2020-03-13 12:33:02 -07:00
Mathias Agopian
651ccb183e New mathfwd.h header
math/mathwfd.h forward declares all {mat|vec}{2|3|4}<> classes,
which allows us to remove their respective #include in a lot of
our public headers.
Our math headers are full of templates, so this should help build times
a bit.

Also we want to keep the public headers as minimalist as possible.
2020-02-12 15:30:13 -08:00
Benjamin Doherty
d1ab68ebfa Fix KTX image test on Windows 2019-11-07 09:15:07 -08:00
Romain Guy
a4a1bf07aa Use our own constants instead of M_PI, M_*, etc. (#1733)
These constants are not part of the standard. We instead use our own
constexpr definitions in the filament::math namespace, as part of
the scalar.h include.
2019-10-02 15:31:38 -07:00
Gregory Popovitch
a34903aa33 Update CMake configuration to support building with MSVC 2019-09-23 10:15:34 -07:00
Philip Rideout
1bda37776b Rename KtxUtility namespace to image::ktx. 2019-09-23 12:08:57 -04:00
Mathias Agopian
2e4a825fec clamp correctly when converting to RGB_11_11_10
This avoids artifacts with unclipped HDR environments.
2019-07-11 22:45:49 -07:00
Ben Doherty
da81e857a0 Correct spherical harmonics comments (#1375) 2019-07-09 16:16:30 -07:00
Ben Doherty
cc4e9db81b Fix spherical harmonics parsing (#1370) 2019-07-02 12:54:52 -07:00
Philip Rideout
56c2d6338e Add spherical harmonics parser, reduce code duplication.
This uses strtof rather than stringstream and provides a common location
that can be leveraged by the upcoming JNI bindings.

Note that this new method lives in KtxBundle rather than KtxUtility. The
latter creates Filament textures and therefore does not get built into
libimage.
2019-06-28 11:10:04 -07:00
Romain Guy
826d52bca2 Fix Windows build and warnings 2019-06-27 09:18:31 -07:00
Philip Rideout
b4d6583901 Fix up WebGL bindings after RGBM removal. 2019-06-24 13:22:34 -07:00
Mathias Agopian
9bce361b3e Remove RGBM support entirely from filament.
⚠️ this break c++ and java source compatibility
2019-06-20 16:17:27 -07:00
Mathias Agopian
54d44a76a7 fix linux builds 2019-06-20 14:36:37 -07:00
Mathias Agopian
2ded1c955f cmgen and filament now support RGB_10_11_11_REV
- RGB_11_11_10 is exported in a RGBA PNG file where the 4 channels are
  used as a uint32 storing a RGB_10_11_11_REV pixel.
  We use the .rgb32f extension, and those PNG files contain garbage 
  when seen in a PNG viewer.

- This is now the default for the -x option.

- compressed KTX files don't encode RGBM, which means they can't
  support HDR, unless an HDR compression scheme is used.
2019-06-20 14:36:37 -07:00
Romain Guy
b1242163f7 Make CMake 3.10 the minimum version, add LTO option (#1316)
* Make CMake 3.10 the minimum version, add LTO option

* Install a newer CMake on Linux CI builds

* Update LLVM and Cmake on Windows CI

* Update build/windows/ci-common.bat

Co-Authored-By: Ben Doherty <benjdoherty15@gmail.com>

* Update formatting

* Apply suggestions from code review

* Update build/windows/ci-common.bat

* Update CMake

* Switch Android projects back to CMake 3.6
2019-06-19 12:53:03 -07:00
Philip Rideout
cc89b6ad1e PathTracer now applies OpenImageDenoise. 2019-05-28 11:43:50 -07:00
Philip Rideout
5a5b6720b0 Add distance field generator to libimage.
This adds some new functions to libimage for computing distance fields
and coordinate fields. This runs on the CPU but uses an efficient
algorithm. This will initially be leveraged by the baking pipeline to
dilate charts, but could be useful in other applications.
2019-05-21 20:21:41 -07:00
Philip Rideout
3291fb6a1b Introduce gltf_baker tool. 2019-05-13 10:25:12 -07:00
Adrian Perez
3987da830c Fix -Wconversion issue in public header (#1172) 2019-05-09 17:00:34 -07:00
prideout
5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
Adrian Perez
7ba46ef5f1 Add explicit includes for types not implied in all stdlib impls 2019-01-30 16:08:57 -08:00
Romain Guy
3be10d816a Cleanup recent change to ImageOps (#678)
* Cleanup recent change to ImageOps

* Add missing sign
2019-01-08 07:20:20 -08:00
nicebyte
83c40e6664 Make 4-channel versions of certain image operations. (#676)
Background: with the Vulkan backend, RGB8 textures do
not work (at least not on my hadrware). This makes me unable to run some
examples, because they use normal maps in RGB8 format.

It appears that the following commit addresses the problem by adding a
special command line option to mipgen:
8dda07bf2c

However, processing normal maps with this option does not work: certain
assertions in the image library fail.

This PR changes these functions in the image library to handle 4-channel
images instead of failing.
2019-01-07 15:16:00 -08:00
gstanlo
28f2806beb Improves linear to srgb conversion functions (#675)
* Improves linear to s/rgb

Adds rounding to nearest whole integer, supports copying over an alpha channel for linear to srgb conversion. Code would previously incorrectly apply sRGB conversion to alpha.

* reformatting previous change
2019-01-04 10:46:20 -08:00