amd_ext_to_khr.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef SOURCE_OPT_AMD_EXT_TO_KHR_H_
  15. #define SOURCE_OPT_AMD_EXT_TO_KHR_H_
  16. #include "source/opt/ir_context.h"
  17. #include "source/opt/module.h"
  18. #include "source/opt/pass.h"
  19. namespace spvtools {
  20. namespace opt {
  21. // Replaces the extensions VK_AMD_shader_ballot, VK_AMD_gcn_shader, and
  22. // VK_AMD_shader_trinary_minmax with equivalent code using core instructions and
  23. // capabilities.
  24. class AmdExtensionToKhrPass : public Pass {
  25. public:
  26. const char* name() const override { return "amd-ext-to-khr"; }
  27. Status Process() override;
  28. IRContext::Analysis GetPreservedAnalyses() override {
  29. return IRContext::kAnalysisInstrToBlockMapping |
  30. IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators |
  31. IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis |
  32. IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisNameMap |
  33. IRContext::kAnalysisScalarEvolution |
  34. IRContext::kAnalysisRegisterPressure |
  35. IRContext::kAnalysisValueNumberTable |
  36. IRContext::kAnalysisStructuredCFG |
  37. IRContext::kAnalysisBuiltinVarId |
  38. IRContext::kAnalysisIdToFuncMapping | IRContext::kAnalysisTypes |
  39. IRContext::kAnalysisDefUse | IRContext::kAnalysisConstants;
  40. }
  41. };
  42. } // namespace opt
  43. } // namespace spvtools
  44. #endif // SOURCE_OPT_AMD_EXT_TO_KHR_H_