Commit Graph

96 Commits

Author SHA1 Message Date
Rémi Verschelde 4b8946102b
Merge pull request #91535 from BlueCube3310/betsy-bc6h
Add Betsy to speed up BC6 compression
2024-08-21 06:38:03 +02:00
Rémi Verschelde f4037d6f6c
Merge pull request #92496 from clayjohn/HDR-2D-sRGB
Ensure MovieWriter output is in gamma space when using HDR 2D
2024-08-19 12:08:40 +02:00
BlueCube3310 394ea653aa Add Betsy to speed up BC6 compression 2024-08-18 11:14:05 +02:00
Rémi Verschelde eb684cccdc
Merge pull request #92291 from BlueCube3310/image-convert-optimized
Optimize image conversion for half and float formats.
2024-08-16 10:33:32 +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
bruvzg e651421905
[TextServer, GDExtension] Fix building text servers as GDExtension, expose new/changed low-level methods to GDExtension API. 2024-06-12 19:30:19 +03:00
clayjohn 3b9d074fd7 Ensure MovieWriter output is in gamma space when using HDR 2D 2024-05-28 15:30:13 -07:00
BlueCube3310 d260a2ba74 Optimize half and float image conversion 2024-05-24 11:01:20 +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
Bo Thompson 75d65195ae
Remove a redundant `MAX` comparison within a loop in `compute_image_metrics` 2024-03-28 22:23:15 +01:00
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
BlueCube3310 8239aeec8e Image: Add static `is_format_compressed` function. 2024-02-28 19:42:06 +01:00
Rémi Verschelde eac054f1cc
Merge pull request #87971 from bruvzg/font_no_image_dup
[TextServer / Font] Do not duplicate images to prevent unnecessary embedding.
2024-02-15 17:35:36 +01:00
Rémi Verschelde b457a30311
Merge pull request #87628 from YuriSizov/assets-bigger-better-errors
Improve error reporting in the asset library and in related types
2024-02-09 18:09:16 +01:00
A Thousand Ships 684752e75b
Replace error checks against `size` with `is_empty` 2024-02-09 12:50:15 +01:00
bruvzg 19f1d5afa9
[TextServer / Font] Do not duplicate images to prevent unnecessary embedding. 2024-02-05 10:38:32 +02:00
Yuri Sizov 815038962f Improve error reporting in the asset library and in related types
This also makes errors related to asset image loading
verbose-only, because, frankly, users can't do much about
those errors. Spamming them with error messages
about some assets on the frontend being broken
is pointless.
2024-01-26 20:33:22 +01:00
nklbdev 47d991678d Fix lossless formats in PortableCompressedTexture2D
Update scene/resources/portable_compressed_texture.cpp

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-01-05 00:11:01 +05:00
rsburke4 dec2269bca Added error to catch conversion on invalid image 2023-12-10 15:06:22 -05:00
K. S. Ernest (iFire) Lee 9877fa5058 Fix uninitialized variable in Image::fix_alpha_edges()
`core\io\image.cpp:3776:33: error: 'closest_color[0]' may be used uninitialized [-Werror=maybe-uninitialized]`
2023-10-29 22:59:03 -07:00
Hein-Pieter van Braam b5705958e6 Fix import crash
I was trying to import a solid colored metal/roughness texture that
worked in Godot 4.1.1 but failed to load on master. I eventually tracked
it down to this: to_x and to_y can be 0, which then leads them to be -1
later, which then causes ofs to overflow.

Some of these cases were hidden because of the use of Vector so we were
just happily scribbling in ram elsewhere.

Switched to LocalVector as it made debugging a bit easier.
2023-09-26 23:50:50 +02:00
bitsawer 16c3a19d91 Expose and document Image.get_mipmap_count() 2023-09-19 14:34:59 +03:00
A Thousand Ships 893f889d74 [Core] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-11 19:45:49 +02:00
clayjohn 0045dc204c Revert "Implement loading DDS textures at run-time"
This reverts commit 34ab1c8a36.
2023-08-29 14:25:16 +02:00
acazuc a00cf02241 Add support for KTX & KTX2 image format
Add support glTF KHR_texture_basisu extension
2023-08-19 10:27:29 +02:00
Marcin Nowak 34ab1c8a36 Implement loading DDS textures at run-time 2023-07-31 21:31:26 +02:00
Yuri Sizov e88934cb74 Merge pull request #74238 from bitsawer/fix_image_convert
Fix `Image.convert()` overwriting custom mipmaps
2023-07-12 17:15:39 +02:00
Felipe Augusto Marques 26eb3db234 Added Image's `load_svg_from_(buffer|string)`
No core dependency to the svg module.
2023-06-23 00:43:43 -03:00
Kory Postma c8cac39446 Grayscale fix for Image::premultiply_alpha() and Image::convert(FORMAT_L8) while using REC.709, with added test case 2023-05-27 18:01:44 -05:00
Ninni Pipping cf64e2fa47 Expose more compression formats in Image and fix compress check
Check for compressing ASTC checked if the function for BPTC was present
2023-04-13 09:39:03 +02:00
bitsawer 5a9d7fd8a6 Fix Image.convert() overwriting custom mipmaps 2023-03-02 16:46:06 +02: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
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
stmSi 96b0fbb756 Fix crashed when compressing empty image data. 2022-12-21 16:39:35 +06:30
Rémi Verschelde f318d60e06
Merge pull request #65376 from reduz/astc-support
Implement basic ASTC support
2022-12-20 12:44:30 +01:00
Juan Linietsky 71d21c7ccb Implement basic ASTC support
Implements basic ASTC support:
* Only 4x4 and 8x8 block sizes.
* Other block sizes are too complex to handle for Godot image compression handling. May be implemented sometime in the future.

The need for ASTC is mostly for the following use cases:
* Implement a high quality compression option for textures on mobile and M1 Apple hardware.
* For this, the 4x4 is sufficient, since it uses the same size as BPTC.

ASTC supports a lot of block sizes, but the benefit of supporting most of them is slim, while the implementation complexity in Godot is very high.
Supporting only 4x4 (and 8x8) solves the real problem, which is lack of a BPTC alternative on hardware where it's missing.

Note: This does not yet support encoding on import, an ASTC encoder will need to be added.
2022-12-20 11:26:30 +01:00
Bastiaan Olij ebec23d8d8 ETCPAK expects BGRA data for ETC 2022-12-02 01:34:05 +11:00
Rémi Verschelde 65a45eb7e3
Merge pull request #64284 from kleonc/image-rotate90-in-place
`Image` Fix `rotate_90`/`rotate_180` methods
2022-11-22 21:18:58 +01:00
Rémi Verschelde 9ec7aadc06
Merge pull request #66017 from Mickeon/rename-image-copy-rect
Rename Image's `get_rect` to `get_region`
2022-11-02 22:36:57 +01:00
Micky ebf86c96e9 Rename Image's `get_rect` to `get_region`
Also renames its parameter to from "rect" to "region".
2022-11-01 23:35:48 +01:00
dzil123 1fa8b3dd42 Fix Image::bump_map_to_normal_map incorrectly keeping mipmap flag 2022-11-01 03:54:04 -07:00
Yuri Rubinsky adec51cde8 Fix crash when calling `fill` method on an empty `Image` 2022-10-24 11:28:10 +03:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
bruvzg ea1848ce0a
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings. 2022-09-29 10:38:21 +03:00
Aaron Franke 995b9f94e8
Replace Rect2(i) has_no_area with has_area 2022-09-04 23:03:36 -05:00
Johan Aires Rastén b7e2d45233 Replace Vector2(i) with Size2(i) for methods returning a size 2022-09-01 20:04:17 +02:00
kleonc 100b83971f `Image` Fix `rotate_90`/`rotate_180` methods 2022-08-11 18:45:50 +02:00
Rémi Verschelde c8cdc10902
Merge pull request #62861 from samdze/image-size-vector2i
Make Image.get_size() return a Vector2i instead of a Vector2
2022-08-08 12:55:07 +02:00