版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
BuildingaHighPerformance3DGames
forWindowsPhoneAdamSchaefferMicrosoftCorporationSESSIONCODE:WPH308锐普PPT论坛chinakui首发rapidbbsBuildingaHighPerformance3DConsistentsetsofhardwarecapabilitiesdefinedbyMicrosoftWindowsPhone7HardwareResolutionTouchInputCPU/GPURAMHardwarekeyboardisoptional锐普PPT论坛chinakui首发:rapidbbsConsistentsetsofhardwarecaTheCPU锐普PPT论坛chinakui首发:rapidbbsTheCPU锐普PPT论坛chinakui首发:rapidTheEvolutionOfProgrammingLowlevelcontrolStraighttothemetalRawperformancetuningHighlevelabstractionRelyoncompilerandruntimeDeveloperproductivity锐普PPT论坛chinakui首发:rapidbbsTheEvolutionOfProgrammingLoWhyC#r0x0rzPowerfulandexpressiveTypesafetyreduceshard-to-track-downbugsReflectionInitializersyntaxGreattooling(IntelliSense)SimilarenoughtoCthatlearningandportingareeasyBlazinglyfastcompilesC#锐普PPT论坛chinakui首发:rapidbbsWhyC#r0x0rzPowerfulandexpr.NETonWindowsUsuallywithinafewpercentofnativeperformanceAwesomegenerationalgarbagecollectionPerformanceshootout:RaymondChenvs.RicoMarianis.msdn/ricom/archive/2019/05/10/416151.aspx锐普PPT论坛chinakui首发:rapidbbs.NETonWindowsUsuallywithin.NETonXbox360360Significantdeltabetweenmanagedandnative.NETCompactFrameworkSimplisticmark-and-sweepgarbagecollectionXboxisnotageneralpurposecomputerUnforgivingin-orderCPUarchitectureRequirescustomVMXinstructionsforoptimalmathperfSecurityarchitectureposeschallengesforjittedcode锐普PPT论坛chinakui首发:rapidbbs.NETonXbox360360Significant.NETonWindowsPhone7InbetweenWindowsandXbox360.NETCompactFrameworkKeepaneyeongarbagecollection!ARMv7CPUMoreforgivingtowardjittedcodeARMjitterismorematurethanPPC锐普PPT论坛chinakui首发:rapidbbs.NETonWindowsPhone7InbetwWaysToCallCodeInstancemethodInterfaceDelegate/eventReflectionVirtualmethod锐普PPT论坛chinakui首发:rapidbbsWaysToCallCodeInstancemethChooseYourOwnAddressC++allowsindependentchoiceof.NETtypesdictatetheirallocationandusagesemanticsDatatypeThememoryinwhichatypelives(placementnew)Howatypeinstanceisreferenced(T,T*,T&,constT&)Valuetypesint,bool,struct,Vector3Referencetypesclass,array,string,delegate,boxedvaluetypes锐普PPT论坛chinakui首发:rapidbbsChooseYourOwnAddressC++allAPopularMythOft-repeatedwisdomValuetypesliveonthestackReferencetypeslive
ontheheapValuetypeslivewherevertheyaredeclaredReferencetypeshavetwopieces
Memoryallocatedfromtheheap
ApointertothisheapmemoryThatissubtlyincorrect锐普PPT论坛chinakui首发:rapidbbsAPopularMythOft-repeatedwisBydefault,
preferclassoverstructureUsestructforthingsthatareclassvs.structSmall(<=16bytes)ShortlivedPasslargestructuresbyreferenceMatrixa,b,c;c=Matrix.Multiply(a,b);//copies192bytes!Matrix.Multiply(refa,refb,outc);锐普PPT论坛chinakui首发:rapidbbsBydefault,
preferclassoverMemoryManagementC++.NETAllocateInitiallyfast,becomingslowerasfragmentationincreasesVeryfast,apartfromperiodicgarbagecollectionsFreeFastInstantaneousFragmentationIncreasesovertimeNoneCachecoherencyRequirescustomallocatorsThingsallocatedcloseintimearealsocloseinphysicallocationGarbagecollectionisnotoptionalCan’thavetypesafetywithoutautomaticmemorymanagement锐普PPT论坛chinakui首发:rapidbbsMemoryManagementC++.NETAllocaMarkandSweepTriggeredpermegabyteofallocation1Startswithrootreferences(stackvariables,statics)2Recursivelyfollowsallreferencestosee
whatotherobjectscanbereached3Anythingwedidn’treachmustbegarbage4Compactstheheap,slidingliveobjectsdowntofillholes5锐普PPT论坛chinakui首发:rapidbbsMarkandSweepTriggeredpermeFrameworksdesigned
forperformanceFrameworksdesigned
forperformanceTwoWaysToKeepGCHappyMakeitrunLessOftenIfyouneverallocate,GCwillneverrunMakeitFinishQuicklyCollectiontimeisproportionaltohowmanyobjectreferencesmustbetraversedUseobjectpoolsSimpleheap=fastcollectionUsevaluetypesandintegerhandles锐普PPT论坛chinakui首发:rapidbbsTwoWaysToKeepGCHappyMakeGC.CollectExplicitlyforces
agarbagecollectionUsewiselytogiveyourselfmoreheadroomAfterloadingDuringpausesingameplayDon’tcalleveryframe!锐普PPT论坛chinakui首发:rapidbbsGC.CollectExplicitlyforces
aAvoidingAllocationBewareofboxingstringvs.StringBuilderUseWeakReferencetotrackGCfrequencyhttp://s.msdn/shawnhar/archive/2019/10/12/monitoring-the-garbage-collector.aspxUseCLRProfileronWindowsSeeMIX’10talk:“DevelopmentandDebuggingToolsforWindowsPhone7Series”Use.NETReflectortopeekbehindthecurtainhttp://red-gate/products/reflector/锐普PPT论坛chinakui首发:rapidbbsAvoidingAllocationBewareofbTheGPU锐普PPT论坛chinakui首发:rapidbbsTheGPU锐普PPT论坛chinakui首发:rapidPlushardwareaccelerated2DspritedrawingFiveConfigurableEffectsBasicEffectSkinnedEffectEnvironmentMapEffectAlphaTestEffectDualTextureEffect锐普PPT论坛chinakui首发:rapidbbsPlushardwareaccelerated2DsBasicEffect0-3directionallightsBlinn-PhongshadingOptionaltextureOptionalfogOptionalvertexcolorBasicEffectVertexCostPixelCostNolighting51Onevertexlight401Threevertexlights601Threepixellights1850+Texture+1+2+Fog+4+2锐普PPT论坛chinakui首发:rapidbbsBasicEffect0-3directionalligDualTextureEffectDualTextureEffectForlightmaps,detailtextures,decalsBlendstwotexturesSeparatetexturecoordinatesModulate2Xcombinemode(A*B*2)GoodvisualsatlowpixelcostVertexCostPixelCostTwoTextures76+Fog+4+2锐普PPT论坛chinakui首发:rapidbbsDualTextureEffectDualTextureEfAlphaTestEffectForbillboardsandimpostersAddsalphatestoperations(pixelkill)StandardblendingisfreewithalleffectsOnlyneedalphatestifyouwantto
disabledepth/stencilwritesAlphaTestEffectVertexCostPixelCost<,<=,>=,>66==,!=610+Fog+4+2锐普PPT论坛chinakui首发:rapidbbsAlphaTestEffectForbillboardsSkinnedEffectSkinnedEffectForanimatedmodelsandinstancingGamecodeanimatesbonesonCPUVertexskinningperformedbyGPUUpto72bonesOne,two,orfourweightspervertexVertexCostPixelCostOnevertexlight554Threevertexlights754Threepixellights3351+Twobones+7+0+Fourbones+13+0+Fog+0+2锐普PPT论坛chinakui首发:rapidbbsSkinnedEffectSkinnedEffectForEnvironmentMapEffectEnvironmentMapEffectOooh,shiny!Diffusetexture+cubeenvironmentmapCheapwaytofakemanycomplexlightsFresneltermsimulatesbehaviorwhenlightreaches
asurfaceandsomereflects,somepenetratesVertexCostPixelCostOnelight326Threelights366+Fresnel+7+0+Specular+0+2+Fog+0+2锐普PPT论坛chinakui首发:rapidbbs锐普PPT论坛chinakui首发:rapidbbsEnvironmentMapEffectEnvironmenABalancingActFramerateNumberofPixelsPixelCost锐普PPT论坛chinakui首发:rapidbbsABalancingActFramerateNumberBalancingFramerateFramerate30hzrefreshrateNopointupdatingfasterthanthedisplay!Game.TargetElapsedTime=TimeSpan.FromSeconds(1f/30);锐普PPT论坛chinakui首发:rapidbbsBalancingFramerateFramerate30ABalancingActPixelCostPrefercheapereffectsMinimizeoverdrawManyknownalgorithms:Distance,frustum,BSP,sortfronttobackImplement“overdrawx-raymode”DrawuntexturedwithadditiveblendingBrighterareasindicateoverdraw锐普PPT论坛chinakui首发:rapidbbsABalancingActPixelCostPrefeABalancingActNumberofPixels800x480is25%morepixelsthanXbox1GreatfortextToomanypixelsforintensivegames800x480=384,000pixels600x360=216,000pixels(56%)DedicatedhardwarescalerDoesnotconsumeanyGPUHigherqualitythanbilinearupsampling锐普PPT论坛chinakui首发:rapidbbsABalancingActNumber800x480iScalerDemo锐普PPT论坛chinakui首发:rapidbbsScalerDemo锐普PPT论坛chinakui首发:rXNAFrameworkAPICheatSheetAvoidPreferRenderTargetUsage.PreserveContentsRenderTargetUsage.DiscardContentsdevice.BlendState=newBlendState{...};//AtstartupstaticBlendStatemyState=newBlendState{...};//PerframeDevice.BlendState=myState;VertexBuffer.SetData(...)device.DrawUserPrimitives(...);//orDynamicVertexBuffer.SetData(...,SetDataOptions.NoOverwrite);锐普PPT论坛chinakui首发:rapidbbsXNAFrameworkAPICheatSheetASummaryGreatperformancecomesfromgreatknowledgeUnderstandActionsValuetypesvs.referencetypesGarbagecollectionC#compilermagic(foreach,iteratormethods,closures)CostofthedifferentgraphicaleffectoptionsUseCLRProfilerand.NETReflectorRendersmallerthandisplayresolution,relyonscaler锐普PPT论坛chinakui首发:rapidbbsSummaryGreatperformancecomes©2019MicrosoftCorporation.Allrightsreserved.Microsoft,Windows,WindowsVistaandotherproductnamesareormayberegisteredtrademarksand/ortrademarksintheU.S.and/orothercountries.TheinformationhereinisforinformationalpurposesonlyandrepresentsthecurrentviewofMicrosoftCorporationasofthedateofthispresentation.BecauseMicrosoftmustrespondtochangingmarketconditions,itshouldnotbeinterpretedtobeacommitmentonthepartofMicrosoft,andMicrosoftcannotguaranteetheaccuracyofanyinformationprovidedafterthedateofthispresentation.
MICROSOFTMAKESNOWARRANTIES,EXPRESS,IMPLIEDORSTATUTORY,ASTOTHEINFORMATIONINTHISPRESENTATION.锐普PPT论坛chinakui首发:rapidbbs©2019MicrosoftCorporation.RequiredSlide锐普PPT论坛chinakui首发:rapidbbsRequiredSlide锐普PPT论坛chinakui首BuildingaHighPerformance3DGames
forWindowsPhoneAdamSchaefferMicrosoftCorporationSESSIONCODE:WPH308锐普PPT论坛chinakui首发rapidbbsBuildingaHighPerformance3DConsistentsetsofhardwarecapabilitiesdefinedbyMicrosoftWindowsPhone7HardwareResolutionTouchInputCPU/GPURAMHardwarekeyboardisoptional锐普PPT论坛chinakui首发:rapidbbsConsistentsetsofhardwarecaTheCPU锐普PPT论坛chinakui首发:rapidbbsTheCPU锐普PPT论坛chinakui首发:rapidTheEvolutionOfProgrammingLowlevelcontrolStraighttothemetalRawperformancetuningHighlevelabstractionRelyoncompilerandruntimeDeveloperproductivity锐普PPT论坛chinakui首发:rapidbbsTheEvolutionOfProgrammingLoWhyC#r0x0rzPowerfulandexpressiveTypesafetyreduceshard-to-track-downbugsReflectionInitializersyntaxGreattooling(IntelliSense)SimilarenoughtoCthatlearningandportingareeasyBlazinglyfastcompilesC#锐普PPT论坛chinakui首发:rapidbbsWhyC#r0x0rzPowerfulandexpr.NETonWindowsUsuallywithinafewpercentofnativeperformanceAwesomegenerationalgarbagecollectionPerformanceshootout:RaymondChenvs.RicoMarianis.msdn/ricom/archive/2019/05/10/416151.aspx锐普PPT论坛chinakui首发:rapidbbs.NETonWindowsUsuallywithin.NETonXbox360360Significantdeltabetweenmanagedandnative.NETCompactFrameworkSimplisticmark-and-sweepgarbagecollectionXboxisnotageneralpurposecomputerUnforgivingin-orderCPUarchitectureRequirescustomVMXinstructionsforoptimalmathperfSecurityarchitectureposeschallengesforjittedcode锐普PPT论坛chinakui首发:rapidbbs.NETonXbox360360Significant.NETonWindowsPhone7InbetweenWindowsandXbox360.NETCompactFrameworkKeepaneyeongarbagecollection!ARMv7CPUMoreforgivingtowardjittedcodeARMjitterismorematurethanPPC锐普PPT论坛chinakui首发:rapidbbs.NETonWindowsPhone7InbetwWaysToCallCodeInstancemethodInterfaceDelegate/eventReflectionVirtualmethod锐普PPT论坛chinakui首发:rapidbbsWaysToCallCodeInstancemethChooseYourOwnAddressC++allowsindependentchoiceof.NETtypesdictatetheirallocationandusagesemanticsDatatypeThememoryinwhichatypelives(placementnew)Howatypeinstanceisreferenced(T,T*,T&,constT&)Valuetypesint,bool,struct,Vector3Referencetypesclass,array,string,delegate,boxedvaluetypes锐普PPT论坛chinakui首发:rapidbbsChooseYourOwnAddressC++allAPopularMythOft-repeatedwisdomValuetypesliveonthestackReferencetypeslive
ontheheapValuetypeslivewherevertheyaredeclaredReferencetypeshavetwopieces
Memoryallocatedfromtheheap
ApointertothisheapmemoryThatissubtlyincorrect锐普PPT论坛chinakui首发:rapidbbsAPopularMythOft-repeatedwisBydefault,
preferclassoverstructureUsestructforthingsthatareclassvs.structSmall(<=16bytes)ShortlivedPasslargestructuresbyreferenceMatrixa,b,c;c=Matrix.Multiply(a,b);//copies192bytes!Matrix.Multiply(refa,refb,outc);锐普PPT论坛chinakui首发:rapidbbsBydefault,
preferclassoverMemoryManagementC++.NETAllocateInitiallyfast,becomingslowerasfragmentationincreasesVeryfast,apartfromperiodicgarbagecollectionsFreeFastInstantaneousFragmentationIncreasesovertimeNoneCachecoherencyRequirescustomallocatorsThingsallocatedcloseintimearealsocloseinphysicallocationGarbagecollectionisnotoptionalCan’thavetypesafetywithoutautomaticmemorymanagement锐普PPT论坛chinakui首发:rapidbbsMemoryManagementC++.NETAllocaMarkandSweepTriggeredpermegabyteofallocation1Startswithrootreferences(stackvariables,statics)2Recursivelyfollowsallreferencestosee
whatotherobjectscanbereached3Anythingwedidn’treachmustbegarbage4Compactstheheap,slidingliveobjectsdowntofillholes5锐普PPT论坛chinakui首发:rapidbbsMarkandSweepTriggeredpermeFrameworksdesigned
forperformanceFrameworksdesigned
forperformanceTwoWaysToKeepGCHappyMakeitrunLessOftenIfyouneverallocate,GCwillneverrunMakeitFinishQuicklyCollectiontimeisproportionaltohowmanyobjectreferencesmustbetraversedUseobjectpoolsSimpleheap=fastcollectionUsevaluetypesandintegerhandles锐普PPT论坛chinakui首发:rapidbbsTwoWaysToKeepGCHappyMakeGC.CollectExplicitlyforces
agarbagecollectionUsewiselytogiveyourselfmoreheadroomAfterloadingDuringpausesingameplayDon’tcalleveryframe!锐普PPT论坛chinakui首发:rapidbbsGC.CollectExplicitlyforces
aAvoidingAllocationBewareofboxingstringvs.StringBuilderUseWeakReferencetotrackGCfrequencyhttp://s.msdn/shawnhar/archive/2019/10/12/monitoring-the-garbage-collector.aspxUseCLRProfileronWindowsSeeMIX’10talk:“DevelopmentandDebuggingToolsforWindowsPhone7Series”Use.NETReflectortopeekbehindthecurtainhttp://red-gate/products/reflector/锐普PPT论坛chinakui首发:rapidbbsAvoidingAllocationBewareofbTheGPU锐普PPT论坛chinakui首发:rapidbbsTheGPU锐普PPT论坛chinakui首发:rapidPlushardwareaccelerated2DspritedrawingFiveConfigurableEffectsBasicEffectSkinnedEffectEnvironmentMapEffectAlphaTestEffectDualTextureEffect锐普PPT论坛chinakui首发:rapidbbsPlushardwareaccelerated2DsBasicEffect0-3directionallightsBlinn-PhongshadingOptionaltextureOptionalfogOptionalvertexcolorBasicEffectVertexCostPixelCostNolighting51Onevertexlight401Threevertexlights601Threepixellights1850+Texture+1+2+Fog+4+2锐普PPT论坛chinakui首发:rapidbbsBasicEffect0-3directionalligDualTextureEffectDualTextureEffectForlightmaps,detailtextures,decalsBlendstwotexturesSeparatetexturecoordinatesModulate2Xcombinemode(A*B*2)GoodvisualsatlowpixelcostVertexCostPixelCostTwoTextures76+Fog+4+2锐普PPT论坛chinakui首发:rapidbbsDualTextureEffectDualTextureEfAlphaTestEffectForbillboardsandimpostersAddsalphatestoperations(pixelkill)StandardblendingisfreewithalleffectsOnlyneedalphatestifyouwantto
disabledepth/stencilwritesAlphaTestEffectVertexCostPixelCost<,<=,>=,>66==,!=610+Fog+4+2锐普PPT论坛chinakui首发:rapidbbsAlphaTestEffectForbillboardsSkinnedEffectSkinnedEffectForanimatedmodelsandinstancingGamecodeanimatesbonesonCPUVertexskinningperformedbyGPUUpto72bonesOne,two,orfourweightspervertexVertexCostPixelCostOnevertexlight554Threevertexlights754Threepixellights3351+Twobones+7+0+Fourbones+13+0+Fog+0+2锐普PPT论坛chinakui首发:rapidbbsSkinnedEffectSkinnedEffectForEnvironmentMapEffectEnvironmentMapEffectOooh,shiny!Diffusetexture+cubeenvironmentmapCheapwaytofakemanycomplexlightsFresneltermsimulatesbehaviorwhenlightreaches
asurfaceandsomereflects,somepenetratesVertexCostPixelCostOnelight326Threelights366+Fresnel+7+0+Specular+0+2+Fog+0+2锐普PPT论坛chinakui首发:rapidbbs锐普PPT论坛chinakui首发:rapidbbsEnvironmentMapEffectEnvironmenABalancingActFramerateNumberofPixelsPixelCost锐普PPT论坛chinakui首发:rapidbbsABalancingActFramerateNumberBalancingFramerateFramerate30hzrefreshrateNopointupdatingfasterthanthedisplay!Game.TargetElapsedTime=TimeSpan.FromSeconds(1f/30);锐普PPT论坛chinakui首发:rapidbbsBalancingFramerateFramerate30ABalancingActPixelCostPrefercheapereffectsMinimizeoverdrawManyknownalgorithms:Distance,frustum,BSP,sortfronttobackImplement“overdrawx-raymode”DrawuntexturedwithadditiveblendingBrighterareasindicateoverdraw锐普PPT论坛chinakui首发:rapidbbsABalancingActPixelCostPrefeABalancingActNumberofPixels800x480is25%morepixelsthanXbox1GreatfortextToomanypixelsforintensivegames800x480=38
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 智能血糖仪测量准确度校验方案
- 系统架构设计师考试备考习题集及答案
- 电子设备数据恢复与安全性维护指南
- 佛山社保知识培训课件
- 美容院美容顾问客户管理与拓展绩效考评表
- 训练中心教练员绩效分析表
- 第一章安全用电参考答案
- 安全演练游戏开发规范
- 安全防护方案企业级网络安全防御策略完善指南
- 工业品市场分析师市场竞争力分析与策略规划绩效评价表
- 湖北省武汉市江汉区2026届四年级数学第二学期期中学业质量监测试题含解析
- ISO 9001-2026 质量管理体系培训
- 2027中国邮政集团有限公司联合校园招聘考试备考题库及答案详解
- 2026中国超声设备国产化率提升路径与核心部件突破分析
- 煤矿供电技术与安全培训
- 2026年四川省国有企业综合招聘笔试备考习题
- 长城汽车招聘测评答案
- 初中语文100篇文言文翻译练习
- 2025年北京市检察机关聘用制司法辅助人员招聘笔试真题题库(附答案)
- 健康活动:吃早餐的重要性
- 职业卫生及个人防护用品知识培训
评论
0/150
提交评论