ppt模板-配色简洁内容丰富.pptx_第1页
ppt模板-配色简洁内容丰富.pptx_第2页
ppt模板-配色简洁内容丰富.pptx_第3页
ppt模板-配色简洁内容丰富.pptx_第4页
ppt模板-配色简洁内容丰富.pptx_第5页
已阅读5页,还剩28页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Building a High Performance 3D Games for Windows Phone,Adam Schaeffer Microsoft Corporation,SESSION CODE: WPH308,锐普PPT论坛chinakui首发,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 Programming,Low level control,Straight to the metal,Raw performance tuning,High level abstraction,Rely on compiler and runtime,Developer productivity,Why C# r0x0rz,Powerful and expressive,Type safety reduces hard-to-track-down bugs,Reflection,Initializer syntax,Great tooling (IntelliSense),Similar enough to 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 /ricom/archive/2005/05/10/416151.aspx,.NET on Xbox 360,360,Significant delta between managed and native,.NET Compact 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 360,.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 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&, const T&),Value types int, bool, struct, Vector3 Reference types class, array, string, delegate, boxed value types,A Popular Myth,Oft-repeated wisdom,Value types live on the stack,Reference types live on the heap,By default, prefer class over structure,Use struct for things that are,class vs. struct,Small (= 16 bytes),Short lived,Pass large structures by reference,Matrix a, b, c; c = Matrix.Multiply(a, b); / copies 192 bytes! Matrix.Multiply(ref a, ref b, out c);,Memory Management,Garbage collection is not optional Cant have type safety without 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 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 pools,Simple 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 WeakReference to track GC frequency /shawnhar/archive/2007/10/12/monitoring-the-garbage-collector.aspx,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 /products/reflector/,The GPU,Plus hardware accelerated 2D sprite drawing,Five Configurable Effects,BasicEffect,SkinnedEffect,EnvironmentMapEffect,AlphaTestEffect,DualTextureEffect,BasicEffect,0-3 directional lights Blinn-Phong shading Optional texture Optional fog Optional vertex color,BasicEffect,DualTextureEffect,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,AlphaTestEffect,For billboards and imposters Adds alpha test operations (pixel kill) Standard blending is free with all effects Only need alpha test if you want to disable depth/stencil writes,AlphaTestEffect,SkinnedEffect,SkinnedEffect,For animated models and instancing Game code animates bones on CPU Vertex skinning performed by GPU Up to 72 bones One, two, or four weights per vertex,EnvironmentMapEffect,EnvironmentMapEffect,Oooh, shiny! Diffuse texture + cube environment map Cheap way to fake many complex lights Fresnel term simulates behavior when light reaches a surface and some reflects, some penetrates,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 / 30);,A Balancing Act,Pixel Cost,Prefer cheaper effects Minimize overdraw Many known algorithms: Distance, frustum, BSP, sort front to back Implement “overdraw x-ray mode” Draw untextured with additive blending Brighter areas indicate overdraw,A Balancing Act,Number of Pixels,800x480 is 25% more pixels than Xbox 1 Great for text Too many pixels for intensive games 800x480 = 384,000 pixels 600x360 = 216,000 pixels (56%) Dedicated hardware scaler Does not consume any GPU Higher quality than bilinear upsampling,Scaler Demo,XNA Framework API Cheat Sheet,Summary,Great performance comes from great knowledge,Understand,Actions,Value types vs. reference types Garbage collection C# compiler magic (foreach, iterator methods, closures) Cost of the different graphical effect options,Use CLR Profiler and .NET Reflector Render smaller than display resolution, rely on scaler, 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vis

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论