recompiler.cpp 1.0 KB

12345678910111213141516171819202122232425262728
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <vector>
  5. #include "common/common_types.h"
  6. #include "shader_recompiler/backend/spirv/emit_spirv.h"
  7. #include "shader_recompiler/environment.h"
  8. #include "shader_recompiler/frontend/maxwell/control_flow.h"
  9. #include "shader_recompiler/frontend/maxwell/program.h"
  10. #include "shader_recompiler/object_pool.h"
  11. #include "shader_recompiler/recompiler.h"
  12. namespace Shader {
  13. std::pair<Info, std::vector<u32>> RecompileSPIRV(const Profile& profile, Environment& env,
  14. u32 start_address) {
  15. ObjectPool<Maxwell::Flow::Block> flow_block_pool;
  16. ObjectPool<IR::Inst> inst_pool;
  17. ObjectPool<IR::Block> block_pool;
  18. Maxwell::Flow::CFG cfg{env, flow_block_pool, start_address};
  19. IR::Program program{Maxwell::TranslateProgram(inst_pool, block_pool, env, cfg)};
  20. return {std::move(program.info), Backend::SPIRV::EmitSPIRV(profile, env, program)};
  21. }
  22. } // namespace Shader