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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions drivers/gles3/storage/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,19 +355,16 @@ bool Utilities::has_os_feature(const String &p_feature) const {
if (p_feature == "rgtc") {
return config->rgtc_supported;
}

if (p_feature == "s3tc") {
return config->s3tc_supported;
}

if (p_feature == "bptc") {
return config->bptc_supported;
}
if (p_feature == "astc") {
return config->astc_supported;
}

if (p_feature == "etc" || p_feature == "etc2") {
if (p_feature == "etc2") {
return config->etc2_supported;
}

Expand Down
1 change: 0 additions & 1 deletion editor/editor_property_name_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["dtls"] = "DTLS";
capitalize_string_remaps["eol"] = "EOL";
capitalize_string_remaps["erp"] = "ERP";
capitalize_string_remaps["etc"] = "ETC";
capitalize_string_remaps["etc2"] = "ETC2";
capitalize_string_remaps["fabrik"] = "FABRIK";
capitalize_string_remaps["fbx"] = "FBX";
Expand Down
4 changes: 0 additions & 4 deletions editor/export/editor_export_platform_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &
if (p_preset->get("texture_format/s3tc")) {
r_features->push_back("s3tc");
}
if (p_preset->get("texture_format/etc")) {
r_features->push_back("etc");
}
if (p_preset->get("texture_format/etc2")) {
r_features->push_back("etc2");
}
Expand All @@ -62,7 +59,6 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) c

r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/bptc"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false));
}

Expand Down
1 change: 0 additions & 1 deletion editor/project_settings_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ void ProjectSettingsEditor::_add_feature_overrides() {

presets.insert("bptc");
presets.insert("s3tc");
presets.insert("etc");
presets.insert("etc2");
presets.insert("editor");
presets.insert("template_debug");
Expand Down
4 changes: 2 additions & 2 deletions modules/basis_universal/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ static Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size
} else if (RS::get_singleton()->has_os_feature("s3tc")) {
format = basist::transcoder_texture_format::cTFBC1; // get this from renderer
imgfmt = Image::FORMAT_DXT1;
} else if (RS::get_singleton()->has_os_feature("etc")) {
clayjohn marked this conversation as resolved.
Show resolved Hide resolved
} else if (RS::get_singleton()->has_os_feature("etc2")) {
format = basist::transcoder_texture_format::cTFETC1; // get this from renderer
imgfmt = Image::FORMAT_ETC;
imgfmt = Image::FORMAT_ETC2_RGB8;
} else {
format = basist::transcoder_texture_format::cTFBGR565; // get this from renderer
imgfmt = Image::FORMAT_RGB565;
Expand Down
2 changes: 1 addition & 1 deletion modules/ktx/texture_loader_ktx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static Ref<Image> load_from_file_access(Ref<FileAccess> f, Error *r_error) {
ktxfmt = KTX_TTF_BC7_RGBA;
} else if (RS::get_singleton()->has_os_feature("s3tc")) {
ktxfmt = KTX_TTF_BC1_RGB;
} else if (RS::get_singleton()->has_os_feature("etc")) {
} else if (RS::get_singleton()->has_os_feature("etc2")) {
ktxfmt = KTX_TTF_ETC1_RGB;
Comment on lines +290 to 291
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.

} else {
ktxfmt = KTX_TTF_RGBA32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
<member name="texture_format/bptc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the BPTC format.
</member>
<member name="texture_format/etc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC format.
</member>
<member name="texture_format/etc2" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC2 format.
</member>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
<member name="texture_format/bptc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the BPTC format.
</member>
<member name="texture_format/etc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC format.
</member>
<member name="texture_format/etc2" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC2 format.
</member>
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/dummy/storage/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Utilities : public RendererUtilities {
virtual void set_debug_generate_wireframes(bool p_generate) override {}

virtual bool has_os_feature(const String &p_feature) const override {
return p_feature == "rgtc" || p_feature == "bptc" || p_feature == "s3tc" || p_feature == "etc" || p_feature == "etc2";
return p_feature == "rgtc" || p_feature == "bptc" || p_feature == "s3tc" || p_feature == "etc2";
}

virtual void update_memory_info() override {}
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/renderer_rd/storage_rd/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ bool Utilities::has_os_feature(const String &p_feature) const {
return true;
}

if ((p_feature == "etc" || p_feature == "etc2") && RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, RD::TEXTURE_USAGE_SAMPLING_BIT)) {
if (p_feature == "etc2" && RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, RD::TEXTURE_USAGE_SAMPLING_BIT)) {
return true;
}

Expand Down