spirv: Initial bindings support

This commit is contained in:
ReinUsesLisp 2021-02-16 04:10:22 -03:00 committed by ameerj
parent d5d468cf2c
commit b5d7279d87
23 changed files with 679 additions and 300 deletions

View file

@ -11,6 +11,7 @@
#include <boost/intrusive/list.hpp>
#include "common/bit_cast.h"
#include "shader_recompiler/frontend/ir/condition.h"
#include "shader_recompiler/frontend/ir/microinstruction.h"
#include "shader_recompiler/frontend/ir/value.h"
@ -68,6 +69,18 @@ public:
/// Gets an immutable span to the immediate predecessors.
[[nodiscard]] std::span<Block* const> ImmediatePredecessors() const noexcept;
/// Intrusively store the host definition of this instruction.
template <typename DefinitionType>
void SetDefinition(DefinitionType def) {
definition = Common::BitCast<u32>(def);
}
/// Return the intrusively stored host definition of this instruction.
template <typename DefinitionType>
[[nodiscard]] DefinitionType Definition() const noexcept {
return Common::BitCast<DefinitionType>(definition);
}
[[nodiscard]] Condition BranchCondition() const noexcept {
return branch_cond;
}
@ -161,6 +174,9 @@ private:
Block* branch_false{nullptr};
/// Block immediate predecessors
std::vector<Block*> imm_predecessors;
/// Intrusively stored host definition of this block.
u32 definition{};
};
using BlockList = std::vector<Block*>;

View file

@ -9,11 +9,13 @@
#include <boost/container/small_vector.hpp>
#include "shader_recompiler/frontend/ir/function.h"
#include "shader_recompiler/shader_info.h"
namespace Shader::IR {
struct Program {
boost::container::small_vector<Function, 1> functions;
Info info;
};
[[nodiscard]] std::string DumpProgram(const Program& program);