diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2025-10-01 14:14:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-01 14:14:05 -0700 |
| commit | cd7da79f50f2b8fb9bca797131585ff1b85698f6 (patch) | |
| tree | a3d5baecee6aa207b7b950aedc464eaa8585b60e /source/slang/slang-check-decl.cpp | |
| parent | a43ac0053eb49fde3329cc7fdc7f60f45e502704 (diff) | |
Fix incorrect binding index assignment for StructuredBuffer and ByteAddressBuffer with DescriptorHandle (#8252)
- [x] Fix segmentation fault in wrapConstantBufferElement for
DescriptorHandle types
- [x] Split DescriptorKind.Buffer into ConstantBuffer and StorageBuffer
- [x] Update binding enums with descriptive names (ConstantBuffer_Read,
StorageBuffer_Read, etc.)
- [x] Update resource type mappings for correct binding assignments
- [x] Update template logic to handle ConstantBuffer and StorageBuffer
kinds separately
- [x] Update tests to reflect correct binding assignments
- [x] Split DescriptorKind.TexelBuffer into UniformTexelBuffer and
StorageTexelBuffer
- [x] Update TextureBuffer<T> to use UniformTexelBuffer kind
- [x] Update _Texture extension to determine texel buffer kind based on
access mode
- [x] Update test desc-handle-1.slang to handle new DescriptorKind enum
cases
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/shader-slang/slang/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 77a799f1c..6f2b01aa1 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -8992,6 +8992,7 @@ void SemanticsDeclBodyVisitor::visitEnumDecl(EnumDecl* decl) tryConstantFoldExpr(explicitTagValExpr, ConstantFoldingKind::CompileTime, nullptr); if (explicitTagVal) { + caseDecl->tagVal = explicitTagVal; if (auto constIntVal = as<ConstantIntVal>(explicitTagVal)) { defaultTag = constIntVal->getValue(); @@ -9005,8 +9006,10 @@ void SemanticsDeclBodyVisitor::visitEnumDecl(EnumDecl* decl) else { // If this happens, then the explicit tag value expression - // doesn't seem to be a constant after all. In this case - // we expect the checking logic to have applied already. + // doesn't seem to be a constant after all. + getSink()->diagnose( + explicitTagValExpr, + Diagnostics::expectedIntegerConstantNotConstant); } } else @@ -9017,8 +9020,8 @@ void SemanticsDeclBodyVisitor::visitEnumDecl(EnumDecl* decl) tagValExpr->loc = caseDecl->loc; tagValExpr->type = QualType(tagType); tagValExpr->value = defaultTag; - caseDecl->tagExpr = tagValExpr; + caseDecl->tagVal = m_astBuilder->getIntVal(enumType, defaultTag); } // Default tag for the next case will be one more than @@ -9058,15 +9061,9 @@ void SemanticsDeclBodyVisitor::visitEnumCaseDecl(EnumCaseDecl* decl) if (auto initExpr = decl->tagExpr) { initExpr = CheckTerm(initExpr); - initExpr = coerce(CoercionSite::General, tagType, initExpr, getSink()); - // We want to enforce that this is an integer constant - // expression. - decl->tagVal = CheckIntegerConstantExpression( - initExpr, - IntegerConstantExpressionCoercionType::AnyInteger, - nullptr, - ConstantFoldingKind::CompileTime); + if (initExpr->type != decl->type.type) + initExpr = coerce(CoercionSite::General, tagType, initExpr, getSink()); decl->tagExpr = initExpr; } |
