From 8c281cc0b7cd638d3853a5aa2fc35b969fcbb599 Mon Sep 17 00:00:00 2001 From: raphaelthegreat <47210458+raphaelthegreat@users.noreply.github.com> Date: Thu, 30 May 2024 01:08:20 +0300 Subject: [PATCH] stream: Revert vector grow step --- include/sirit/sirit.h | 8 ++++++++ src/instructions/extension.cpp | 2 ++ src/stream.h | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 13e7dae..a857352 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -799,6 +799,10 @@ public: /// integers. Id OpSMin(Id result_type, Id x, Id y); + /// Result is y if y < x, either x or y if both x and y are zeros, otherwise x. If one operand is a NaN, the other + /// operand is the result. If both operands are NaN, the result is a NaN. + Id OpNMin(Id result_type, Id x, Id y); + /// Result is y if x < y; otherwise result is x. Which operand is the result is undefined if one /// of the operands is a NaN. Id OpFMax(Id result_type, Id x, Id y); @@ -811,6 +815,10 @@ public: /// integers. Id OpSMax(Id result_type, Id x, Id y); + /// Result is y if x < y, either x or y if both x and y are zeros, otherwise x. If one operand is a NaN, the other + /// operand is the result. If both operands are NaN, the result is a NaN. + Id OpNMax(Id result_type, Id x, Id y); + /// Result is min(max(x, minVal), maxVal). Result is undefined if minVal > maxVal.The semantics /// used by min() and max() are those of FMin and FMax. Id OpFClamp(Id result_type, Id x, Id min_val, Id max_val); diff --git a/src/instructions/extension.cpp b/src/instructions/extension.cpp index 005c189..bd61caa 100644 --- a/src/instructions/extension.cpp +++ b/src/instructions/extension.cpp @@ -57,9 +57,11 @@ DEFINE_UNARY(OpInverseSqrt, GLSLstd450InverseSqrt) DEFINE_BINARY(OpFMin, GLSLstd450FMin) DEFINE_BINARY(OpUMin, GLSLstd450UMin) DEFINE_BINARY(OpSMin, GLSLstd450SMin) +DEFINE_BINARY(OpNMin, GLSLstd450NMin) DEFINE_BINARY(OpFMax, GLSLstd450FMax) DEFINE_BINARY(OpUMax, GLSLstd450UMax) DEFINE_BINARY(OpSMax, GLSLstd450SMax) +DEFINE_BINARY(OpNMax, GLSLstd450NMax) DEFINE_TRINARY(OpFClamp, GLSLstd450FClamp) DEFINE_TRINARY(OpUClamp, GLSLstd450UClamp) DEFINE_TRINARY(OpSClamp, GLSLstd450SClamp) diff --git a/src/stream.h b/src/stream.h index 6420d23..6cad9e8 100644 --- a/src/stream.h +++ b/src/stream.h @@ -71,7 +71,7 @@ public: if (insert_index + num_words <= words.size()) { return; } - words.resize(insert_index + GROW_STEP); + words.resize(insert_index + num_words); } std::span Words() const noexcept { @@ -156,7 +156,9 @@ public: } Stream& operator<<(Id value) { - assert(value.value != 0); + if (value.value == 0) { + std::abort(); + } return *this << value.value; }