版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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黑龙江哈尔滨体育学院专业技术岗位人才招聘6人(第一批)参考题库含答案详解(A卷)
- 2026四川长虹技佳精工有限公司招聘采购岗位1人笔试题库含完整答案详解(网校专用)
- 2026年wps信息技术综合提升练习试题及参考答案详解【培优A卷】
- 2026年湖南省永州市重点学校小升初语文考试试题+解析
- 人教版五年级下册《道德与法治》期末试卷及参考答案
- 初中必背经典古诗文含注释
- 强电井管理制度规范
- 2026年人教版八年级下册生物期末考试卷及答案
- (新教材)2026年北师大版一年级上册数学 0.1 可爱的校园 课件
- GD2016《2016典管》火力发电厂汽水管道零件及部件典型设计(取替GD2000)-101-200
- 2025年医药代表行业反垄断合规考核试卷
- 雨课堂学堂云在线《图案审美与创作》单元测试考核答案
- 培训学校竞业合同范本
评论
0/150
提交评论