diff --git a/hw/xbox/nv2a/pgraph/vk/renderer.h b/hw/xbox/nv2a/pgraph/vk/renderer.h index 43279046d2f..7baa49acb0b 100644 --- a/hw/xbox/nv2a/pgraph/vk/renderer.h +++ b/hw/xbox/nv2a/pgraph/vk/renderer.h @@ -203,6 +203,9 @@ typedef struct TextureKey { hwaddr palette_vram_offset; hwaddr palette_length; float scale; + uint32_t filter; + uint32_t address; + uint32_t border_color; } TextureKey; typedef struct TextureBinding { diff --git a/hw/xbox/nv2a/pgraph/vk/texture.c b/hw/xbox/nv2a/pgraph/vk/texture.c index f74f5c0c4f4..98acf4aec1f 100644 --- a/hw/xbox/nv2a/pgraph/vk/texture.c +++ b/hw/xbox/nv2a/pgraph/vk/texture.c @@ -1090,6 +1090,13 @@ static void create_texture(PGRAPHState *pg, int texture_idx) size_t texture_length = pgraph_get_texture_length(pg, &state); + uint32_t filter = + pgraph_reg_r(pg, NV_PGRAPH_TEXFILTER0 + texture_idx * 4); + uint32_t address = + pgraph_reg_r(pg, NV_PGRAPH_TEXADDRESS0 + texture_idx * 4); + uint32_t border_color_pack32 = + pgraph_reg_r(pg, NV_PGRAPH_BORDERCOLOR0 + texture_idx * 4); + TextureKey key; memset(&key, 0, sizeof(key)); key.state = state; @@ -1099,6 +1106,11 @@ static void create_texture(PGRAPHState *pg, int texture_idx) key.palette_length = texture_palette_data_size; key.scale = 1; + // FIXME: Separate sampler from texture + key.filter = filter; + key.address = address; + key.border_color = border_color_pack32; + bool is_indexed = (state.color_format == NV097_SET_TEXTURE_FORMAT_COLOR_SZ_I8_A8R8G8B8); @@ -1244,8 +1256,6 @@ static void create_texture(PGRAPHState *pg, int texture_idx) VkSamplerCustomBorderColorCreateInfoEXT custom_border_color_create_info; VkBorderColor vk_border_color; - uint32_t border_color_pack32 = - pgraph_reg_r(pg, NV_PGRAPH_BORDERCOLOR0 + texture_idx * 4); bool is_integer_type = vkf.vk_format == VK_FORMAT_R32_UINT; @@ -1285,7 +1295,6 @@ static void create_texture(PGRAPHState *pg, int texture_idx) } } - uint32_t filter = pgraph_reg_r(pg, NV_PGRAPH_TEXFILTER0 + texture_idx * 4); if (filter & NV_PGRAPH_TEXFILTER0_ASIGNED) NV2A_UNIMPLEMENTED("NV_PGRAPH_TEXFILTER0_ASIGNED"); if (filter & NV_PGRAPH_TEXFILTER0_RSIGNED) @@ -1320,9 +1329,6 @@ static void create_texture(PGRAPHState *pg, int texture_idx) min_filter == NV_PGRAPH_TEXFILTER0_MIN_BOX_NEARESTLOD || min_filter == NV_PGRAPH_TEXFILTER0_MIN_TENT_NEARESTLOD; - uint32_t address = - pgraph_reg_r(pg, NV_PGRAPH_TEXADDRESS0 + texture_idx * 4); - VkSamplerCreateInfo sampler_create_info = { .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, .magFilter = vk_mag_filter,