mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-08-03 18:57:27 -04:00
N64: WIP texture filtering
This commit is contained in:
parent
a52fdf90e7
commit
19a4cb61ea
@ -110,6 +110,11 @@ static void gpuSetTexSize(uint16_t width, uint16_t height)
|
||||
gpu_set_word(offsetof(gpu_state, tex_size[0]), (width << 16) | height);
|
||||
}
|
||||
|
||||
static void gpuSetTexOffset(uint16_t width, uint16_t height)
|
||||
{
|
||||
gpu_set_word(offsetof(gpu_state, tex_offset[0]), (width << 16) | height);
|
||||
}
|
||||
|
||||
|
||||
static inline void write_shorts(rspq_write_t *w, const uint16_t *s, uint32_t count)
|
||||
{
|
||||
|
@ -225,8 +225,26 @@ void Gfx_DeleteTexture(GfxResourceID* texId) {
|
||||
*texId = NULL;
|
||||
}
|
||||
|
||||
void Gfx_EnableMipmaps(void) { }
|
||||
void Gfx_DisableMipmaps(void) { }
|
||||
static cc_bool bilinear_mode;
|
||||
static void SetFilterMode(cc_bool bilinear) {
|
||||
if (bilinear_mode == bilinear) return;
|
||||
bilinear_mode = bilinear;
|
||||
|
||||
uint64_t mode = bilinear ? FILTER_BILINEAR : FILTER_POINT;
|
||||
__rdpq_mode_change_som(SOM_SAMPLE_MASK, mode << SOM_SAMPLE_SHIFT);
|
||||
|
||||
int offset = bilinear ? -((1 << TEX_SHIFT) / 2) : 0;
|
||||
gpuSetTexOffset(offset, offset);
|
||||
}
|
||||
|
||||
void Gfx_EnableMipmaps(void) {
|
||||
// TODO move back to texture instead?
|
||||
SetFilterMode(Gfx.Mipmaps);
|
||||
}
|
||||
|
||||
void Gfx_DisableMipmaps(void) {
|
||||
SetFilterMode(FILTER_POINT);
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
|
Loading…
x
Reference in New Issue
Block a user