mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-21 19:43:34 +00:00
shader: Initial instruction support
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <span>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/intrusive/list.hpp>
|
||||
@@ -23,7 +25,7 @@ constexpr size_t MAX_ARG_COUNT = 4;
|
||||
|
||||
class Inst : public boost::intrusive::list_base_hook<> {
|
||||
public:
|
||||
explicit Inst(Opcode op_) noexcept : op(op_) {}
|
||||
explicit Inst(Opcode op_, u64 flags_) noexcept : op{op_}, flags{flags_} {}
|
||||
|
||||
/// Get the number of uses this instruction has.
|
||||
[[nodiscard]] int UseCount() const noexcept {
|
||||
@@ -73,6 +75,14 @@ public:
|
||||
|
||||
void ReplaceUsesWith(Value replacement);
|
||||
|
||||
template <typename FlagsType>
|
||||
requires(sizeof(FlagsType) <= sizeof(u64) && std::is_trivially_copyable_v<FlagsType>)
|
||||
[[nodiscard]] FlagsType Flags() const noexcept {
|
||||
FlagsType ret;
|
||||
std::memcpy(&ret, &flags, sizeof(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
void Use(const Value& value);
|
||||
void UndoUse(const Value& value);
|
||||
|
||||
Reference in New Issue
Block a user