godot/thirdparty/basis_universal/encoder/basisu_comp.cpp

// basisu_comp.cpp
// Copyright (C) 2019-2021 Binomial LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "basisu_comp.h"
#include "basisu_enc.h"
#include <unordered_set>
#include <atomic>

// basisu_transcoder.cpp is where basisu_miniz lives now, we just need the declarations here.
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#include "basisu_miniz.h"

#include "basisu_opencl.h"

#if !BASISD_SUPPORT_KTX2
#error BASISD_SUPPORT_KTX2 must be enabled (set to 1).
#endif

#if BASISD_SUPPORT_KTX2_ZSTD
#include <zstd.h>
#endif

// Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all)
#define BASISU_DISABLE_KTX2_ALIGNMENT_WORKAROUND

// Set to 1 to disable writing all KTX2 key values, triggering the validator bug.
#define BASISU_DISABLE_KTX2_KEY_VALUES

usingnamespacebuminiz;

#define BASISU_USE_STB_IMAGE_RESIZE_FOR_MIPMAP_GEN
#define DEBUG_CROP_TEXTURE_TO_64x64
#define DEBUG_RESIZE_TEXTURE
#define DEBUG_EXTRACT_SINGLE_BLOCK

namespace basisu
{
   basis_compressor::basis_compressor() :{}

   basis_compressor::~basis_compressor()
   {}

	bool basis_compressor::init(const basis_compressor_params &params)
	{}
		
	basis_compressor::error_code basis_compressor::process()
	{}

	basis_compressor::error_code basis_compressor::encode_slices_to_uastc()
	{}

	bool basis_compressor::generate_mipmaps(const image &img, basisu::vector<image> &mips, bool has_alpha)
	{}

	bool basis_compressor::read_source_images()
	{}

	// Do some basic validation for 2D arrays, cubemaps, video, and volumes.
	bool basis_compressor::validate_texture_type_constraints() 
	{}

	bool basis_compressor::extract_source_blocks()
	{}

	bool basis_compressor::process_frontend()
	{}

	bool basis_compressor::extract_frontend_texture_data()
	{}

	bool basis_compressor::process_backend()
	{}

	bool basis_compressor::create_basis_file_and_transcode()
	{}

	bool basis_compressor::write_output_files_and_compute_stats()
	{}
	
	// Make sure all the mip 0's have the same dimensions and number of mipmap levels, or we can't encode the KTX2 file.
	bool basis_compressor::validate_ktx2_constraints()
	{}

	static uint8_t g_ktx2_etc1s_nonalpha_dfd[44] =;
	static uint8_t g_ktx2_etc1s_alpha_dfd[60] =;
	static uint8_t g_ktx2_uastc_nonalpha_dfd[44] =;
	static uint8_t g_ktx2_uastc_alpha_dfd[44] =;
		
	void basis_compressor::get_dfd(uint8_vec &dfd, const basist::ktx2_header &header)
	{}

	bool basis_compressor::create_ktx2_file()
	{}

	bool basis_parallel_compress(
		uint32_t total_threads,
		const basisu::vector<basis_compressor_params>& params_vec,
		basisu::vector< parallel_results >& results_vec)
	{}

	void* basis_compress(
		const basisu::vector<image>& source_images,
		uint32_t flags_and_quality, float uastc_rdo_quality,
		size_t* pSize,
		image_stats* pStats)
	{}

	void* basis_compress(
		const uint8_t* pImageRGBA, uint32_t width, uint32_t height, uint32_t pitch_in_pixels,
		uint32_t flags_and_quality, float uastc_rdo_quality,
		size_t* pSize,
		image_stats* pStats)
	{}

	void basis_free_data(void* p)
	{}

	bool basis_benchmark_etc1s_opencl(bool* pOpenCL_failed)
	{}

} // namespace basisu