summaryrefslogtreecommitdiffstats
path: root/source/slang/lower.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-08-16 16:04:09 -0700
committerTim Foley <tfoley@nvidia.com>2017-08-16 16:04:09 -0700
commite30ba2f6b7ad346fa5f2d435a9edc9ba1c56efab (patch)
tree040d49332f125fb7a5450128c98cb9abf21ec035 /source/slang/lower.cpp
parent87c50675941a3ac853a79f50ec0ce3465631fa8f (diff)
Fixups for IR checkpoint
- The changes introduced a new path where we don't even go through the current "lowering" (really an AST-to-AST legalization pass), but this exposed a few issues I didn't anticipate: - First, we needed to make sure to pass in the computed layout information when emitting the original program (since the layout info is no longer automatically attached to AST nodes) - Second, we needed to take the sample-rate input checks that were being done in lowering before, and move them to the emit logic (which is really ugly, but I don't see a way around it for GLSL).
Diffstat (limited to 'source/slang/lower.cpp')
-rw-r--r--source/slang/lower.cpp39
1 files changed, 0 insertions, 39 deletions
diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp
index 2c62a69a8..7a12fc3b7 100644
--- a/source/slang/lower.cpp
+++ b/source/slang/lower.cpp
@@ -886,8 +886,6 @@ struct LoweringVisitor
LoweredExpr visitVarExpr(
VarExpr* expr)
{
- doSampleRateInputCheck(expr->name);
-
// If the expression didn't get resolved, we can leave it as-is
if (!expr->declRef)
return expr;
@@ -2206,14 +2204,6 @@ struct LoweringVisitor
RefPtr<UnparsedStmt> loweredStmt = new UnparsedStmt();
lowerStmtFields(loweredStmt, stmt);
- for (auto token : stmt->tokens)
- {
- if (token.type == TokenType::Identifier)
- {
- doSampleRateInputCheck(token.getName());
- }
- }
-
loweredStmt->tokens = stmt->tokens;
addStmt(loweredStmt);
@@ -3369,28 +3359,6 @@ struct LoweringVisitor
return SourceLanguage::Unknown;
}
- void setSampleRateFlag()
- {
- shared->entryPointLayout->flags |= EntryPointLayout::Flag::usesAnySampleRateInput;
- }
-
- void doSampleRateInputCheck(VarDeclBase* decl)
- {
- if (decl->HasModifier<HLSLSampleModifier>())
- {
- setSampleRateFlag();
- }
- }
-
- void doSampleRateInputCheck(Name* name)
- {
- auto text = getText(name);
- if (text == "gl_SampleIndex")
- {
- setSampleRateFlag();
- }
- }
-
AggTypeDecl* isStructType(RefPtr<Type> type)
{
if (type->As<BasicExpressionType>()) return nullptr;
@@ -3440,14 +3408,8 @@ struct LoweringVisitor
LoweredDecl visitVariable(
Variable* decl)
{
- // Global variable? Check if it is a sample-rate input.
if (dynamic_cast<ModuleDecl*>(decl->ParentDecl))
{
- if (decl->HasModifier<InModifier>())
- {
- doSampleRateInputCheck(decl);
- }
-
auto varLayout = tryToFindLayout(decl);
if (varLayout)
{
@@ -3902,7 +3864,6 @@ struct LoweringVisitor
}
else if (ns == "sv_sampleindex")
{
- setSampleRateFlag();
globalVarExpr = createGLSLBuiltinRef("gl_SampleID", getIntType());
}
else if (ns == "sv_stencilref")