




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 江苏护理职业学院《汇编与接口技术》2023-2024学年第二学期期末试卷
- 塔里木大学《材料科学与工程专业导论》2023-2024学年第二学期期末试卷
- 江苏省苏州市昆山市、太仓市2025年初三5月热身考试英语试题含答案
- 六盘水市重点中学2025年高三下学期摸底(期末)考试英语试题含解析
- 内蒙古能源职业学院《学术与实务讲座A》2023-2024学年第二学期期末试卷
- 辽宁省大连市第七十六中学2025届初三第一次五校联考自选模块试卷含解析
- 盐城工学院《古代文学Ⅱ(4)》2023-2024学年第一学期期末试卷
- 宁夏回族固原市原州区2025届小升初数学重难点模拟卷含解析
- 顺德市李兆基中学高三月月考英语试题
- 邯郸市高二上学期期中考试化学试题
- 广东省深圳市深圳实验学校等校联考2024-2025学年九年级下学期开学考试语文试题(含答案)
- GB/T 25020.1-2025电气化铁路接触网支柱第1部分:钢支柱
- 2025年浙江安防职业技术学院单招职业倾向性测试题库1套
- 《园林景观手绘技法表现》课件-项目2 景观元素的表现技法
- 社会福利 课件汇 高和荣 第1-5章 绪论- 社会福利主体
- 治疗室换药室消毒管理制度
- 2025版轮胎进出口贸易与代理服务合同范本4篇
- 2024年开封大学高职单招职业技能测验历年参考题库(频考版)含答案解析
- 口腔医院市场营销新入职员工培训
- 瑞幸咖啡副店长认证考试题库
- 2024年生鲜配送与城市社区团购合作框架协议3篇
评论
0/150
提交评论