From e30ba2f6b7ad346fa5f2d435a9edc9ba1c56efab Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 16 Aug 2017 16:04:09 -0700 Subject: 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). --- source/slang/lower.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'source/slang/lower.cpp') 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 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()) - { - setSampleRateFlag(); - } - } - - void doSampleRateInputCheck(Name* name) - { - auto text = getText(name); - if (text == "gl_SampleIndex") - { - setSampleRateFlag(); - } - } - AggTypeDecl* isStructType(RefPtr type) { if (type->As()) 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(decl->ParentDecl)) { - if (decl->HasModifier()) - { - 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") -- cgit v1.2.3