Commit Graph

22 Commits

Author SHA1 Message Date
Mathias Agopian
d1ca059dad resgen: add compression options
- with `-z` each resource is compressed individually
- with `-Z` the whole package is compressed
2025-08-07 14:58:18 -07:00
Mathias Agopian
ddca795cc9 cleanup resgen code
A test for how Gemini can clean-up code. Changes:

- Configuration Struct: Global variables have been grouped into an 
AppConfig struct. This makes the program's configuration explicit and 
avoids polluting the global namespace.

- Clearer Argument Parsing: The handleArguments function now returns an 
AppConfig object, encapsulating all parsing logic and making the main 
function cleaner.

- Helper Functions: Repetitive tasks like string replacement, file I/O, 
and writing file entries have been extracted into small, well-defined 
helper functions (replaceAll, openOutputFile, readFile, etc.).

- Simplified main Function: The main function is now a high-level 
coordinator, delegating work to helper functions. This makes the overall
 program flow much easier to follow.

- Modern C++ Idioms: The code now consistently uses C++ streams 
(std::cout, std::ofstream) and std::string objects, which is more 
idiomatic than a mix of C and C++ styles.

- added short comments
2025-07-22 16:52:11 -07:00
Mathias Agopian
34e2b81855 internal materials are now generated in different resources
instead of using a single resource binary for all materials, each
postfx set of materials (e.g. dof, bloom) gets its own resource file
based on the directory it is in.
2025-07-15 11:23:36 -07:00
Mathias Agopian
dd844b1183 resgen: output offset/size as constants instead of variables
resgen now generates the resources size/offset directly as #define
instead of as an `extern` variable. The assembly file also 
doesn't generate the corresponding global variables, saving some binary 
space.
2025-07-09 17:08:58 -07:00
Powei Feng
5435a8ed3b Add missing includes (#7501)
BUG=320668410
2024-01-17 11:04:42 -08: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
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
Mathias Agopian
cc13420e31 add missing includes
Should fix #3633
2021-03-15 22:45:31 -07:00
Philip Rideout
3226b20ece resgen: add --json option.
This option embeds a small JSON string inside the resgen blob that lists
all materials and their respective sizes. This is useful when analyzing
the footprint of the binary executable.
2020-12-06 14:36:13 -08:00
Romain Guy
14ce9e30b9 Make the build more quiet (#2457)
* Make the build more quiet

* Add mising include
2020-04-25 01:13:30 -07:00
Ben Doherty
b28e535540 Combine license file generation functions for MSVC compatability (#1684) 2019-09-24 12:45:38 -07:00
Philip Rideout
2a2974580c resgen: remove unused / incorrect constant. 2019-09-10 10:19:37 -07:00
Philip Rideout
8d1b630b24 resgen: repair wasm builds. 2019-09-10 08:02:35 -07:00
Philip Rideout
1235a66f83 resgen: avoid overwriting the header if nothing changed. 2019-09-10 08:02:35 -07:00
Philip Rideout
411e7f4511 resgen: use extern int instead of #define. 2019-09-10 08:02:35 -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
20680e8170 Improve resgen speed and avoid using static.
(1)
Generating the C file (only used for WebAssembly) causes slowness in the
build so this makes it into an option. Also, we were flushing too often,
which made it even slower.

(2)
Using "static" in a header was causing symbol duplication.
2018-11-29 17:21:27 -08:00
Philip Rideout
239317ee10 Use resgen for libshaders. 2018-11-29 07:37:56 -08:00
Philip Rideout
12754fd7eb Minor resgen improvements.
This adds a couple optional features:

1) Preserve file extensions when generating symbols.
   This is useful to distinguish foo.vs from foo.fs

2) Append null characters to data blobs.
   Useful when treating FOO_DATA as a C string.
2018-11-28 16:58:41 -08:00
Philip Rideout
30092dc12b Add style guidelines for strings.
This also adds the std:: qualifier to resgen (see also PR #356)
2018-11-27 09:05:57 -08:00
Philip Rideout
0807cfbaaa Fix Windows build. 2018-11-21 22:14:22 -08:00
Philip Rideout
e90b53fdce Introduce resgen tool for embedding binary blobs.
This tool can be used to replace inc files for built-in materials. The
inc files are unfriendly to IDE's and do not extend to non-material
resource types such as baked texture data.

The tool aggregates a sequence of binary blobs, each of which becomes a
"resource" whose id is the basename of the input file. It produces the
following set of files:

    resources.h ......... declares sizes and offsets for each resource
    resources.S ......... small assembly file with incbin directive
    resources.apple.S ... ditto but with different rodata name
    resources.bin ....... the aggregated binary blob
    resources.c ......... large xxd-style array (only for WASM)

We did an experiment to test the incbin directive on a variety of
platforms in PR #510.
2018-11-21 17:18:21 -08:00