版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 砖瓦装出窑工班组建设水平考核试卷含答案
- 肉品分级员达标测试考核试卷含答案
- 特种弹簧制作工诚信竞赛考核试卷含答案
- 选煤工操作知识能力考核试卷含答案
- 医疗废弃物处理工操作规程模拟考核试卷含答案
- 补充保险风险应对策略-面对市场变革建立健全风险管理
- 亚运会题目多选题及答案
- 2024-2025学年广东省潮州市饶平县八年级(下)期中数学试卷及答案
- 课件12 交车服务
- 2021年西藏高考政治真题及答案 附答题思路解析
- pu发泡工艺介绍
- 采购管理制度及流程采购管理制度及流程
- 全国优质课一等奖人教版初中八年级美术《设计纹样》公开课课件
- 水工隧洞的维护-水工隧洞的检查与养护
- 室内给水管道及配件安装工程检验批质量验收记录表
- 奔驰GLK汽车说明书
- 广东开放大学学位外语(本23春)形成性考核1试题及答案
- 数字填图系统新版(RgMap2.0)操作手册
- 对石灰石和稀硫酸反应的创新实验研究 说课 课件
- 宝坻事业单位招聘2022年考试《职业能力倾向测验》真题及答案解析【word版】
- 我们的生命周期ppt
评论
0/150
提交评论