shaderGenHLSLInit.cpp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/platform.h"
  23. #include "shaderGen/shaderGen.h"
  24. #include "shaderGen/HLSL/shaderGenHLSL.h"
  25. #include "shaderGen/HLSL/shaderFeatureHLSL.h"
  26. #include "shaderGen/featureMgr.h"
  27. #include "shaderGen/HLSL/bumpHLSL.h"
  28. #include "shaderGen/HLSL/pixSpecularHLSL.h"
  29. #include "shaderGen/HLSL/depthHLSL.h"
  30. #include "shaderGen/HLSL/paraboloidHLSL.h"
  31. #include "materials/materialFeatureTypes.h"
  32. #include "core/module.h"
  33. #include "shaderGen/HLSL/accuFeatureHLSL.h"
  34. static ShaderGen::ShaderGenInitDelegate sInitDelegate;
  35. void _initShaderGenHLSL( ShaderGen *shaderGen )
  36. {
  37. shaderGen->setPrinter( new ShaderGenPrinterHLSL );
  38. shaderGen->setComponentFactory( new ShaderGenComponentFactoryHLSL );
  39. shaderGen->setFileEnding( "hlsl" );
  40. FEATUREMGR->registerFeature( MFT_VertTransform, new VertPositionHLSL );
  41. FEATUREMGR->registerFeature( MFT_RTLighting, new RTLightingFeatHLSL );
  42. FEATUREMGR->registerFeature( MFT_IsDXTnm, new NamedFeatureHLSL( "DXTnm" ) );
  43. FEATUREMGR->registerFeature( MFT_TexAnim, new TexAnimHLSL );
  44. FEATUREMGR->registerFeature( MFT_DiffuseMap, new DiffuseMapFeatHLSL );
  45. FEATUREMGR->registerFeature( MFT_OverlayMap, new OverlayTexFeatHLSL );
  46. FEATUREMGR->registerFeature( MFT_DiffuseColor, new DiffuseFeatureHLSL );
  47. FEATUREMGR->registerFeature( MFT_DiffuseVertColor, new DiffuseVertColorFeatureHLSL );
  48. FEATUREMGR->registerFeature( MFT_AlphaTest, new AlphaTestHLSL );
  49. FEATUREMGR->registerFeature( MFT_GlowMask, new GlowMaskHLSL );
  50. FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatHLSL );
  51. FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatHLSL );
  52. FEATUREMGR->registerFeature( MFT_VertLit, new VertLitHLSL );
  53. FEATUREMGR->registerFeature( MFT_Parallax, new ParallaxFeatHLSL );
  54. FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatHLSL );
  55. FEATUREMGR->registerFeature( MFT_DetailNormalMap, new NamedFeatureHLSL( "Detail Normal Map" ) );
  56. FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatHLSL );
  57. FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatHLSL );
  58. FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularHLSL );
  59. FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureHLSL( "Translucent" ) );
  60. FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) );
  61. FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatHLSL );
  62. FEATUREMGR->registerFeature( MFT_Fog, new FogFeatHLSL );
  63. FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapHLSL );
  64. FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatHLSL );
  65. FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureHLSL( "Gloss Map" ) );
  66. FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) );
  67. FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget1 ) );
  68. FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureHLSL( "Imposter" ) );
  69. FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureHLSL( "Diffuse Map Atlas" ) );
  70. FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureHLSL( "Normal Map Atlas" ) );
  71. FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatHLSL );
  72. FEATUREMGR->registerFeature( MFT_DepthOut, new DepthOutHLSL );
  73. FEATUREMGR->registerFeature( MFT_EyeSpaceDepthOut, new EyeSpaceDepthOutHLSL() );
  74. FEATUREMGR->registerFeature( MFT_HDROut, new HDROutHLSL );
  75. FEATUREMGR->registerFeature( MFT_ParaboloidVertTransform, new ParaboloidVertTransformHLSL );
  76. FEATUREMGR->registerFeature( MFT_IsSinglePassParaboloid, new NamedFeatureHLSL( "Single Pass Paraboloid" ) );
  77. FEATUREMGR->registerFeature( MFT_UseInstancing, new NamedFeatureHLSL( "Hardware Instancing" ) );
  78. FEATUREMGR->registerFeature( MFT_Foliage, new FoliageFeatureHLSL );
  79. FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureHLSL );
  80. FEATUREMGR->registerFeature( MFT_InterlacedPrePass, new NamedFeatureHLSL( "Interlaced Pre Pass" ) );
  81. FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureHLSL( "Forward Shaded Material" ) );
  82. FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureHLSL );
  83. }
  84. MODULE_BEGIN( ShaderGenHLSL )
  85. MODULE_INIT_AFTER( ShaderGen )
  86. MODULE_INIT_AFTER( ShaderGenFeatureMgr )
  87. MODULE_INIT
  88. {
  89. sInitDelegate.bind(_initShaderGenHLSL);
  90. SHADERGEN->registerInitDelegate(Direct3D9, sInitDelegate);
  91. SHADERGEN->registerInitDelegate(Direct3D9_360, sInitDelegate);
  92. }
  93. MODULE_END;