summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-12-15 23:41:27 +0800
committerGitHub <noreply@github.com>2023-12-15 23:41:27 +0800
commit21d17abb0e511806b7c93effc58f37169d837766 (patch)
treea39b8bc015d5f0a5e6fd12b6a31a92f162aaad44 /source/slang/slang-check-decl.cpp
parent34f04a4670f86e64d4b35ce720281a6f0e72f733 (diff)
GLSL SSBO Support (#3400)
* Squash warnings and fix build with SLANG_EMBED_STDLIB * Add GLSLShaderStorageBuffer magic wrapper * Make GLSLSSBO not a uniform type * Buffers are global variables * Allow creating ssbo aggregate types * Allow reading from RWSB using builder * Nicer debug printing for ssbos * Lower SSBO to RWSB * Parse interface blocks into wrapped structs * Lower Interface Block Decls to structs * remove comment * Two simple ssbo tests * Move ssbo pass earlier * Correct mutable buffer detection * Do not replace ssbo usages outside of blocks * Treat GLSLSSBO as a mutable buffer for type layouts * regenerate vs projects * Correctly detect ssbo types * Diagnose illegal ssbo * remove unreachable code * neaten * ci wobble * Make GLSLSSBO ast handling more uniform * Add modifier cases for glsl * Use empty val info for unhandled interface blocks necessary for ./tests/glsl/out-binding-redeclaration.slang * more sophisticated modifier check * Correct ssbo wrapper name
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 75aed010d..0df9619b6 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -1253,7 +1253,8 @@ namespace Slang
// without any `uniform` modifiers as true global variables by default.
if (!varDecl->findModifier<HLSLUniformModifier>() &&
!varDecl->findModifier<InModifier>() &&
- !varDecl->findModifier<OutModifier>())
+ !varDecl->findModifier<OutModifier>() &&
+ !varDecl->findModifier<GLSLBufferModifier>())
{
if (!as<ResourceType>(varDecl->type) && !as<PointerLikeType>(varDecl->type))
{
@@ -1584,7 +1585,7 @@ namespace Slang
addModifier(aggTypeDecl, m_astBuilder->create<SynthesizedModifier>());
// The visibility of synthesized decl should be the min of the parent decl and the requirement.
- if (auto visModifier = requirementDeclRef.getDecl()->findModifier<VisibilityModifier>())
+ if (requirementDeclRef.getDecl()->findModifier<VisibilityModifier>())
{
auto requirementVisibility = getDeclVisibility(requirementDeclRef.getDecl());
auto thisVisibility = getDeclVisibility(context->parentDecl);
@@ -1833,7 +1834,7 @@ namespace Slang
if (moduleDecl->members.getCount() > 0)
{
auto firstMember = moduleDecl->members[0];
- if (auto implDecl = as<ImplementingDecl>(firstMember))
+ if (as<ImplementingDecl>(firstMember))
{
if (!getShared()->isInLanguageServer())
{
@@ -2993,7 +2994,7 @@ namespace Slang
addModifier(synFuncDecl, attr);
}
// The visibility of synthesized decl should be the min of the parent decl and the requirement.
- if (auto visModifier = requiredMemberDeclRef.getDecl()->findModifier<VisibilityModifier>())
+ if (requiredMemberDeclRef.getDecl()->findModifier<VisibilityModifier>())
{
auto requirementVisibility = getDeclVisibility(requiredMemberDeclRef.getDecl());
auto thisVisibility = getDeclVisibility(context->parentDecl);
@@ -3539,7 +3540,7 @@ namespace Slang
synPropertyDecl->parentDecl = context->parentDecl;
// The visibility of synthesized decl should be the min of the parent decl and the requirement.
- if (auto visModifier = requiredMemberDeclRef.getDecl()->findModifier<VisibilityModifier>())
+ if (requiredMemberDeclRef.getDecl()->findModifier<VisibilityModifier>())
{
auto requirementVisibility = getDeclVisibility(requiredMemberDeclRef.getDecl());
auto thisVisibility = getDeclVisibility(context->parentDecl);
@@ -7049,11 +7050,11 @@ namespace Slang
}
auto firstMember = fileDecl->members[0];
- if (auto moduleDeclaration = as<ModuleDeclarationDecl>(firstMember))
+ if (as<ModuleDeclarationDecl>(firstMember))
{
// We are trying to implement a file that defines a module, this is expected.
}
- else if (auto implementing = as<ImplementingDecl>(firstMember))
+ else if (as<ImplementingDecl>(firstMember))
{
getSink()->diagnose(decl->moduleNameAndLoc.loc, Diagnostics::implementingMustReferencePrimaryModuleFile);
return;