Caching of textures
Hi there!
I'm implement game UI via Noesis and have get freezes on first open windows where used texture atlas for icons, sure somewhere i'm make mistake with resource organization and missing caching in TextureProvider.
Please, explain to me how to correct preload big texture in TextureProvider and share it between multiply xaml (game windows) in most correct way.
For now i make in each .xaml (like MyGameWindow1.xaml) merged resource with global resource file:
and in Resource.xaml (which in global resource file):
In XamlProvider i realised caching and each .xaml loadings only once in memory, but as follows from my observations it not preventing from loading texture atlases in each .xaml.
As example: MyWindow1.xaml uses Atlas1 and MyWindow2.xaml uses Atlas1, but after open MyWindow1.xaml and get loaded Atlas1 it not loads Atlas1 for MyWindow2.xaml, after open second one window it will be again freeze for first opening.
With best regards.
I'm implement game UI via Noesis and have get freezes on first open windows where used texture atlas for icons, sure somewhere i'm make mistake with resource organization and missing caching in TextureProvider.
Please, explain to me how to correct preload big texture in TextureProvider and share it between multiply xaml (game windows) in most correct way.
For now i make in each .xaml (like MyGameWindow1.xaml) merged resource with global resource file:
Code: Select all
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
Code: Select all
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="SkillAtlas_Common.xaml" />
<ResourceDictionary Source="SkillAtlas_Master.xaml" />
</ResourceDictionary.MergedDictionaries>
// ... other Styles, Templates and etc.
As example: MyWindow1.xaml uses Atlas1 and MyWindow2.xaml uses Atlas1, but after open MyWindow1.xaml and get loaded Atlas1 it not loads Atlas1 for MyWindow2.xaml, after open second one window it will be again freeze for first opening.
With best regards.
Re: Caching of textures
Probably this is happening because after MyWindow1.xaml is closed, Atlas1 is unused and we release it. When MyWindow2.xaml is opened, Atlas is requested again and needs to be loaded. By default, we only implement a reference counter mechanism for textures, if you need something more sophisticated you need to implement it yourself in a custom Texture provider. For example, keeping a reference to Atlas1 to avoid unloading it.
There are also good hints about custom texture providers in this post:
viewtopic.php?t=2819
There are also good hints about custom texture providers in this post:
viewtopic.php?t=2819
Who is online
Users browsing this forum: No registered users and 5 guests