The simplest programming to implement the main volume control of the Windows system

2023-01-12   ES  

1) DrawInstance and performance differences in the case of no combination
2) Detecting the resources of the project in the UWA report
3) After the elves set up the nine palaces, how to display it in the interface
4) Unloading of AssetBundle resources
5) The reason why Total Mono rose suddenly


This is the push of the 236 UWA technology knowledge sharing. Today we continue to select some issues related to development and optimization for everyone. It is recommended to read 10 minutes. After careful reading, there must be gains.

UWA Q & A community:answer.uwa4d.com
UWA QQ group 2: 793972859 (the original group is full)

Rendering

Q: I did a test, the environment: Unity 2019.4.15, model: Xiaomi 5X, draw 1,000 objects (apex> 300, not dynamic batch), the test order is: unity default rendering (20 FPS) -> UPDATE through Graphics.DrawInstance (16.5 FPS) -> DRAWINSTANCE (21.5 FPS) implemented through CommandBuffer, but it is not understood that the second test DrawInstance performance is reduced. Does the big guy help?

picture and test project can be downloaded through the following link:
link:https://share.weiyun.com/ZFOlW1of
Password: IP37RR

A: 1.instancing is higher and the main reason is that the pressure of the GPU is relatively large. See the test case below:

Test 1: 1000 objects (the number of vertices 88, close the dynamic batch)

Default: Camera.Render (14.59 ms), GFX.PRESENTFRAME (3.94 ms)

Instancing: Sub -thread Camera.Render (7.1 ms), GFX.PRESENTFRAME (4.70 ms)

Test 2: 1000 objects (the number of vertices 1278)

Default: Sub -thread Camera.Render (15.02 ms), GFX.PRESENTFRAME (9.01 ms)

Instancing: Sub -thread Camera.Render (8.21 ms), GFX.PRESENTFRAME (19.15 ms)

Instancing can significantly reduce CPU rendering (Camera.Render) time, but the performance of GPU calling DrawInstanced () seems worse than Draw (), causing CPU terminals to wait high. Therefore, the decline in the overall frame rate of Instancing is mainly caused by the pressure of the GPU.

At the same time, the logic in UPDATE will also have a frequent distribution of MONO pile memory such as New XXX [] array, and GC will also have a small impact (this part of this part).

Conclusion: Instancing can reduce the CPU rendering time, but the GPU API performance will be reduced, frame consumption is still affected by the comprehensive affected by the CPU rendering and GPU time consumption. Different models may be different.

Instancing: Recommend a large amount of static objects when using a COMMANDBUFFER, such as grass and sea.

Thank you Yufei @UWA Q & A community to provide answers, welcome everyone to transfer to the community exchange:
https://answer.uwa4d.com/question/60095ef310a17c6c2b09dc04


Texture

q: Excuse me: In the performance report, some pictures of RGBA32 are not in the project, but it is reflected in the report. Ask about which these are produced?

A: Background, UIMASK, and UISPRITE in the screenshot are introduced by the default UI element in UGUI. The scrollView in the figure below:

UnitynormalMap This is because the texture in Shader use Bump as the default value, but it is not assigned to this texture in the material ball. For this kind of empty texture, it can be detected in the detection of UWA’s local resource detection.

Thanks[email protected]Q & A community provides answers, and everyone is welcome to transfer to the community exchange:
https://answer.uwa4d.com/question/600a812910a17c6c2b09dc31


UGUI

Q: Import a picture of 171*41, set up the UI picture after setting up the Jiugong information. Then set the picture width and height to 0, and set the picture mode to sliced. But you can still see the picture displayed. Personally I feel that the UV calculation is wrong. If you switch to Simple, the picture is not displayed normally. What is the principle of the big guy?

Test project can beOriginal Q&Adownload (version: unity 2018.4.23)

A: This is related to the implementation principle of Jiugongge’s picture. You can see the picture below:

When you choose the sliced mode, he has a minimum drawing area, that is, four corners: 1, 3, 7, and 9, which must be drawn. When the RECT you set is more than 1, 3, 7, and 9, then 2 and 8 are zoomed in the X direction, and the Y direction remains unchanged, while 4 and 6 are zoomed in the Y direction. X The direction is unchanged; and 5 is zoomed in the X and Y directions. When you choose the Simple mode, it is determined based on the RECT range you set. If the RECT is larger than the original size, then stretch it, otherwise it is reduced; this is why you can not display.

Thank you Li Xing @UWA Q & A community for providing answers, welcome everyone to transfer to the community exchange:
https://answer.uwa4d.com/question/60096dcc10a17c6c2b09dc0d


AssetBundle

Q1: Public resource Public.ab is a global pre -load, resident memory. A specific resource A quotes a large graphic texture in Public.ab and another resource in A.AB. When not loading A, even if Public.ab is resident in memory, it will not actually instance that big picture texture.

The current problem is that when loading and using A resources, when you want to clean up A thoroughly from the memory, the unload (true) can be cleaned up by A.AB, Zhang Datu, on the premise of not being unloaded (true) without Public.ab, is there no other way to clear it from memory?

A1: If you can get the reference to the texture, you can try itResources.UnloadAsset

But I personally think that since it is a public resource, it means that it may be cited by many places, and the memory budget preparation for the resident memory in Public.ab should be prepared. Otherwise, according to your example, it may be better to take this large pattern.

Thank you Fan Jun @UWA Q & A community to provide answers

q2: Since the large graphic texture is referenced by multiple UI preset body, it is placed in public.ab, but these UI pre -prefabricated bodies will not open in most of the game (such as when hanging up), so it is also the same, so it is also the same. No need to use it, so I want to uninstall it. It seems that you can only disassemble public resources that are not permanently resident to solve such problems?

A2: Since it is necessary to be a public resource, the permanent memory is to be uninstalled from the beginning of the APP to the end of the APP. If you want to use the small pictures in public resources only in specific scenarios, you can uninstall it when you do n’t need it. You can refer to this dynamic atlas at the time of runtime. Dynamic exclusion recycling.

“Implementation of dynamic atlas when running”

Thanks[email protected]Q & A community provides answers, and everyone is welcome to transfer to the community exchange:
https://answer.uwa4d.com/question/6007ee4010a17c6c2b09db6f


Mono

q: Phenomenon: In those frames that Total Mono suddenly enlarge, the USED MONO did not rise, as shown in the figure::

At about 50MB, Total suddenly distributed to 140MB when the userd was at about 50MB. Why?

A: It is likely that a large amount of stacked memory is assigned in a frame to enlarge Total, but the heap memory can be dropped by GC, so the USED has not changed much.

This question and answer is provided by UWA. Welcome to the community exchange:
https://answer.uwa4d.com/question/6007f1b810a17c6c2b09db70

Cover from the Internet


Today’s sharing is here. Of course, there is no end in life. In the long development cycle, these problems you see may be just the tip of the iceberg. We have already prepared more technical topics on the UWA Q & A website waiting for you to explore and share together. You are welcome to join you who love progress. Maybe your method can just solve the urgency of others; and the “stone” of his mountains can also attack your “jade”.

official website:www.uwa4d.com
official technology blog:blog.uwa4d.com
official Q & A community:answer.uwa4d.com
uwa school:edu.uwa4d.com
official technology QQ group: 793972859 (the original group is full)

source

Related Posts

SPARK TASKSCHEERER’s source code illustration

YOLO3 training, testing your own data set

The 11th free GIS data source in the world is here, come quickly!

In -depth priority traversing DFS summary: two common structures + full arrangement

The simplest programming to implement the main volume control of the Windows system

Random Posts

[phpmyadmin] ERROR 1045 (28000): Access Denied for User ‘root‘@‘localhost‘ (USING PASSWORD: Yes) solve PHPMYADMIN error 1045W

POJ 1146 ID CODES (generated arrangement) TCGOGOGO

wp listbox traversing datatemplate (get all controls)

GLIDE as a picture cache, clear the reasonable method of cache

32 and 64 -bit systems (Int Char Long Double pointer, etc.)