summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-08-26 19:07:10 -0400
committerGitHub <noreply@github.com>2024-08-26 19:07:10 -0400
commitf0ba756c2f982aac8095ff0928d048fc97548315 (patch)
treefde40dc0975aff82b4669ff8ce7fca0a3a08f8e2 /source/core
parent6c3261b618b88c2b996e56dea58ba4f5435b0908 (diff)
Fix Varying Variable Location Assignments With Hull Shaders (#4915)
* Fix Varying Variable Location Assignments With Hull Shaders Fixes: #4913 Fixes: #4540 Changes: 1. Added `kIROp_ControlBarrier` to HLSL/GLSL emitting. 2. Added a method to track 'used' and 'unused' varyings for when legalizing GLSL. This allows us to assign correct offsets to automatically added varyings * Added a `ZeroLSB` check to UIntSet for this purpose * add missing return * code comment adjustment * cleanup * comment and HLSL controlBarrier mistake * assume space for glsl/spriv varying is irrelevant
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-uint-set.cpp21
-rw-r--r--source/core/slang-uint-set.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/source/core/slang-uint-set.cpp b/source/core/slang-uint-set.cpp
index ba71254e1..457915449 100644
--- a/source/core/slang-uint-set.cpp
+++ b/source/core/slang-uint-set.cpp
@@ -3,6 +3,27 @@
namespace Slang
{
+Index UIntSet::getLSBZero()
+{
+ uint64_t offset = 0;
+ for (Element& element : this->m_buffer)
+ {
+ // Flip all bits so bitscanForward can find a 0 bit
+ Element flippedElement = ~element;
+
+ // continue if we don't have 0 bits
+ if (flippedElement == 0)
+ {
+ offset += sizeof(Element) * 8;
+ continue;
+ }
+
+ // Get LSBZero of current Block, add with offset
+ return bitscanForward(flippedElement) + offset;
+ }
+ return offset;
+}
+
UIntSet& UIntSet::operator=(UIntSet&& other)
{
m_buffer = _Move(other.m_buffer);
diff --git a/source/core/slang-uint-set.h b/source/core/slang-uint-set.h
index 4ba067871..3531e5cfb 100644
--- a/source/core/slang-uint-set.h
+++ b/source/core/slang-uint-set.h
@@ -133,6 +133,9 @@ public:
/// Returns true if set1 and set2 have a same value set (ie there is an intersection)
static bool hasIntersection(const UIntSet& set1, const UIntSet& set2);
+ /// Get LSB Zero of UIntSet. LSB Zero is the smallest value missing from this UIntSet.
+ Index getLSBZero();
+
struct Iterator
{
friend class UIntSet;