微软出品简洁色块型PPT

上传人:摇**** 文档编号:117759114 上传时间:2019-12-10 格式:PPTX 页数:33 大小:3.25MB
返回 下载 相关 举报
微软出品简洁色块型PPT_第1页
第1页 / 共33页
微软出品简洁色块型PPT_第2页
第2页 / 共33页
微软出品简洁色块型PPT_第3页
第3页 / 共33页
微软出品简洁色块型PPT_第4页
第4页 / 共33页
微软出品简洁色块型PPT_第5页
第5页 / 共33页
点击查看更多>>
资源描述

《微软出品简洁色块型PPT》由会员分享,可在线阅读,更多相关《微软出品简洁色块型PPT(33页珍藏版)》请在金锄头文库上搜索。

1、Building a High Performance 3D Games for Windows Phone Adam Schaeffer Microsoft Corporation SESSION CODE: WPH308 Consistent sets of hardware capabilities defined by Microsoft Windows Phone 7 Hardware Resolution Touch Input CPU / GPU RAM Hardware keyboard is optional The CPU The Evolution Of Programm

2、ing Low level control Straight to the metal Raw performance tuning High level abstraction Rely on compiler and runtime Developer productivity Why C# r0 x0rz Powerful and expressive Type safety reduces hard-to-track-down bugs Reflection Initializer syntax Great tooling (IntelliSense) Similar enough t

3、o C that learning and porting are easy Blazingly fast compiles C# .NET on Windows Usually within a few percent of native performance Awesome generational garbage collection Performance shootout: Raymond Chen vs. Rico Mariani .NET on Xbox 360 360 Significant delta between managed and native .NET Comp

4、act Framework Simplistic mark-and-sweep garbage collection Xbox is not a general purpose computer Unforgiving in-order CPU architecture Requires custom VMX instructions for optimal math perf Security architecture poses challenges for jitted code .NET on Windows Phone 7 In between Windows and Xbox 36

5、0 .NET Compact Framework Keep an eye on garbage collection! ARMv7 CPU More forgiving toward jitted code ARM jitter is more mature than PPC Ways To Call Code Instance method Interface Delegate / event Reflection Virtual method Choose Your Own Address C+ allows independent choice of .NET types dictate

6、 their allocation and usage semantics Data type The memory in which a type lives (placement new) How a type instance is referenced (T, T*, T c = Matrix.Multiply(a, b); / copies 192 bytes! Matrix.Multiply(ref a, ref b, out c); Memory Management C+.NET AllocateInitially fast, becoming slower as fragme

7、ntation increases Very fast, apart from periodic garbage collections FreeFastInstantaneous FragmentationIncreases over timeNone Cache coherencyRequires custom allocatorsThings allocated close in time are also close in physical location Garbage collection is not optional Cant have type safety without

8、 automatic memory management Mark and Sweep Triggered per megabyte of allocation 1 Starts with root references (stack variables, statics) 2 Recursively follows all references to see what other objects can be reached 3 Anything we didnt reach must be garbage 4 Compacts the heap, sliding live objects

9、down to fill holes 5 Frameworks designed for performance Frameworks designed for performance Two Ways To Keep GC Happy Make it run Less Often If you never allocate, GC will never run Make it Finish Quickly Collection time is proportional to how many object references must be traversed Use object poo

10、lsSimple heap = fast collection Use value types and integer handles GC.Collect Explicitly forces a garbage collection Use wisely to give yourself more headroom After loading During pauses in gameplay Dont call every frame! Avoiding Allocation Beware of boxing string vs. StringBuilder Use WeakReferen

11、ce to track GC frequency Use CLR Profiler on Windows See MIX10 talk: “Development and Debugging Tools for Windows Phone 7 Series” Use .NET Reflector to peek behind the curtain http:/www.red- The GPU Plus hardware accelerated 2D sprite drawing Five Configurable Effects BasicEffectSkinnedEffectEnviron

12、mentMapEffectAlphaTestEffectDualTextureEffect BasicEffect 0-3 directional lights Blinn-Phong shading Optional texture Optional fog Optional vertex color BasicEffect Vertex CostPixel Cost No lighting51 One vertex light401 Three vertex lights601 Three pixel lights1850 + Texture+1+2 + Fog+4+2 DualTextu

13、reEffect DualTextureEffect For lightmaps, detail textures, decals Blends two textures Separate texture coordinates Modulate 2X combine mode (A*B*2) Good visuals at low pixel cost Vertex CostPixel Cost Two Textures76 + Fog+4+2 AlphaTestEffect For billboards and imposters Adds alpha test operations (p

14、ixel kill) Standard blending is free with all effects Only need alpha test if you want to disable depth/stencil writes AlphaTestEffect Vertex CostPixel Cost 66 =, !=610 + Fog+4+2 SkinnedEffect SkinnedEffect For animated models and instancing Game code animates bones on CPU Vertex skinning performed

15、by GPU Up to 72 bones One, two, or four weights per vertex Vertex CostPixel Cost One vertex light554 Three vertex lights754 Three pixel lights3351 + Two bones+7+0 + Four bones+13+0 + Fog+0+2 EnvironmentMapEffect EnvironmentMapEffect Oooh, shiny! Diffuse texture + cube environment map Cheap way to fa

16、ke many complex lights Fresnel term simulates behavior when light reaches a surface and some reflects, some penetrates Vertex CostPixel Cost One light326 Three lights366 + Fresnel+7+0 + Specular+0+2 + Fog+0+2 A Balancing Act Framerate Number of Pixels Pixel Cost Balancing Framerate Framerate 30 hz refresh rate No point updating faster than the display! Game.TargetElapsedTime = TimeSpan.FromSeconds(1f /

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > PPT模板库 > PPT素材/模板

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号