mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
nv2a/vk: Only include palette in texture key when necessary
Fixes degraded performance due to garbage palette details polluting the texture cache.
This commit is contained in:
@ -1089,12 +1089,9 @@ static void create_texture(PGRAPHState *pg, int texture_idx)
|
|||||||
BasicColorFormatInfo f_basic = kelvin_color_format_info_map[state.color_format];
|
BasicColorFormatInfo f_basic = kelvin_color_format_info_map[state.color_format];
|
||||||
|
|
||||||
const hwaddr texture_vram_offset = pgraph_get_texture_phys_addr(pg, texture_idx);
|
const hwaddr texture_vram_offset = pgraph_get_texture_phys_addr(pg, texture_idx);
|
||||||
size_t texture_palette_data_size;
|
|
||||||
const hwaddr texture_palette_vram_offset =
|
|
||||||
pgraph_get_texture_palette_phys_addr_length(pg, texture_idx,
|
|
||||||
&texture_palette_data_size);
|
|
||||||
|
|
||||||
size_t texture_length = pgraph_get_texture_length(pg, &state);
|
size_t texture_length = pgraph_get_texture_length(pg, &state);
|
||||||
|
hwaddr texture_palette_vram_offset = 0;
|
||||||
|
size_t texture_palette_data_size = 0;
|
||||||
|
|
||||||
uint32_t filter =
|
uint32_t filter =
|
||||||
pgraph_reg_r(pg, NV_PGRAPH_TEXFILTER0 + texture_idx * 4);
|
pgraph_reg_r(pg, NV_PGRAPH_TEXFILTER0 + texture_idx * 4);
|
||||||
@ -1102,14 +1099,21 @@ static void create_texture(PGRAPHState *pg, int texture_idx)
|
|||||||
pgraph_reg_r(pg, NV_PGRAPH_TEXADDRESS0 + texture_idx * 4);
|
pgraph_reg_r(pg, NV_PGRAPH_TEXADDRESS0 + texture_idx * 4);
|
||||||
uint32_t border_color_pack32 =
|
uint32_t border_color_pack32 =
|
||||||
pgraph_reg_r(pg, NV_PGRAPH_BORDERCOLOR0 + texture_idx * 4);
|
pgraph_reg_r(pg, NV_PGRAPH_BORDERCOLOR0 + texture_idx * 4);
|
||||||
|
bool is_indexed = (state.color_format ==
|
||||||
|
NV097_SET_TEXTURE_FORMAT_COLOR_SZ_I8_A8R8G8B8);
|
||||||
|
|
||||||
TextureKey key;
|
TextureKey key;
|
||||||
memset(&key, 0, sizeof(key));
|
memset(&key, 0, sizeof(key));
|
||||||
key.state = state;
|
key.state = state;
|
||||||
key.texture_vram_offset = texture_vram_offset;
|
key.texture_vram_offset = texture_vram_offset;
|
||||||
key.texture_length = texture_length;
|
key.texture_length = texture_length;
|
||||||
key.palette_vram_offset = texture_palette_vram_offset;
|
if (is_indexed) {
|
||||||
key.palette_length = texture_palette_data_size;
|
texture_palette_vram_offset =
|
||||||
|
pgraph_get_texture_palette_phys_addr_length(
|
||||||
|
pg, texture_idx, &texture_palette_data_size);
|
||||||
|
key.palette_vram_offset = texture_palette_vram_offset;
|
||||||
|
key.palette_length = texture_palette_data_size;
|
||||||
|
}
|
||||||
key.scale = 1;
|
key.scale = 1;
|
||||||
|
|
||||||
// FIXME: Separate sampler from texture
|
// FIXME: Separate sampler from texture
|
||||||
@ -1117,9 +1121,6 @@ static void create_texture(PGRAPHState *pg, int texture_idx)
|
|||||||
key.address = address;
|
key.address = address;
|
||||||
key.border_color = border_color_pack32;
|
key.border_color = border_color_pack32;
|
||||||
|
|
||||||
bool is_indexed = (state.color_format ==
|
|
||||||
NV097_SET_TEXTURE_FORMAT_COLOR_SZ_I8_A8R8G8B8);
|
|
||||||
|
|
||||||
bool possibly_dirty = false;
|
bool possibly_dirty = false;
|
||||||
bool possibly_dirty_checked = false;
|
bool possibly_dirty_checked = false;
|
||||||
bool surface_to_texture = false;
|
bool surface_to_texture = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user