Commit Graph

28 Commits

Author SHA1 Message Date
Thaddeus Crews 9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
BlueCube3310 00f662c07f Improve etcpak image padding and clean up the code 2024-07-26 13:27:20 +02:00
BlueCube3310 0ed45629fd Support 64-bit image sizes for VRAM compression 2024-07-21 21:06:14 +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 8239aeec8e Image: Add static `is_format_compressed` function. 2024-02-28 19:42:06 +01:00
Rémi Verschelde 093cdd2188
EditorFileSystem: Add verbose print for file being (re)imported
Also print the time it took for each file.
2024-02-28 09:59:46 +01:00
BlueCube3310 becf5b1d23 [etcpak] Sync with upstream 2024-02-05 18:53:35 +01:00
Rémi Verschelde 44b92ec85f
Merge pull request #86313 from BlueCube3310/etc2-r-rg
Implement `ETC2_R` and `ETC2_RG` compression to `etcpak`
2024-01-29 13:16:34 +01:00
BlueCube3310 381d6348df Use ETC2 compression for grayscale images 2024-01-13 13:27:00 +01:00
BlueCube3310 50d33aac6c Implement ETC2_R and ETC2_RG compression to `etcpak` 2023-12-19 17:49:05 +01:00
BlueCube3310 5837e1fe3f Improve normal map VRAM Compression with RGTC 2023-12-06 15:28:18 +01: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
clayjohn f84c6df8d1 Use DXT1 when compressing PNGs with RGB format
This results in much smaller file sizes with the same quality
2023-04-27 10:54:25 -07:00
Juan Linietsky 28f51ba547 Refactor high quality texture import
* Only two texture import modes for low/high quality now:
  * S3TC/BPTC
  * ETC2/ASTC
* Makes sense given this is the general preferred and most compatible combination in most platforms.
* Removed lossy_quality from VRAM texture compression options. It was unused everywhere.
* Added a new "high_quality" option to texture import. When enabled, it uses BPTC/ASTC (BC7/ASTC4x4) instead of S3TC/ETC2 (DXT1-5/ETC2,ETCA).
* Changed MacOS export settings so required texture formats depend on the architecture selected.

This solves the following problems:

* Makes it simpler to import textures as high quality, without having to worry about the specific format used.
* As the editor can now run on platforms such as web, Mac OS with Apple Silicion and Android, it should no longer be assumed that S3TC/BPTC is available by default for it.
2023-01-30 15:53:23 +01:00
K. S. Ernest (iFire) Lee 696346f4cc
Add ASTC compression and decompression with Arm astcenc.
Co-authored-by: Gordon A Macpherson <gordon.a.macpherson@gmail.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-19 16:27:59 +01:00
rsjtdrjgfuzkfg a1a2c2c2ce etcpak: Fix ETCPAK_TYPE_ETC2_RA_AS_RG
This commit fixes texture compression via ETCPAK_TYPE_ETC2_RA_AS_RG,
switching to the right color channels and using the right compression
method. Textures imported with previous versions need to be re-imported
in order to render correctly.
2023-01-11 23:06:35 +01: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
Bastiaan Olij ebec23d8d8 ETCPAK expects BGRA data for ETC 2022-12-02 01:34:05 +11: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
Lyuma e8da21dc6b etcpak: Workaround multiple-of-4 requirement for 3D texture mipmaps. 2022-01-23 11:32:05 -08:00
Lyuma b1b20f5f91 Pad etcpak input to 4x4 blocks. Fixes #49981 2022-01-22 17:20:17 -08: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
Rémi Verschelde 3691cb0ca4
etcpak: Update to upstream commit 7c3cb6f (Jul 29, 2021)
Adds a new `useHeuristics` compression mode for ETC2.
Upstream defaults to enable it so we do the same.
2021-09-22 13:17:07 +02:00
Rémi Verschelde 0ab928e060
Import: Cleanup and optimize etcpak compression method
Avoid unnecessary allocation of temporary buffers for each mip, and creates
only one Image with the compressed data.
Also renames variable and reorders code for clarity.

Clarify that squish is now only used for decompression.

Documented which formats can be decompressed in Image.
2021-04-16 17:08:36 +02:00
Rémi Verschelde 638cfec853
etcpak: We only need the compression code, remove rest of etcpak app
We do our own image loading, threading, and memory management in Godot already,
so the only components we need from etcpak (at least as of now) are the
`Compress*` methods defined in `ProcessDxtc.cpp` and `ProcessRGB.cpp`.

So we don't need to compile or vendor the rest.
2021-04-14 16:50:02 +02:00
K. S. Ernest (iFire) Lee d840165a32
Add `etcpak` library for faster ETC/ETC2/S3TC imports.
- `etc` module was renamed to `etcpak` and modified to use the new library.
- PKM importer is removed in the process, it's obsolete.
- Old library `etc2comp` is removed.
- S3TC compression no longer done via `squish` (but decompression still is).
- Slight modifications to etcpak sources for MinGW compatibility,
  to fix LLVM `-Wc++11-narrowing` errors, and to allow using vendored or
  system libpng.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-04-13 00:12:12 +02:00