From da093a04fe7cdf41b608cf4563fcc727c64d2749 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Mon, 12 Apr 2021 03:55:25 -0300 Subject: [PATCH] Add OpEmitStreamVertex and OpEndStreamPrimitive --- include/sirit/sirit.h | 13 ++++++++++--- src/instructions/misc.cpp | 18 ++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 2eae6ab..c80555f 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -8,11 +8,11 @@ #include #include +#include #include #include #include #include -#include #include #include #include @@ -422,10 +422,17 @@ public: Id OpUndef(Id result_type); /// Emits the current values of all output variables to the current output primitive. - Id OpEmitVertex(); + void OpEmitVertex(); /// Finish the current primitive and start a new one. No vertex is emitted. - Id OpEndPrimitive(); + void OpEndPrimitive(); + + /// Emits the current values of all output variables to the current output primitive. After + /// execution, the values of all output variables are undefined. + void OpEmitStreamVertex(Id stream); + + /// Finish the current primitive and start a new one. No vertex is emitted. + void OpEndStreamPrimitive(Id stream); // Barrier diff --git a/src/instructions/misc.cpp b/src/instructions/misc.cpp index 2f3b07d..6785346 100644 --- a/src/instructions/misc.cpp +++ b/src/instructions/misc.cpp @@ -15,14 +15,24 @@ Id Module::OpUndef(Id result_type) { return *code << OpId{spv::Op::OpUndef, result_type} << EndOp{}; } -Id Module::OpEmitVertex() { +void Module::OpEmitVertex() { code->Reserve(1); - return *code << OpId{spv::Op::OpEmitVertex} << EndOp{}; + *code << spv::Op::OpEmitVertex << EndOp{}; } -Id Module::OpEndPrimitive() { +void Module::OpEndPrimitive() { code->Reserve(1); - return *code << OpId{spv::Op::OpEndPrimitive} << EndOp{}; + *code << spv::Op::OpEndPrimitive << EndOp{}; +} + +void Module::OpEmitStreamVertex(Id stream) { + code->Reserve(2); + *code << spv::Op::OpEmitStreamVertex << stream << EndOp{}; +} + +void Module::OpEndStreamPrimitive(Id stream) { + code->Reserve(2); + *code << spv::Op::OpEndStreamPrimitive << stream << EndOp{}; } } // namespace Sirit