Commit Graph

68 Commits

Author SHA1 Message Date
Yevhen Babiichuk (DustDFG)
af6d260c17 Don't include core/io/image.h in core/os/os.h
`core/os/os.h` doesn't use `core/io/image.h`. It just brings
transitive dependencies. Lots of dependencies because `core/os/os.h`
is transitively included in almost every file of godot

Also added `core/io/image.h` into files^1 where `Ref<Image>` and `core/os/os.h`
were used to prevent obscure errors involving `Ref<Image>`

^1 except those which include `core/io/image_loader.h` or `core/io/image.h` by
corresponding .h file with the same name

Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-10-18 19:04:19 +03:00
BlueCube3310
200ed0971a BasisU: Update to 1.50.0 and add HDR support 2024-10-12 18:02:44 +02:00
Hugo Locurcio
c1dc59f713
Disable unused Basis Universal features to reduce binary size 2024-09-29 02:29:27 +02:00
Thaddeus Crews
9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
BlueCube3310
337d80d8f5 BasisUniversal: Use RGTC compression when available 2024-09-10 12:06:00 +02:00
BlueCube3310
0ed45629fd Support 64-bit image sizes for VRAM compression 2024-07-21 21:06:14 +02:00
Hugo Locurcio
0445ccf428
Fix Image CowData crash when baking large lightmaps
This switches to 64-bit integers in select locations of the Image
class, so that image resolutions of 16384×16384 (used by
lightmap texture arrays) can be used properly. Values that are larger
should also work.

VRAM compression is also supported, although most VRAM-compressed
formats are limited to individual slices of 16384×16384. WebP
is limited to 16383×16383 due to format limitations.
2024-07-19 16:04:30 +02:00
Hugo Locurcio
ec97372f04
Make Basis Universal import quiet unless engine is in verbose mode
This makes Basis Universal stdout match other compression modes.
2024-06-22 00:34:53 +02:00
Rémi Verschelde
28a18cf1b8
Merge pull request #88763 from BlueCube3310/image-is-compressed-static
Image: Add static `is_format_compressed` function.
2024-05-02 14:01:18 +02:00
BlueCube3310
c71490043a Fix BasisU compression on images with resolutions not divisible by 4. 2024-05-02 12:15:02 +02:00
BlueCube3310
8239aeec8e Image: Add static is_format_compressed function. 2024-02-28 19:42:06 +01:00
BlueCube3310
0c596df0e0 BasisUniversal: Fix texture decompression 2024-02-22 19:11:17 +01:00
Rémi Verschelde
c3de771292
Merge pull request #88485 from BlueCube3310/basisu-astc-v2
Add ASTC support to BasisUniversal
2024-02-22 11:23:11 +01:00
Rémi Verschelde
b167113b1c
Merge pull request #88508 from akien-mga/basisu_unbundled_jpgd
basis_universal: Unbundle jpgd to fix symbol conflict, use our newer copy with SSE2 support
2024-02-20 10:30:59 +01:00
BlueCube3310
0afee63712 Add ASTC support to BasisUniversal 2024-02-19 17:32:31 +01:00
BlueCube3310
a1997d13e4 Clean up and optimize BasisUniversal 2024-02-19 12:39:06 +01:00
BlueCube3310
bf919eafa7 Extract BasisUniversal code into its own files 2024-02-19 10:56:02 +01:00
Rémi Verschelde
48ed0474e2
basis_universal: Unbundle jpgd, use our newer copy 2024-02-18 18:55:40 +01:00
Rémi Verschelde
e457f41f9b
Remove code relative to obsoleted ETC texture format
Co-authored-by: BlueCube3310 <53150244+BlueCube3310@users.noreply.github.com>
2024-02-14 17:16:41 +01:00
BlueCube3310
51ad937532 Fix BasisUniversal ETC RA_AS_RG transcoding 2024-01-07 12:53:01 +01:00
A Thousand Ships
517e9f8aef [Modules] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-26 16:44:52 +02:00
cow-neaz
56cfde3a5c Fix Basic Universal compressing with normal maps. 2023-06-16 11:20:16 -07:00
Rémi Verschelde
25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
Lyuma
0addf38047 basisu: Loop over the last mipmap lod 2023-02-26 16:01:54 -08:00
K. S. Ernest (iFire) Lee
add503e71d Fix basisu mipmaps
Previously basisu was storing mip maps as an array of basisu in the internal format for Texture. The new work makes sense and it generates smaller files with one image.

This pull request fixes the basisu decompression and keep the approach of 1 image. If we need to change the format in 4.x, we can still support the old format with some limitations too. Basisu from gltfpack can only output with mipmaps.

The single image will not work for StreamedTexture. We should support both approaches for CompressedTexture we use one, and for StreamedTexture we use another.

Additional error checking for hdr images and for nullptr.
2023-02-25 13:48:51 -08:00
Rémi Verschelde
e2fc0acd36
Fix includes of thirdparty libs which can be unbundled on Linux
Changes `builtin_icu` and `builtin_recast` to match the folder names in
`thirdparty`.
2023-02-16 15:52:13 +01:00
K. S. Ernest (iFire) Lee
39922d7167 Handle gltf binary
[ Ignore and Warn | Extract Textures (default) | Optimize Loading Embedded as Basisu ]

Enable compressed mip maps from Basis Universal for faster compressions.

Increase the quality of Basis to avoid corruption.

To keep compatibility use the first mip of the previous internal Godot format.

Because texture names may have invalid filename characters, adds String::validate_filename to sanitize filenames for import pipeline use.
2023-01-27 02:02:02 -08:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Hirotoshi Yoshitaka
d144e278ac Fix Basis Universal format texture rendering failure
Fix "failed! on level 0" error message on exported projects with Basis Universal textures.
2022-12-21 17:29:38 +09:00
kobewi
072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
Rémi Verschelde
39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
reduz
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
reduz
45f74ceb85 Add PortableCompressedTexture
* Resource that allows saving textures embedded in scenes or standalone.
* Supports only formats that are portable: Lossy, Lossles or BasisUniversal

This is something I wanted to add for a long time. I made it now because @fire
requires it for importing GLTF2 files with embedded textures, but also this
will allow saving Godot scenes as standalone binary files that will run
in all platforms (because textures will load everywhere).

This is ideal when you want to distribute individual standalone assets online
in games that can be built from Godot scenes.
2022-03-30 10:39:41 +02:00
Markus Sauermann
759d04e28e basisu_uastc_enc.cpp was included twice in encoder_sources 2022-03-28 19:34:03 +02:00
K. S. Ernest (iFire) Lee
3529141b4b Update basis universal to version 1.16.3.
Enable basis universal uastc internal storage instead of etc1s for better quality.
2022-03-24 22:41:23 -07:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Hugo Locurcio
ce97ddbcb1
Rename GLES2 driver to OpenGL to prepare for the upgrade to GLES3
- Use lowercase driver names for the `--rendering-driver`
  command line argument.
2021-10-30 02:05:49 +02:00
reduz
5ad4f26659 Implement the ability to disable classes
* This PR adds the ability to disable classes when building.
* For now it's only possible to do this via command like:
  `scons disable_classes=RayCast2D,Area3D`
* Eventually, a proper UI will be implemented to create a build config file to do this at large scale, as well as detect what is used in the project.
2021-07-13 09:25:14 -03:00
Lightning_A
e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde
2d133177e9
basis_universal: Update to upstream commit from Apr 16, 2021
BinomialLLC/basis_universal@ba1c3e40f1.
2021-05-07 17:26:11 +02:00
Rafał Mikrut
f7209b459b Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
Rémi Verschelde
b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal
b4a190e0bc Consistently use normal_map 2020-12-29 08:04:19 +00:00
Rémi Verschelde
c7b53c03ae
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.
2020-12-18 10:29:34 +01:00
Aaron Franke
02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Marcel Admiraal
5a376cb061 Fix header guards in modules:
- Add missing header guards to various modules' register_types.h
- Add header guard to basis_universal/texture_basisu.h.
- Ensure header guard encloses entire header in
  webrtc/webrtc_data_channel_js.h.
2020-09-06 16:13:59 +01:00
Rémi Verschelde
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00