interp_fixup_pass.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (c) 2021 The Khronos Group Inc.
  2. // Copyright (c) 2021 Valve Corporation
  3. // Copyright (c) 2021 LunarG Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. #ifndef SOURCE_OPT_INTERP_FIXUP_H
  17. #define SOURCE_OPT_INTERP_FIXUP_H
  18. #include "source/opt/ir_context.h"
  19. #include "source/opt/module.h"
  20. #include "source/opt/pass.h"
  21. namespace spvtools {
  22. namespace opt {
  23. // Replaces overloaded internal form for GLSLstd450Interpolate* instructions
  24. // with external form. Specifically, removes OpLoad from the first argument
  25. // and replaces it with the pointer for the OpLoad. glslang generates the
  26. // internal form. This pass is called as part of glslang HLSL legalization.
  27. class InterpFixupPass : public Pass {
  28. public:
  29. const char* name() const override { return "interp-fixup"; }
  30. Status Process() override;
  31. IRContext::Analysis GetPreservedAnalyses() override {
  32. return IRContext::kAnalysisInstrToBlockMapping |
  33. IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators |
  34. IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis |
  35. IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisNameMap |
  36. IRContext::kAnalysisScalarEvolution |
  37. IRContext::kAnalysisRegisterPressure |
  38. IRContext::kAnalysisValueNumberTable |
  39. IRContext::kAnalysisStructuredCFG |
  40. IRContext::kAnalysisBuiltinVarId |
  41. IRContext::kAnalysisIdToFuncMapping | IRContext::kAnalysisTypes |
  42. IRContext::kAnalysisDefUse | IRContext::kAnalysisConstants;
  43. }
  44. };
  45. } // namespace opt
  46. } // namespace spvtools
  47. #endif // SOURCE_OPT_INTERP_FIXUP_H