2021년 4학년 1학기 기업연계프로젝트2 컴퓨터소프트웨어공학과 <원광투어팀> 팀장 : 송유진 팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.1 KiB

5 years ago
  1. using System.Collections.Generic;
  2. using UnityEditor;
  3. using UnityEditor.Build;
  4. using UnityEditor.Rendering;
  5. using UnityEngine;
  6. using UnityEngine.Rendering;
  7. namespace Unity.FPS.EditorExt
  8. {
  9. // Simple example of stripping of a debug build configuration
  10. class ShaderBuildStripping : IPreprocessShaders
  11. {
  12. List<ShaderKeyword> m_ExcludedKeywords;
  13. public ShaderBuildStripping()
  14. {
  15. #if MANUAL_SHADER_STRIPPING
  16. m_ExcludedKeywords = new List<ShaderKeyword>
  17. {
  18. new ShaderKeyword("DEBUG"),
  19. // ifdef
  20. new ShaderKeyword("UNITY_GATHER_SUPPORTED"),
  21. new ShaderKeyword("UNITY_POSTFX_SSR"),
  22. new ShaderKeyword("DISTORT"),
  23. new ShaderKeyword("BLUR_HIGH_QUALITY"),
  24. new ShaderKeyword("UNITY_CAN_COMPILE_TESSELLATION"),
  25. new ShaderKeyword("ENABLE_WIND"),
  26. new ShaderKeyword("WIND_EFFECT_FROND_RIPPLE_ADJUST_LIGHTING"),
  27. new ShaderKeyword("LOD_FADE_CROSSFADE"),
  28. new ShaderKeyword("DYNAMICLIGHTMAP_ON"),
  29. new ShaderKeyword("EDITOR_VISUALIZATION"),
  30. new ShaderKeyword("UNITY_INSTANCING_ENABLED"),
  31. new ShaderKeyword("STEREO_MULTIVIEW_ON"),
  32. new ShaderKeyword("STEREO_INSTANCING_ON"),
  33. new ShaderKeyword("SOFTPARTICLES_ON"),
  34. new ShaderKeyword("PIXELSNAP_ON"),
  35. new ShaderKeyword("SHADER_API_D3D11"),
  36. // if defined()
  37. new ShaderKeyword("SHADER_API_VULKAN"),
  38. new ShaderKeyword("UNITY_SINGLE_PASS_STEREO"),
  39. new ShaderKeyword("FOG_LINEAR"),
  40. new ShaderKeyword("FOG_EXP"),
  41. new ShaderKeyword("FOG_EXP2"),
  42. new ShaderKeyword("UNITY_PASS_DEFERRED"),
  43. new ShaderKeyword("LIGHTMAP_ON"),
  44. new ShaderKeyword("_PARALLAXMAP"),
  45. new ShaderKeyword("SHADOWS_SCREEN"),
  46. };
  47. #endif
  48. }
  49. // Multiple callback may be implemented.
  50. // The first one executed is the one where callbackOrder is returning the smallest number.
  51. public int callbackOrder
  52. {
  53. get { return 0; }
  54. }
  55. public void OnProcessShader(
  56. Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> shaderCompilerData)
  57. {
  58. #if MANUAL_SHADER_STRIPPING
  59. // In development, don't strip debug variants
  60. if (EditorUserBuildSettings.development)
  61. return;
  62. for (int i = 0; i < shaderCompilerData.Count; ++i)
  63. {
  64. bool mustStrip = false;
  65. foreach (var kw in m_ExcludedKeywords)
  66. {
  67. if (shaderCompilerData[i].shaderKeywordSet.IsEnabled(kw))
  68. {
  69. mustStrip = true;
  70. break;
  71. }
  72. }
  73. if (mustStrip)
  74. {
  75. shaderCompilerData.RemoveAt(i);
  76. --i;
  77. }
  78. }
  79. #endif
  80. }
  81. }
  82. }