124 return (31-__builtin_clz(width < height ? width : height)) - 3;
135 return size >> (2*level);
270 if (!level)
return data;
351 int iLodBias = (int)(lodBias*0x100);
352 if (iLodBias > 0xFFF)
354 else if (iLodBias < -0x1000)
356 tex->lodBias = iLodBias & 0x1FFF;
#define GPU_TEXTURE_MAG_FILTER(v)
#define GPU_TEXTURE_MIP_FILTER(v)
#define GPU_TEXTURE_WRAP_S(v)
#define GPU_TEXTURE_WRAP_T(v)
#define GPU_TEXTURE_MIN_FILTER(v)
Cubemap texture data.
Definition: texture.h:10
Parameters for C3D_TexInitWithParams()
Definition: texture.h:52
GPU_TEXTURE_MODE_PARAM type
Texture type.
Definition: texture.h:57
u16 height
Height of texture in pixels. (must be a power of 2)
Definition: texture.h:54
u16 width
Width of texture in pixels. (must be a power of 2)
Definition: texture.h:53
u8 maxLevel
Maximum mipmap level.
Definition: texture.h:55
bool onVram
Specifies whether to allocate texture data in Vram or linearMemory.
Definition: texture.h:58
GPU_TEXCOLOR format
GPU texture format.
Definition: texture.h:56
Texture data.
Definition: texture.h:16
static bool C3D_TexInit(C3D_Tex *tex, u16 width, u16 height, GPU_TEXCOLOR format)
Initializes standard 2D texture.
Definition: texture.h:173
static bool C3D_TexInitShadow(C3D_Tex *tex, u16 width, u16 height)
Initializes 2D shadowmap texture.
Definition: texture.h:230
static bool C3D_TexInitMipmap(C3D_Tex *tex, u16 width, u16 height, GPU_TEXCOLOR format)
Initializes standard 2D texture with mipmap Maximum miplevel is calculated using C3D_TexCalcMaxLevel(...
Definition: texture.h:188
void C3D_TexFlush(C3D_Tex *tex)
Flushes texture data from cache into memory.
void C3D_TexBind(int unitId, C3D_Tex *tex)
Binds C3D_Tex to texture unit.
static int C3D_TexCalcMaxLevel(u32 width, u32 height)
Calculates maximum mipmap level for given texture size.
Definition: texture.h:122
static void C3D_TexUpload(C3D_Tex *tex, const void *data)
Copies raw texture data into standard 2D texture.
Definition: texture.h:304
static bool C3D_TexInitVRAM(C3D_Tex *tex, u16 width, u16 height, GPU_TEXCOLOR format)
Initializes 2D texture in VRAM.
Definition: texture.h:217
static void * C3D_TexCubeGetImagePtr(C3D_Tex *tex, GPU_TEXFACE face, int level, u32 *size)
Gets pointer to cubemap texture image.
Definition: texture.h:294
static GPU_TEXTURE_MODE_PARAM C3D_TexGetType(C3D_Tex *tex)
Gets type of texture.
Definition: texture.h:254
static void * C3D_TexGetImagePtr(C3D_Tex *tex, void *data, int level, u32 *size)
Gets pointer to texture image.
Definition: texture.h:267
static bool C3D_TexInitCube(C3D_Tex *tex, C3D_TexCube *cube, u16 width, u16 height, GPU_TEXCOLOR format)
Initializes cubemap texture.
Definition: texture.h:203
static void C3D_TexSetFilter(C3D_Tex *tex, GPU_TEXTURE_FILTER_PARAM magFilter, GPU_TEXTURE_FILTER_PARAM minFilter)
Configures texture magnification and minification filters.
Definition: texture.h:315
static void C3D_TexSetLodBias(C3D_Tex *tex, float lodBias)
Configures texture level of detail bias used to select the correct mipmap during sampling.
Definition: texture.h:349
void C3D_TexGenerateMipmap(C3D_Tex *tex, GPU_TEXFACE face)
Generates mipmaps for C3D_Tex using previously specified max level The max level should have been spe...
void C3D_TexLoadImage(C3D_Tex *tex, const void *data, GPU_TEXFACE face, int level)
Copies raw texture data into C3D_Tex.
static void C3D_TexSetFilterMipmap(C3D_Tex *tex, GPU_TEXTURE_FILTER_PARAM filter)
Configures texture mipmap minification filters.
Definition: texture.h:326
void C3D_TexShadowParams(bool perspective, float bias)
Configues texunit0 shadow texture properties.
static u32 C3D_TexCalcTotalSize(u32 size, int maxLevel)
Calculates total size of mipmap texture data.
Definition: texture.h:144
void C3D_TexDelete(C3D_Tex *tex)
Deletes texture data.
static bool C3D_TexInitShadowCube(C3D_Tex *tex, C3D_TexCube *cube, u16 width, u16 height)
Initializes shadowmap cubemap texture.
Definition: texture.h:244
static void C3D_TexSetWrap(C3D_Tex *tex, GPU_TEXTURE_WRAP_PARAM wrapS, GPU_TEXTURE_WRAP_PARAM wrapT)
Configures texture wrapping options.
Definition: texture.h:338
static u32 C3D_TexCalcLevelSize(u32 size, int level)
Calculates size of mipmap level.
Definition: texture.h:133
bool C3D_TexInitWithParams(C3D_Tex *tex, C3D_TexCube *cube, C3D_TexInitParams p)
Initializes texture with specified parameters.
static void * C3D_Tex2DGetImagePtr(C3D_Tex *tex, int level, u32 *size)
Gets pointer to 2D texture image.
Definition: texture.h:281