diff options
Diffstat (limited to 'modules/basis_universal')
-rw-r--r-- | modules/basis_universal/SCsub | 42 | ||||
-rw-r--r-- | modules/basis_universal/config.py | 1 | ||||
-rw-r--r-- | modules/basis_universal/register_types.cpp | 37 | ||||
-rw-r--r-- | modules/basis_universal/texture_basisu.cpp | 12 |
4 files changed, 48 insertions, 44 deletions
diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub index 63324e920b..dc7b176d24 100644 --- a/modules/basis_universal/SCsub +++ b/modules/basis_universal/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_basisu = env_modules.Clone() @@ -9,36 +9,38 @@ env_basisu = env_modules.Clone() # Not unbundled so far since not widespread as shared library thirdparty_dir = "#thirdparty/basis_universal/" tool_sources = [ - "basisu_astc_decomp.cpp", - "basisu_backend.cpp", - "basisu_basis_file.cpp", - "basisu_comp.cpp", - "basisu_enc.cpp", - "basisu_etc.cpp", - "basisu_frontend.cpp", - "basisu_global_selector_palette_helpers.cpp", - "basisu_gpu_texture.cpp", - "basisu_pvrtc1_4.cpp", - "basisu_resample_filters.cpp", - "basisu_resampler.cpp", - "basisu_ssim.cpp", - "lodepng.cpp", + "basisu_astc_decomp.cpp", + "basisu_backend.cpp", + "basisu_basis_file.cpp", + "basisu_comp.cpp", + "basisu_enc.cpp", + "basisu_etc.cpp", + "basisu_frontend.cpp", + "basisu_global_selector_palette_helpers.cpp", + "basisu_gpu_texture.cpp", + "basisu_pvrtc1_4.cpp", + "basisu_resample_filters.cpp", + "basisu_resampler.cpp", + "basisu_ssim.cpp", + "lodepng.cpp", ] tool_sources = [thirdparty_dir + file for file in tool_sources] transcoder_sources = [thirdparty_dir + "transcoder/basisu_transcoder.cpp"] # Treat Basis headers as system headers to avoid raising warnings. Not supported on MSVC. if not env.msvc: - env_basisu.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path, '-isystem', Dir(thirdparty_dir + "transcoder").path]) + env_basisu.Append( + CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir(thirdparty_dir + "transcoder").path] + ) else: env_basisu.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "transcoder"]) -if env['target'] == "debug": - env_basisu.Append(CPPFLAGS=["-DBASISU_DEVEL_MESSAGES=1", "-DBASISD_ENABLE_DEBUG_FLAGS=1"]) +if env["target"] == "debug": + env_basisu.Append(CPPFLAGS=["-DBASISU_DEVEL_MESSAGES=1", "-DBASISD_ENABLE_DEBUG_FLAGS=1"]) env_thirdparty = env_basisu.Clone() env_thirdparty.disable_warnings() -if env['tools']: +if env["tools"]: env_thirdparty.add_source_files(env.modules_sources, tool_sources) env_thirdparty.add_source_files(env.modules_sources, transcoder_sources) diff --git a/modules/basis_universal/config.py b/modules/basis_universal/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/basis_universal/config.py +++ b/modules/basis_universal/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index 062b5b59f8..f31c889a6d 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -31,7 +31,7 @@ #include "register_types.h" #include "core/os/os.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #include "texture_basisu.h" #ifdef TOOLS_ENABLED @@ -98,7 +98,7 @@ static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image:: params.m_mip_gen = false; //sorry, please some day support provided mipmaps. params.m_source_images.push_back(buimg); - BasisDecompressFormat decompress_format; + BasisDecompressFormat decompress_format = BASIS_DECOMPRESS_RG; params.m_check_for_alpha = false; switch (p_channels) { @@ -158,33 +158,34 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { const uint8_t *ptr = r; int size = p_buffer.size(); - basist::transcoder_texture_format format; - Image::Format imgfmt; + basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats; + Image::Format imgfmt = Image::FORMAT_MAX; switch (*(uint32_t *)(ptr)) { case BASIS_DECOMPRESS_RG: { - if (VS::get_singleton()->has_os_feature("rgtc")) { + if (RS::get_singleton()->has_os_feature("rgtc")) { format = basist::transcoder_texture_format::cTFBC5; // get this from renderer imgfmt = Image::FORMAT_RGTC_RG; - } else if (VS::get_singleton()->has_os_feature("etc2")) { + } else if (RS::get_singleton()->has_os_feature("etc2")) { //unfortunately, basis universal does not support // ERR_FAIL_V(image); //unimplemented here //format = basist::transcoder_texture_format::cTFETC1; // get this from renderer //imgfmt = Image::FORMAT_RGTC_RG; } else { - //decompress + // FIXME: There wasn't anything here, but then imgformat is used uninitialized. + ERR_FAIL_V(image); } } break; case BASIS_DECOMPRESS_RGB: { - if (VS::get_singleton()->has_os_feature("bptc")) { + if (RS::get_singleton()->has_os_feature("bptc")) { format = basist::transcoder_texture_format::cTFBC7_M6_OPAQUE_ONLY; // get this from renderer imgfmt = Image::FORMAT_BPTC_RGBA; - } else if (VS::get_singleton()->has_os_feature("s3tc")) { + } 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 (VS::get_singleton()->has_os_feature("etc")) { + } else if (RS::get_singleton()->has_os_feature("etc")) { format = basist::transcoder_texture_format::cTFETC1; // get this from renderer imgfmt = Image::FORMAT_ETC; @@ -195,13 +196,13 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { } break; case BASIS_DECOMPRESS_RGBA: { - if (VS::get_singleton()->has_os_feature("bptc")) { + if (RS::get_singleton()->has_os_feature("bptc")) { format = basist::transcoder_texture_format::cTFBC7_M5; // get this from renderer imgfmt = Image::FORMAT_BPTC_RGBA; - } else if (VS::get_singleton()->has_os_feature("s3tc")) { + } else if (RS::get_singleton()->has_os_feature("s3tc")) { format = basist::transcoder_texture_format::cTFBC3; // get this from renderer imgfmt = Image::FORMAT_DXT5; - } else if (VS::get_singleton()->has_os_feature("etc2")) { + } else if (RS::get_singleton()->has_os_feature("etc2")) { format = basist::transcoder_texture_format::cTFETC2; // get this from renderer imgfmt = Image::FORMAT_ETC2_RGBA8; } else { @@ -211,10 +212,10 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { } } break; case BASIS_DECOMPRESS_RG_AS_RA: { - if (VS::get_singleton()->has_os_feature("s3tc")) { + if (RS::get_singleton()->has_os_feature("s3tc")) { format = basist::transcoder_texture_format::cTFBC3; // get this from renderer imgfmt = Image::FORMAT_DXT5_RA_AS_RG; - } else if (VS::get_singleton()->has_os_feature("etc2")) { + } else if (RS::get_singleton()->has_os_feature("etc2")) { format = basist::transcoder_texture_format::cTFETC2; // get this from renderer imgfmt = Image::FORMAT_ETC2_RGBA8; } else { @@ -228,7 +229,7 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { ptr += 4; size -= 4; - basist::basisu_transcoder tr(NULL); + basist::basisu_transcoder tr(nullptr); ERR_FAIL_COND_V(!tr.validate_header(ptr, size), image); @@ -281,7 +282,7 @@ void unregister_basis_universal_types() { #ifdef TOOLS_ENABLED delete sel_codebook; - Image::basis_universal_packer = NULL; + Image::basis_universal_packer = nullptr; #endif - Image::basis_universal_unpacker = NULL; + Image::basis_universal_unpacker = nullptr; } diff --git a/modules/basis_universal/texture_basisu.cpp b/modules/basis_universal/texture_basisu.cpp index 12f3241c98..2ed0340927 100644 --- a/modules/basis_universal/texture_basisu.cpp +++ b/modules/basis_universal/texture_basisu.cpp @@ -72,7 +72,7 @@ bool TextureBasisU::has_alpha() const { void TextureBasisU::set_flags(uint32_t p_flags) { flags = p_flags; - VisualServer::get_singleton()->texture_set_flags(texture, p_flags); + RenderingServer::get_singleton()->texture_set_flags(texture, p_flags); }; uint32_t TextureBasisU::get_flags() const { @@ -105,7 +105,7 @@ void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) { imgfmt = Image::FORMAT_ETC2_RGBA8; }; - basist::basisu_transcoder tr(NULL); + basist::basisu_transcoder tr(nullptr); ERR_FAIL_COND(!tr.validate_header(ptr, size)); @@ -144,8 +144,8 @@ void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) { img.instance(); img->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata); - VisualServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), VS::TEXTURE_TYPE_2D, flags); - VisualServer::get_singleton()->texture_set_data(texture, img); + RenderingServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), RS::TEXTURE_TYPE_2D, flags); + RenderingServer::get_singleton()->texture_set_data(texture, img); }; Error TextureBasisU::import(const Ref<Image>& p_img) { @@ -221,13 +221,13 @@ Vector<uint8_t> TextureBasisU::get_basisu_data() const { TextureBasisU::TextureBasisU() { flags = FLAGS_DEFAULT; - texture = VisualServer::get_singleton()->texture_create(); + texture = RenderingServer::get_singleton()->texture_create(); }; TextureBasisU::~TextureBasisU() { - VisualServer::get_singleton()->free(texture); + RenderingServer::get_singleton()->free(texture); }; #endif |