When you draw UI2Texture procedural texture inside another UI2Texture procedural texture, engine produces "Cannot load mipmap" error and texture fails to load.
Description
Details
- Severity
- Minor
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Category
- Scripting
- Run attached ui2textureception.VR mission
- Use "Set texture" action and observe the error
- Use "Open display and set texture" to observe the hackfix
Related Objects
- Mentioned In
- T171272: preloadTexture command
- Mentioned Here
- T171272: preloadTexture command
Event Timeline
Temporary workaround without need to draw inner display anywhere on UI:
Frame 1: Set outer display texture onto object texture
Frame 2: Set inner display texture to RscPicture, do displayUpdate to outer display
Frame 3: Do displayUpdate to outer display again
This error also happens if you try displaying .paa pictures without mipmaps inside inner ui2texture display.
Y can I not run mission in Eden 😢
works fine if i remove all the waitUntils and eden check. But need to run set texture twice to trigger that error.
I have already seen this error before.. it tries REALLY hard to load the second mipmap, even when there is only one. And it.. obviously fails.
is3DEN should have prevented init.sqf from running outside of 3DEN preview. As for getClientStateNumber, I didn't know it returns 0 in SP, I tested the repro in MP environment, the point of it was to skip briefing by force pressing the "Continue" button.
Here is init.sqf to have the repro work in SP.
waitUntil {player == player}; laptop = createVehicle ["Land_Laptop_unfolded_F", player modelToWorld [0,2,1], [], 0, "CAN_COLLIDE"]; laptop setDir (laptop getDir player); laptop enableSimulation false; settexture = { somenumber = random 1e6 toFixed 0; _this setObjectTexture [0, format["#(rgb,1024,1024,1)ui('DisplayTextureOuter','outer%1')", somenumber]]; }; settexturehack = { somenumber = random 1e6 toFixed 0; createDialog "DisplayTextureOuter"; _this setObjectTexture [0, format["#(rgb,1024,1024,1)ui('DisplayTextureOuter','outer%1')", somenumber]]; }; //laptop call settexture; player addAction ["Set texture", {laptop call settexture}]; player addAction ["Open display and set texture", {laptop call settexturehack}];
I always get the error on first run of "Set texture" action on Stable:
So one issue, its trying to use the texture before its loaded (because loading is async), so when the display is created, you set the texture, it will only load next frame, but right after creating display it tries to render.
Easy to check for that and skip rendering the texture.
Next issue, you have to manually re-render till its done loading, and there is no way for you to know when its done, it might take multiple frames.
So fix for that, after creation it will automatically trigger re-rendering while there is a non-ready texture inside the display OR there is a UIToTexture inside it that is scheduled for re-render.
That will recursively wait till all sub-textures are loaded.
But this will only happen at creation, if you add a sub texture some time later, you need to take care of that updating yourself.
Can we have a scripting command to check that? Something like BOOL = isTextureLoaded STRING, maybe also BOOL = isTextureLoading STRING to know if its been queued.
Refined idea once more, it all can be crammed into single command:
BOOL = preloadTexture STRING
Will return true as soon as texture is loaded.
Fix next dev and profiling (today)
Can we have a scripting command to check that?
No.
BOOL = preloadTexture STRING
Yes. Separate ticket. And its low priority. Texture cache mess will be fun
Fun allowed then. "Can we have a scripting command to check that" was about having such texture preloading scripting command, sorry for hasty confusing replies, really happy to see this addressed.
I think my ticket (https://feedback.bistudio.com/T171035) is related to the behavior mentioned here. In my case it's not a nested UI but only a static image. I tested the latest profiling build 2.12.150430 but unfortunately this does not solve my variant of the problem.
@SaMatra can you please confirm, if the issue is still present on your end?
Thank you.