Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 002aca9

Browse files
authoredFeb 24, 2025
Merge branch 'master' into bugfix/shader-slanggh-5465
2 parents 86d6801 + 51ad07d commit 002aca9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1332
-290
lines changed
 

‎docs/design/stdlib-intrinsics.md

-6
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ Sections of the `expansion` string that are to be replaced are prefixed by the `
114114
* $XH - Ray tracing hit object attribute
115115
* $P - Type-based prefix as used for CUDA and C++ targets (I8 for int8_t, F32 - float etc)
116116

117-
## __specialized_for_target(target)
118-
119-
Specialized for target allows defining an implementation *body* for a particular target. The target is the same as is used for [__target_intrinsic](#target-intrinsic).
120-
121-
A declaration can consist of multiple definitions with bodies (for each target) using, `specialized_for_target`, as well as having `target_intrinsic` if that is applicable for a target.
122-
123117
## __attributeTarget(astClassName)
124118

125119
For an attribute, specifies the AST class (and derived class) the attribute can be applied to.

‎source/core/slang-string.h

+51
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,57 @@ class SLANG_RT_API String
790790
UnownedStringSlice getUnownedSlice() const { return StringRepresentation::asSlice(m_buffer); }
791791
};
792792

793+
class ImmutableHashedString
794+
{
795+
public:
796+
String slice;
797+
HashCode64 hashCode;
798+
ImmutableHashedString()
799+
: hashCode(0)
800+
{
801+
}
802+
ImmutableHashedString(const UnownedStringSlice& slice)
803+
: slice(slice), hashCode(slice.getHashCode())
804+
{
805+
}
806+
ImmutableHashedString(const char* begin, const char* end)
807+
: slice(begin, end), hashCode(slice.getHashCode())
808+
{
809+
}
810+
ImmutableHashedString(const char* begin, size_t len)
811+
: slice(UnownedStringSlice(begin, len)), hashCode(slice.getHashCode())
812+
{
813+
}
814+
ImmutableHashedString(const char* begin)
815+
: slice(begin), hashCode(slice.getHashCode())
816+
{
817+
}
818+
ImmutableHashedString(const String& str)
819+
: slice(str), hashCode(str.getHashCode())
820+
{
821+
}
822+
ImmutableHashedString(String&& str)
823+
: slice(_Move(str)), hashCode(str.getHashCode())
824+
{
825+
}
826+
ImmutableHashedString(const ImmutableHashedString& other) = default;
827+
ImmutableHashedString& operator=(const ImmutableHashedString& other) = default;
828+
bool operator==(const ImmutableHashedString& other) const
829+
{
830+
return hashCode == other.hashCode && slice == other.slice;
831+
}
832+
bool operator!=(const ImmutableHashedString& other) const
833+
{
834+
return hashCode != other.hashCode || slice != other.slice;
835+
}
836+
bool operator==(const UnownedStringSlice& other) const { return slice == other; }
837+
bool operator!=(const UnownedStringSlice& other) const { return slice != other; }
838+
bool operator==(const String& other) const { return slice == other.getUnownedSlice(); }
839+
bool operator!=(const String& other) const { return slice != other.getUnownedSlice(); }
840+
bool operator==(const char* other) const { return slice == UnownedStringSlice(other); }
841+
HashCode64 getHashCode() const { return hashCode; }
842+
};
843+
793844
class SLANG_RT_API StringBuilder : public String
794845
{
795846
private:

0 commit comments

Comments
 (0)
Please sign in to comment.