Shader: Add function parameters and return handling

This commit is contained in:
Jérôme Leclercq
2021-02-28 17:50:32 +01:00
parent 9a0f201433
commit b320b5b44e
39 changed files with 818 additions and 327 deletions

View File

@@ -8,14 +8,14 @@
#define NAZARA_SPIRVBLOCK_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Shader/SpirvSection.hpp>
#include <Nazara/Shader/SpirvSectionBase.hpp>
#include <Nazara/Shader/SpirvWriter.hpp>
#include <string>
#include <vector>
namespace Nz
{
class NAZARA_SHADER_API SpirvBlock : public SpirvSection
class NAZARA_SHADER_API SpirvBlock : public SpirvSectionBase
{
public:
inline SpirvBlock(SpirvWriter& writer);
@@ -23,13 +23,24 @@ namespace Nz
SpirvBlock(SpirvBlock&&) = default;
~SpirvBlock() = default;
inline std::size_t Append(SpirvOp opcode, const OpSize& wordCount);
template<typename... Args> std::size_t Append(SpirvOp opcode, Args&&... args);
template<typename F> std::size_t AppendVariadic(SpirvOp opcode, F&& callback);
inline UInt32 GetLabelId() const;
inline bool IsTerminated() const;
SpirvBlock& operator=(const SpirvBlock&) = delete;
SpirvBlock& operator=(SpirvBlock&&) = default;
static inline bool IsTerminationInstruction(SpirvOp op);
private:
inline void HandleSpirvOp(SpirvOp op);
UInt32 m_labelId;
bool m_isTerminated;
};
}