From d7ad93a88864bda94e282e95028f90b5784e4d20 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 23 Nov 2022 17:17:31 -0500 Subject: Add OpDemoteToHelperInvocation, OpTerminateInvocation --- externals/SPIRV-Headers | 2 +- include/sirit/sirit.h | 6 +++++- src/instructions/flow.cpp | 11 ++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/externals/SPIRV-Headers b/externals/SPIRV-Headers index a3fdfe8..c214f6f 160000 --- a/externals/SPIRV-Headers +++ b/externals/SPIRV-Headers @@ -1 +1 @@ -Subproject commit a3fdfe81465d57efc97cfd28ac6c8190fb31a6c8 +Subproject commit c214f6f2d1a7253bb0e9f195c2dc5b0659dc99ef diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index af63d69..6ced1a8 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -309,12 +309,16 @@ public: /// Return a value from a function. Id OpReturnValue(Id value); - /// Fragment-shader discard. + /// Deprecated fragment-shader discard. void OpKill(); /// Demote fragment shader invocation to a helper invocation + void OpDemoteToHelperInvocation(); void OpDemoteToHelperInvocationEXT(); + /// Fragment-shader discard. + void OpTerminateInvocation(); + // Debug /// Assign a name string to a reference. diff --git a/src/instructions/flow.cpp b/src/instructions/flow.cpp index e462dcb..5f6b693 100644 --- a/src/instructions/flow.cpp +++ b/src/instructions/flow.cpp @@ -92,9 +92,18 @@ void Module::OpKill() { *code << spv::Op::OpKill << EndOp{}; } +void Module::OpDemoteToHelperInvocation() { + code->Reserve(1); + *code << spv::Op::OpDemoteToHelperInvocation << EndOp{}; +} + void Module::OpDemoteToHelperInvocationEXT() { + OpDemoteToHelperInvocation(); +} + +void Module::OpTerminateInvocation() { code->Reserve(1); - *code << spv::Op::OpDemoteToHelperInvocationEXT << EndOp{}; + *code << spv::Op::OpTerminateInvocation << EndOp{}; } } // namespace Sirit -- cgit v1.2.3