Add OpEmitStreamVertex and OpEndStreamPrimitive

This commit is contained in:
ReinUsesLisp 2021-04-12 03:55:25 -03:00
parent dc47faf89f
commit da093a04fe
2 changed files with 24 additions and 7 deletions

View file

@ -8,11 +8,11 @@
#include <array>
#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <functional>
#include <string_view>
#include <type_traits>
#include <unordered_set>
@ -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

View file

@ -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