Skip to content

Commit c72a70d

Browse files
authored
Partially restore sync load and load wallpaper earlier to fix texture load regression (#18954)
1 parent 1a0d26b commit c72a70d

3 files changed

Lines changed: 41 additions & 38 deletions

File tree

menu/drivers/materialui.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,7 +2561,6 @@ static void materialui_update_savestate_thumbnail_image(void *data)
25612561
static void materialui_context_reset_textures(materialui_handle_t *mui)
25622562
{
25632563
int i;
2564-
bool supports_rgba = (video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA);
25652564

25662565
/* Loop through all textures */
25672566
for (i = 0; i < MUI_TEXTURE_LAST; i++)
@@ -2570,9 +2569,9 @@ static void materialui_context_reset_textures(materialui_handle_t *mui)
25702569
fill_pathname_join_special(texpath,
25712570
mui->icons_path, materialui_texture_path(i),
25722571
sizeof(texpath));
2573-
gfx_display_load_icon(texpath, supports_rgba,
2574-
&mui->textures.list[i], mui_icon_load_gen,
2575-
&mui_icon_load_gen);
2572+
gfx_display_reset_icon_texture(texpath,
2573+
&mui->textures.list[i], TEXTURE_FILTER_LINEAR,
2574+
NULL, NULL);
25762575
}
25772576
}
25782577

@@ -9917,15 +9916,16 @@ static void materialui_context_reset(void *data, bool is_threaded)
99179916
gfx_display_deinit_white_texture();
99189917
gfx_display_init_white_texture();
99199918
materialui_context_reset_textures(mui);
9920-
if (mui->textures.playlist.size >= 1)
9921-
materialui_context_reset_playlist_icons(mui);
9922-
menu_screensaver_context_destroy(mui->screensaver);
99239919

99249920
if (path_is_valid(path_menu_wallpaper))
99259921
task_push_image_load(path_menu_wallpaper,
99269922
(video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA), 0,
99279923
menu_display_handle_wallpaper_upload, NULL);
99289924

9925+
if (mui->textures.playlist.size >= 1)
9926+
materialui_context_reset_playlist_icons(mui);
9927+
menu_screensaver_context_destroy(mui->screensaver);
9928+
99299929
if (path_is_valid(mui->savestate_thumbnail_file_path))
99309930
materialui_update_savestate_thumbnail_image(mui);
99319931

menu/drivers/ozone.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,6 @@ static void ozone_reset_theme_textures(ozone_handle_t *ozone)
29632963
};
29642964
unsigned i, j;
29652965
char theme_path[NAME_MAX_LENGTH];
2966-
bool supports_rgba = (video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA);
29672966

29682967
for (j = 0; j < ARRAY_SIZE(ozone_themes); j++)
29692968
{
@@ -2985,9 +2984,9 @@ static void ozone_reset_theme_textures(ozone_handle_t *ozone)
29852984
fill_pathname_join_special(texpath,
29862985
theme_path, OZONE_THEME_TEXTURES_FILES[i],
29872986
sizeof(texpath));
2988-
gfx_display_load_icon(texpath, supports_rgba,
2989-
&theme->textures[i], ozone_ctx_icon_load_gen,
2990-
&ozone_ctx_icon_load_gen);
2987+
gfx_display_reset_icon_texture(texpath,
2988+
&theme->textures[i], TEXTURE_FILTER_LINEAR,
2989+
NULL, NULL);
29912990
}
29922991
}
29932992
}
@@ -9841,7 +9840,6 @@ static void ozone_context_reset(void *data, bool is_threaded)
98419840
"cursor_border.png"
98429841
};
98439842
unsigned i;
9844-
bool supports_rgba = (video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA);
98459843
ozone_handle_t *ozone = (ozone_handle_t*) data;
98469844

98479845
if (ozone)
@@ -9866,9 +9864,9 @@ static void ozone_context_reset(void *data, bool is_threaded)
98669864
fill_pathname_join_special(texpath,
98679865
ozone->png_path, OZONE_TEXTURES_FILES[i],
98689866
sizeof(texpath));
9869-
gfx_display_load_icon(texpath, supports_rgba,
9870-
&ozone->textures[i], ozone_ctx_icon_load_gen,
9871-
&ozone_ctx_icon_load_gen);
9867+
gfx_display_reset_icon_texture(texpath,
9868+
&ozone->textures[i], TEXTURE_FILTER_LINEAR,
9869+
NULL, NULL);
98729870
}
98739871

98749872
/* Sidebar textures */
@@ -9890,9 +9888,9 @@ static void ozone_context_reset(void *data, bool is_threaded)
98909888
sizeof(texpath));
98919889
break;
98929890
}
9893-
gfx_display_load_icon(texpath, supports_rgba,
9894-
&ozone->tab_textures[i], ozone_ctx_icon_load_gen,
9895-
&ozone_ctx_icon_load_gen);
9891+
gfx_display_reset_icon_texture(texpath,
9892+
&ozone->tab_textures[i], TEXTURE_FILTER_LINEAR,
9893+
NULL, NULL);
98969894
}
98979895

98989896
/* Theme textures */
@@ -9905,9 +9903,9 @@ static void ozone_context_reset(void *data, bool is_threaded)
99059903
fill_pathname_join_special(texpath,
99069904
ozone->icons_path, ozone_entries_icon_texture_path(i),
99079905
sizeof(texpath));
9908-
gfx_display_load_icon(texpath, supports_rgba,
9909-
&ozone->icons_textures[i], ozone_ctx_icon_load_gen,
9910-
&ozone_ctx_icon_load_gen);
9906+
gfx_display_reset_icon_texture(texpath,
9907+
&ozone->icons_textures[i], TEXTURE_FILTER_LINEAR,
9908+
NULL, NULL);
99119909
}
99129910

99139911
gfx_display_deinit_white_texture();

menu/drivers/xmb.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ static int xmb_menu_entry_action(void *userdata,
524524
menu_entry_t *entry, size_t i, enum menu_action action);
525525
static bool xmb_load_image(void *userdata, void *data,
526526
enum menu_image_type type);
527+
static void xmb_context_bg_destroy(xmb_handle_t *xmb);
527528
static void xmb_navigation_set(void *data, bool scroll);
528529
static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
529530
xmb_node_t *core_node, xmb_node_t *node,
@@ -1269,9 +1270,23 @@ static void xmb_update_dynamic_wallpaper(xmb_handle_t *xmb, bool reset)
12691270
{
12701271
if (path_is_valid(path))
12711272
{
1272-
task_push_image_load(path,
1273-
(video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA), 0,
1274-
menu_display_handle_wallpaper_upload, NULL);
1273+
if (reset)
1274+
{
1275+
xmb_context_bg_destroy(xmb);
1276+
1277+
if (!gfx_display_reset_icon_texture(path,
1278+
&xmb->textures.bg, TEXTURE_FILTER_LINEAR,
1279+
NULL, NULL))
1280+
task_push_image_load(path,
1281+
(video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA), 0,
1282+
menu_display_handle_wallpaper_upload, NULL);
1283+
1284+
gfx_display_init_white_texture();
1285+
}
1286+
else
1287+
task_push_image_load(path,
1288+
(video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA), 0,
1289+
menu_display_handle_wallpaper_upload, NULL);
12751290

12761291
free(xmb->bg_file_path);
12771292
xmb->bg_file_path = strdup(path);
@@ -6656,7 +6671,6 @@ static void xmb_context_reset_textures(
66566671
unsigned menu_xmb_theme)
66576672
{
66586673
unsigned i;
6659-
bool supports_rgba = (video_driver_get_disp_flags() & VIDEO_FLAG_USE_RGBA);
66606674

66616675
/* Invalidate in-flight context texture loads */
66626676
xmb_ctx_icon_load_gen++;
@@ -6681,14 +6695,11 @@ static void xmb_context_reset_textures(
66816695

66826696
fill_pathname_join_special(texpath,
66836697
iconpath, texture_path, sizeof(texpath));
6684-
gfx_display_load_icon(texpath, supports_rgba,
6685-
&xmb->textures.list[i], xmb_ctx_icon_load_gen,
6686-
&xmb_ctx_icon_load_gen);
6698+
gfx_display_reset_icon_texture(texpath,
6699+
&xmb->textures.list[i], TEXTURE_FILTER_LINEAR,
6700+
NULL, NULL);
66876701
}
66886702

6689-
/* Tab node icons will be populated from textures.list[]
6690-
* once the async loads complete — handled by the draw-time
6691-
* check in xmb_draw_icon_predot / xmb_frame. */
66926703
xmb->main_menu_node.icon = 0;
66936704
xmb->settings_tab_node.icon = 0;
66946705
xmb->history_tab_node.icon = 0;
@@ -6812,9 +6823,9 @@ static void xmb_context_reset_internal(xmb_handle_t *xmb,
68126823
xmb->allow_dynamic_wallpaper = true;
68136824
}
68146825

6826+
xmb_update_dynamic_wallpaper(xmb, true);
68156827
xmb_context_reset_horizontal_list(xmb);
68166828
xmb_set_title(xmb);
6817-
xmb_update_dynamic_wallpaper(xmb, true);
68186829

68196830
menu_screensaver_context_destroy(xmb->screensaver);
68206831

@@ -8080,12 +8091,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
80808091
uintptr_t tex_bg = xmb->textures.bg;
80818092
memcpy(tex_list, xmb->textures.list, sizeof(tex_list));
80828093

8083-
/* Async icon sync: context textures are loaded asynchronously and
8084-
* may complete across multiple frames. Continuously propagate
8085-
* finished textures into the tab node icon fields. The writes
8086-
* are single-pointer stores so there is no race with the async
8087-
* callback, and the per-frame cost is negligible (a few pointer
8088-
* comparisons). */
80898094
if (tex_list[XMB_TEXTURE_MAIN_MENU])
80908095
xmb->main_menu_node.icon = tex_list[XMB_TEXTURE_MAIN_MENU];
80918096
if (tex_list[XMB_TEXTURE_SETTINGS])

0 commit comments

Comments
 (0)