mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2025-12-28 18:26:54 +01:00
Add support for forward declarations
This commit is contained in:
parent
c374bfd9fd
commit
f819ade0ef
2 changed files with 19 additions and 0 deletions
|
|
@ -35,6 +35,10 @@ struct Id {
|
|||
std::uint32_t value;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline bool ValidId(Id id) noexcept {
|
||||
return id.value != 0;
|
||||
}
|
||||
|
||||
class Module {
|
||||
public:
|
||||
explicit Module(std::uint32_t version = spv::Version);
|
||||
|
|
@ -83,6 +87,12 @@ public:
|
|||
AddExecutionMode(entry_point, mode, std::span<const Literal>({literals...}));
|
||||
}
|
||||
|
||||
/// Generate a new id for forward declarations
|
||||
[[nodiscard]] Id ForwardDeclarationId();
|
||||
|
||||
/// Assign a new id and return the old one, useful for defining forward declarations
|
||||
Id ExchangeCurrentId(Id new_current_id);
|
||||
|
||||
/**
|
||||
* Adds an existing label to the code
|
||||
* @param label Label to insert into code.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue