shaderGenHLSLInit.cpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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/depthHLSL.h"
  29. #include "shaderGen/HLSL/debugVizFeatureHLSL.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_IsBC3nm, new NamedFeatureHLSL( "BC3nm" ) );
  45. FEATUREMGR->registerFeature( MFT_IsBC5nm, new NamedFeatureHLSL( "BC5nm" ) );
  46. FEATUREMGR->registerFeature( MFT_TexAnim, new TexAnimHLSL );
  47. FEATUREMGR->registerFeature( MFT_DiffuseMap, new DiffuseMapFeatHLSL );
  48. FEATUREMGR->registerFeature( MFT_OverlayMap, new OverlayTexFeatHLSL );
  49. FEATUREMGR->registerFeature( MFT_DiffuseColor, new DiffuseFeatureHLSL );
  50. FEATUREMGR->registerFeature( MFT_DiffuseVertColor, new DiffuseVertColorFeatureHLSL );
  51. FEATUREMGR->registerFeature( MFT_AlphaTest, new AlphaTestHLSL );
  52. FEATUREMGR->registerFeature( MFT_GlowMask, new GlowMaskHLSL );
  53. FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatHLSL );
  54. FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatHLSL );
  55. FEATUREMGR->registerFeature( MFT_VertLit, new VertLitHLSL );
  56. FEATUREMGR->registerFeature( MFT_Parallax, new ParallaxFeatHLSL );
  57. FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatHLSL );
  58. FEATUREMGR->registerFeature( MFT_DetailNormalMap, new NamedFeatureHLSL( "Detail Normal Map" ) );
  59. FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatHLSL );
  60. FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureHLSL( "Static Cubemap" ) );
  61. FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatHLSL );
  62. FEATUREMGR->registerFeature( MFT_ReflectionProbes, new ReflectionProbeFeatHLSL);
  63. FEATUREMGR->registerFeature( MFT_InvertRoughness, new NamedFeatureHLSL( "Roughest = 1.0" ) );
  64. FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureHLSL( "Translucent" ) );
  65. FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) );
  66. FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatHLSL );
  67. FEATUREMGR->registerFeature( MFT_Fog, new FogFeatHLSL );
  68. FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatHLSL );
  69. FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) );
  70. FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget1 ) );
  71. FEATUREMGR->registerFeature( MFT_RenderTarget2_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget2 ) );
  72. FEATUREMGR->registerFeature( MFT_RenderTarget3_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget3 ) );
  73. FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureHLSL( "Imposter" ) );
  74. FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureHLSL( "Diffuse Map Atlas" ) );
  75. FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureHLSL( "Normal Map Atlas" ) );
  76. FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatHLSL );
  77. FEATUREMGR->registerFeature( MFT_DepthOut, new DepthOutHLSL );
  78. FEATUREMGR->registerFeature( MFT_EyeSpaceDepthOut, new EyeSpaceDepthOutHLSL() );
  79. FEATUREMGR->registerFeature( MFT_HDROut, new HDROutHLSL );
  80. FEATUREMGR->registerFeature( MFT_DebugViz, new DebugVizHLSL);
  81. FEATUREMGR->registerFeature( MFT_ParaboloidVertTransform, new ParaboloidVertTransformHLSL );
  82. FEATUREMGR->registerFeature( MFT_IsSinglePassParaboloid, new NamedFeatureHLSL( "Single Pass Paraboloid" ) );
  83. FEATUREMGR->registerFeature( MFT_UseInstancing, new NamedFeatureHLSL( "Hardware Instancing" ) );
  84. FEATUREMGR->registerFeature( MFT_Foliage, new FoliageFeatureHLSL );
  85. FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureHLSL );
  86. FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureHLSL( "Forward Shaded Material" ) );
  87. FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureHLSL );
  88. FEATUREMGR->registerFeature( MFT_isDeferred, new NamedFeatureHLSL( "Deferred Material" ) );
  89. FEATUREMGR->registerFeature( MFT_OrmMap, new DeferredOrmMapHLSL);
  90. FEATUREMGR->registerFeature( MFT_ORMConfigVars, new ORMConfigVarsHLSL);
  91. FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsHLSL );
  92. FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapHLSL);
  93. FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureHLSL("Background Object"));
  94. FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureHLSL( "skybox" ) );
  95. FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureHLSL );
  96. }
  97. MODULE_BEGIN( ShaderGenHLSL )
  98. MODULE_INIT_AFTER( ShaderGen )
  99. MODULE_INIT_AFTER( ShaderGenFeatureMgr )
  100. MODULE_INIT
  101. {
  102. sInitDelegate.bind(_initShaderGenHLSL);
  103. SHADERGEN->registerInitDelegate(Direct3D11, sInitDelegate);
  104. }
  105. MODULE_END;