Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export: Unify settings for PC texture formats, removed obsoleted ETC feature #88325

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented Feb 14, 2024

S3TC and BPTC should always be used together, and likewise for ETC2 and ASTC.

Also removes obsolete ETC support code since we removed that format.


I didn't add compatibility code yet, it would be a bit convoluted in EditorExportPreset::_set which currently has its own logic for some visibility update. Could be done but I'm not sure it's worth the bother, when handling this minor compat breakage just requires ensuring that the proper formats are toggled in the settings. The default behavior for the new options is also to export S3TC/BPTC, which is the most likely combinations that users need.

Haven't tested much yet.

For a potential 4.2.x cherry-pick we might consider going with the approach in #84913 to be more conservative.

@@ -237,9 +239,8 @@ void EditorExportPlatformPC::set_logo(const Ref<Texture2D> &p_logo) {
}

void EditorExportPlatformPC::get_platform_features(List<String> *r_features) const {
r_features->push_back("pc"); //all pcs support "pc"
r_features->push_back("s3tc"); //all pcs support "s3tc" compression
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this, which is redundant with the above logic, and also wrong if users for some reason decide to export ETC2/ASTC and not S3TC/BPTC.

akien-mga and others added 2 commits February 14, 2024 17:16
S3TC and BPTC should always be used together, and likewise for ETC2 and ASTC.
Comment on lines +290 to 291
} else if (RS::get_singleton()->has_os_feature("etc2")) {
ktxfmt = KTX_TTF_ETC1_RGB;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept KTX_TTF_ETC1_RGB here as we seem to handle only RGB here.
The options are:

        // ETC1-2
        KTX_TTF_ETC1_RGB = 0,
            /*!< Opaque only. Returns RGB or alpha data, if
                 KTX_TF_TRANSCODE_ALPHA_DATA_TO_OPAQUE_FORMATS flag is
                 specified. */
        KTX_TTF_ETC2_RGBA = 1,
            /*!< Opaque+alpha. EAC_A8 block followed by an ETC1 block. The
                 alpha channel will be opaque for textures without an alpha
                 channel. */

        // Values for automatic selection of RGB or RGBA depending if alpha
        // present.
        KTX_TTF_ETC = 22,
            /*!< Automatically selects @c KTX_TTF_ETC1_RGB or
                 @c KTX_TTF_ETC2_RGBA according to presence of alpha. */

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The color data encoding is ETC1 for all of them anyway, so there should not be any quality difference.

@akien-mga akien-mga changed the title Export: Unify settings for PC texture formats Export: Unify settings for PC texture formats, removed obsoleted ETC feature Feb 14, 2024
@fire
Copy link
Member

fire commented Feb 14, 2024

I took an initial look at this, but we probably need to try the pr on all the devices on platforms we support like:

  • Web (Windows, Mac, iOS, Android)
  • Windows (amd64)
  • Linux (amd64)
  • Mac (Apple Silicon)
  • ios (arm64)
  • android (arm64)

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@akien-mga akien-mga merged commit 59643bd into godotengine:master Feb 16, 2024
16 checks passed
@akien-mga akien-mga deleted the texture-formats branch February 16, 2024 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants