shaderGenHLSLInit.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. // Deferred Shading
  34. #include "lighting/advanced/hlsl/deferredShadingFeaturesHLSL.h"
  35. #include "shaderGen/HLSL/accuFeatureHLSL.h"
  36. static ShaderGen::ShaderGenInitDelegate sInitDelegate;
  37. void _initShaderGenHLSL( ShaderGen *shaderGen )
  38. {
  39. shaderGen->setPrinter( new ShaderGenPrinterHLSL );
  40. shaderGen->setComponentFactory( new ShaderGenComponentFactoryHLSL );
  41. shaderGen->setFileEnding( "hlsl" );
  42. FEATUREMGR->registerFeature( MFT_VertTransform, new VertPositionHLSL );
  43. FEATUREMGR->registerFeature( MFT_RTLighting, new RTLightingFeatHLSL );
  44. FEATUREMGR->registerFeature( MFT_IsDXTnm, new NamedFeatureHLSL( "DXTnm" ) );
  45. FEATUREMGR->registerFeature( MFT_TexAnim, new TexAnimHLSL );
  46. FEATUREMGR->registerFeature( MFT_DiffuseMap, new DiffuseMapFeatHLSL );
  47. FEATUREMGR->registerFeature( MFT_OverlayMap, new OverlayTexFeatHLSL );
  48. FEATUREMGR->registerFeature( MFT_DiffuseColor, new DiffuseFeatureHLSL );
  49. FEATUREMGR->registerFeature( MFT_DiffuseVertColor, new DiffuseVertColorFeatureHLSL );
  50. FEATUREMGR->registerFeature( MFT_AlphaTest, new AlphaTestHLSL );
  51. FEATUREMGR->registerFeature( MFT_GlowMask, new GlowMaskHLSL );
  52. FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatHLSL );
  53. FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatHLSL );
  54. FEATUREMGR->registerFeature( MFT_VertLit, new VertLitHLSL );
  55. FEATUREMGR->registerFeature( MFT_Parallax, new ParallaxFeatHLSL );
  56. FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatHLSL );
  57. FEATUREMGR->registerFeature( MFT_DetailNormalMap, new NamedFeatureHLSL( "Detail Normal Map" ) );
  58. FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatHLSL );
  59. FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatHLSL );
  60. FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularHLSL );
  61. FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureHLSL( "Translucent" ) );
  62. FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) );
  63. FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatHLSL );
  64. FEATUREMGR->registerFeature( MFT_Fog, new FogFeatHLSL );
  65. FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapHLSL );
  66. FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatHLSL );
  67. FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureHLSL( "Gloss Map" ) );
  68. FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) );
  69. FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget1 ) );
  70. FEATUREMGR->registerFeature( MFT_RenderTarget2_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget2 ) );
  71. FEATUREMGR->registerFeature( MFT_RenderTarget3_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget3 ) );
  72. FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureHLSL( "Imposter" ) );
  73. FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureHLSL( "Diffuse Map Atlas" ) );
  74. FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureHLSL( "Normal Map Atlas" ) );
  75. FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatHLSL );
  76. FEATUREMGR->registerFeature( MFT_DepthOut, new DepthOutHLSL );
  77. FEATUREMGR->registerFeature( MFT_EyeSpaceDepthOut, new EyeSpaceDepthOutHLSL() );
  78. FEATUREMGR->registerFeature( MFT_HDROut, new HDROutHLSL );
  79. FEATUREMGR->registerFeature( MFT_ParaboloidVertTransform, new ParaboloidVertTransformHLSL );
  80. FEATUREMGR->registerFeature( MFT_IsSinglePassParaboloid, new NamedFeatureHLSL( "Single Pass Paraboloid" ) );
  81. FEATUREMGR->registerFeature( MFT_UseInstancing, new NamedFeatureHLSL( "Hardware Instancing" ) );
  82. FEATUREMGR->registerFeature( MFT_Foliage, new FoliageFeatureHLSL );
  83. FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureHLSL );
  84. FEATUREMGR->registerFeature( MFT_InterlacedDeferred, new NamedFeatureHLSL( "Interlaced Pre Pass" ) );
  85. FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureHLSL( "Forward Shaded Material" ) );
  86. FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureHLSL );
  87. FEATUREMGR->registerFeature( MFT_isDeferred, new NamedFeatureHLSL( "Deferred Material" ) );
  88. FEATUREMGR->registerFeature( MFT_DeferredSpecMap, new DeferredSpecMapHLSL );
  89. FEATUREMGR->registerFeature( MFT_DeferredSpecVars, new DeferredSpecVarsHLSL );
  90. FEATUREMGR->registerFeature( MFT_DeferredMatInfoFlags, new DeferredMatInfoFlagsHLSL );
  91. FEATUREMGR->registerFeature( MFT_DeferredEmptySpec, new DeferredEmptySpecHLSL );
  92. FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureHLSL( "skybox" ) );
  93. FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureHLSL );
  94. }
  95. MODULE_BEGIN( ShaderGenHLSL )
  96. MODULE_INIT_AFTER( ShaderGen )
  97. MODULE_INIT_AFTER( ShaderGenFeatureMgr )
  98. MODULE_INIT
  99. {
  100. sInitDelegate.bind(_initShaderGenHLSL);
  101. SHADERGEN->registerInitDelegate(Direct3D11, sInitDelegate);
  102. }
  103. MODULE_END;