From 0ef6e807abc9ac74343568c27de5b500093d4ae8 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Fri, 19 Mar 2021 18:46:11 -0300 Subject: [PATCH] Add DemoteToHelperInvocation support --- include/sirit/sirit.h | 7 +++++-- src/instructions/flow.cpp | 13 +++++++++---- src/instructions/image.cpp | 2 -- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 0c6325d..574a9cc 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -287,13 +287,16 @@ public: std::span labels); /// Returns with no value from a function with void return type. - Id OpReturn(); + void OpReturn(); /// Return a value from a function. Id OpReturnValue(Id value); /// Fragment-shader discard. - Id OpKill(); + void OpKill(); + + /// Demote fragment shader invocation to a helper invocation + void OpDemoteToHelperInvocationEXT(); // Debug diff --git a/src/instructions/flow.cpp b/src/instructions/flow.cpp index 85700d2..31c2ed1 100644 --- a/src/instructions/flow.cpp +++ b/src/instructions/flow.cpp @@ -62,9 +62,9 @@ Id Module::OpSwitch(Id selector, Id default_label, std::span lite return *code << EndOp{}; } -Id Module::OpReturn() { +void Module::OpReturn() { code->Reserve(1); - return *code << spv::Op::OpReturn << EndOp{}; + *code << spv::Op::OpReturn << EndOp{}; } Id Module::OpReturnValue(Id value) { @@ -72,9 +72,14 @@ Id Module::OpReturnValue(Id value) { return *code << spv::Op::OpReturnValue << value << EndOp{}; } -Id Module::OpKill() { +void Module::OpKill() { code->Reserve(1); - return *code << spv::Op::OpKill << EndOp{}; + *code << spv::Op::OpKill << EndOp{}; +} + +void Module::OpDemoteToHelperInvocationEXT() { + code->Reserve(1); + *code << spv::Op::OpDemoteToHelperInvocationEXT << EndOp{}; } } // namespace Sirit diff --git a/src/instructions/image.cpp b/src/instructions/image.cpp index 4c94f5e..e68447f 100644 --- a/src/instructions/image.cpp +++ b/src/instructions/image.cpp @@ -10,8 +10,6 @@ #include "stream.h" -#pragma optimize("", off) - namespace Sirit { #define DEFINE_IMAGE_OP(opcode) \