Path: blob/master/libmupen64plus/mupen64plus-video-glide64mk2/src/GlideHQ/tc-1.1+/wrapper.c
2 views
/*1* Texture compression2* Version: 1.03*4* Copyright (C) 2004 Daniel Borca All Rights Reserved.5*6* this is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2, or (at your option)9* any later version.10*11* this is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with GNU Make; see the file COPYING. If not, write to18* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.19*/202122#include <assert.h>2324#include "types.h"25#include "internal.h"26#include "dxtn.h"272829#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F030#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F131#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F232#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3333435TAPI void TAPIENTRY36fetch_2d_texel_rgb_dxt1 (int texImage_RowStride,37const byte *texImage_Data,38int i, int j,39byte *texel)40{41dxt1_rgb_decode_1(texImage_Data, texImage_RowStride, i, j, texel);42}434445TAPI void TAPIENTRY46fetch_2d_texel_rgba_dxt1 (int texImage_RowStride,47const byte *texImage_Data,48int i, int j,49byte *texel)50{51dxt1_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);52}535455TAPI void TAPIENTRY56fetch_2d_texel_rgba_dxt3 (int texImage_RowStride,57const byte *texImage_Data,58int i, int j,59byte *texel)60{61dxt3_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);62}636465TAPI void TAPIENTRY66fetch_2d_texel_rgba_dxt5 (int texImage_RowStride,67const byte *texImage_Data,68int i, int j,69byte *texel)70{71dxt5_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);72}737475TAPI void TAPIENTRY76tx_compress_dxtn (int srccomps, int width, int height,77const byte *source, int destformat, byte *dest,78int destRowStride)79{80int srcRowStride = width * srccomps;8182switch (destformat) {83case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:84dxt1_rgb_encode(width, height, srccomps,85source, srcRowStride,86dest, destRowStride);87break;88case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:89dxt1_rgba_encode(width, height, srccomps,90source, srcRowStride,91dest, destRowStride);92break;93case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:94dxt3_rgba_encode(width, height, srccomps,95source, srcRowStride,96dest, destRowStride);97break;98case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:99dxt5_rgba_encode(width, height, srccomps,100source, srcRowStride,101dest, destRowStride);102break;103default:104assert(0);105}106}107108109