各种强大模板课件_第1页
各种强大模板课件_第2页
各种强大模板课件_第3页
各种强大模板课件_第4页
各种强大模板课件_第5页
已阅读5页,还剩61页未读 继续免费阅读

下载本文档

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

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论