diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-02-02 08:49:04 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-02 08:49:04 -0800 |
| commit | 0360f81b9741ece65768a65731bd23455a3b7a96 (patch) | |
| tree | eab15cf6737cf091bf94d073e82c7b233f958e57 | |
| parent | b034398ab12d3cc3a5fc04174688cb707404791d (diff) | |
Remove support for the -no-checking flag (#392)
* Remove support for the -no-checking flag
Fixes #381
Fixes #383
Work on #382
- No longer expose flag through API (`SLANG_COMPILE_FLAG_NO_CHECKING`) and command-line (`-no-checking`) options
- Remove all logic in `check.cpp` that was withholding diagnostics (including errors) when the no-checking mode was enabled
- Remove `HiddenImplicitCastExpr`, which was only created to support no-checking mode (it represented an implicit cast that our checking through was needed, but couldn't emit because it might be wrong)
- Remove logic for storing function bodies as raw token lists when checking is turned off. I'm leaving in the `UnparsedStmt` AST node in case we ever need/want to lazily parse and check function bodies down the line.
- Remove a few of the code-generation paths we had to contend with, but keep the comment about them in place.
- Remove GLSL-based tests that can't meaningfully work with the new approach.
- Fix other tests that used a GLSL baseline so that their GLSL compiles with `-pass-through glslang` instead of invoking `slang` with the `-no-checking` flag.
- Remove tests that were explicitly added to test the "rewriter + IR" path, since that is no longer supported.
There is more cleanup that can be done here, now that we know that AST-based rewrite and IR will never co-exist, but it is probably easier to deal with that as part of removing the AST-based rewrite path.
We've lost some test coverage here, but actually not too much if we consider that we are dropping GLSL input anyway.
* Fixup: test runner was mis-counting ignored tests
* Fixup: turn on dumping on test failure under Travis
* Fixup: enable extensions in Linux build of glslang
275 files changed, 176 insertions, 9983 deletions
@@ -161,7 +161,7 @@ $(SLANGC): $(SLANGC_SOURCES) $(SLANGC_HEADERS) $(SLANG) $(CXX) $(LDFLAGS) -o $@ $(CFLAGS) $(SLANGC_SOURCES) -ldl $(RELATIVE_RPATH_INCANTATION) -lslang $(SLANG_GLSLANG): $(SLANG_GLSLANG_SOURCES) $(SLANG_GLSLANG_HEADERS) - $(CXX) $(SHARED_LIB_LDFLAGS) -pthread -o $@ -Iexternal/glslang/ $(SHARED_LIB_CFLAGS) $(SLANG_GLSLANG_SOURCES) + $(CXX) $(SHARED_LIB_LDFLAGS) -pthread -o $@ -Iexternal/glslang/ $(SHARED_LIB_CFLAGS) -DAMD_EXTENSIONS -DNV_EXTENSIONS $(SLANG_GLSLANG_SOURCES) $(SLANG_TEST): $(SLANG_TEST_SOURCES) $(SLANG_TEST_HEADERS) $(SLANG) $(CXX) $(LDFLAGS) -o $@ $(CFLAGS) $(SLANG_TEST_SOURCES) -ldl $(RELATIVE_RPATH_INCANTATION) -lslang @@ -176,7 +176,7 @@ $(OUTPUTDIR): mkdir -p $(OUTPUTDIR) test: $(SLANG_TEST) $(SLANG_EVAL_TEST) $(SLANG_REFLECTION_TEST) - $(SLANG_TEST) -bindir $(OUTPUTDIR) -category $(SLANG_TEST_CATEGORY) $(SLANG_TEST_FLAGS) + $(SLANG_TEST) -bindir $(OUTPUTDIR) -travis -category $(SLANG_TEST_CATEGORY) $(SLANG_TEST_FLAGS) clean: rm -rf $(OUTPUTDIR) @@ -123,7 +123,7 @@ extern "C" enum { /** Disable semantic checking as much as possible. */ - SLANG_COMPILE_FLAG_NO_CHECKING = 1 << 0, +// SLANG_COMPILE_FLAG_NO_CHECKING = 1 << 0, /* Split apart types that contain a mix of resource and non-resource data */ SLANG_COMPILE_FLAG_SPLIT_MIXED_TYPES = 1 << 1, diff --git a/source/slang/ast-legalize.cpp b/source/slang/ast-legalize.cpp index 5df6b80f5..be0603d0b 100644 --- a/source/slang/ast-legalize.cpp +++ b/source/slang/ast-legalize.cpp @@ -1947,29 +1947,6 @@ struct LoweringVisitor return LegalExpr(lowerCallExpr(loweredExpr, expr)); } - LegalExpr visitHiddenImplicitCastExpr( - HiddenImplicitCastExpr* expr) - { - LegalExpr legalArg = legalizeExpr(expr->Arguments[0]); - if(legalArg.getFlavor() == LegalExpr::Flavor::simple) - { - InvokeExpr* loweredExpr = (InvokeExpr*) expr->getClass().createInstance(); - lowerExprCommon(loweredExpr, expr); - loweredExpr->FunctionExpr = legalizeSimpleExpr(expr->FunctionExpr); - addArg(loweredExpr, legalArg.getSimple()); - return LegalExpr(loweredExpr); - } - else - { - // If we hit this case, then there seems to have been a type-checking - // error around a type that needed to be desugared. We want to use - // the original expression rather than hide it behind a cast, because - // it might need to be unpacked into multiple arguments for a call, etc. - // - return legalArg; - } - } - LegalExpr visitSelectExpr( SelectExpr* expr) { diff --git a/source/slang/check.cpp b/source/slang/check.cpp index ea7f1be2a..d26c5693f 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -361,15 +361,12 @@ namespace Slang if (lookupResult.isOverloaded()) { // We had an ambiguity anyway, so report it. - if (!isRewriteMode()) - { - getSink()->diagnose(overloadedExpr, Diagnostics::ambiguousReference, lookupResult.items[0].declRef.GetName()); + getSink()->diagnose(overloadedExpr, Diagnostics::ambiguousReference, lookupResult.items[0].declRef.GetName()); - for(auto item : lookupResult.items) - { - String declString = getDeclSignatureString(item); - getSink()->diagnose(item.declRef, Diagnostics::overloadCandidate, declString); - } + for(auto item : lookupResult.items) + { + String declString = getDeclSignatureString(item); + getSink()->diagnose(item.declRef, Diagnostics::overloadCandidate, declString); } // TODO(tfoley): should we construct a new ErrorExpr here? @@ -396,10 +393,7 @@ namespace Slang return expr; } - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::unimplemented, "expected a type"); - } + getSink()->diagnose(expr, Diagnostics::unimplemented, "expected a type"); return CreateErrorExpr(expr); } @@ -585,10 +579,7 @@ namespace Slang { if (diagSink) { - if (!isRewriteMode()) - { - diagSink->diagnose(typeExp.exp.Ptr(), Diagnostics::unimplemented, "can't fill in default for generic type parameter"); - } + diagSink->diagnose(typeExp.exp.Ptr(), Diagnostics::unimplemented, "can't fill in default for generic type parameter"); *outProperType = getSession()->getErrorType(); } return false; @@ -604,10 +595,7 @@ namespace Slang { if (diagSink) { - if (!isRewriteMode()) - { - diagSink->diagnose(typeExp.exp.Ptr(), Diagnostics::unimplemented, "can't fill in default for generic type parameter"); - } + diagSink->diagnose(typeExp.exp.Ptr(), Diagnostics::unimplemented, "can't fill in default for generic type parameter"); *outProperType = getSession()->getErrorType(); } return false; @@ -681,10 +669,7 @@ namespace Slang if (basicType->baseType == BaseType::Void) { // TODO(tfoley): pick the right diagnostic message - if (!isRewriteMode()) - { - getSink()->diagnose(result.exp.Ptr(), Diagnostics::invalidTypeVoid); - } + getSink()->diagnose(result.exp.Ptr(), Diagnostics::invalidTypeVoid); result.type = getSession()->getErrorType(); return result; } @@ -1207,17 +1192,7 @@ namespace Slang RefPtr<TypeCastExpr> createImplicitCastExpr() { - if (isRewriteMode()) - { - // In "rewrite" mode, we will generate a different syntax node - // to indicate that this type-cast was implicitly generated - // by the compiler, and shouldn't appear in the output code. - return new HiddenImplicitCastExpr(); - } - else - { - return new ImplicitCastExpr(); - } + return new ImplicitCastExpr(); } RefPtr<Expr> CreateImplicitCastExpr( @@ -1241,24 +1216,11 @@ namespace Slang return castExpr; } - bool isRewriteMode() - { - return (getTranslationUnit()->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) != 0; - } - // Perform type coercion, and emit errors if it isn't possible RefPtr<Expr> Coerce( RefPtr<Type> toType, RefPtr<Expr> fromExpr) { - // If semantic checking is being suppressed, then we might see - // expressions without a type, and we need to ignore them. - if( !fromExpr->type.type ) - { - if(isRewriteMode()) - return fromExpr; - } - RefPtr<Expr> expr; if (!TryCoerceImpl( toType, @@ -1267,10 +1229,7 @@ namespace Slang fromExpr.Ptr(), nullptr)) { - if(!isRewriteMode()) - { - getSink()->diagnose(fromExpr->loc, Diagnostics::typeMismatch, toType, fromExpr->type); - } + getSink()->diagnose(fromExpr->loc, Diagnostics::typeMismatch, toType, fromExpr->type); // Note(tfoley): We don't call `CreateErrorExpr` here, because that would // clobber the type on `fromExpr`, and an invariant here is that coercion @@ -1311,17 +1270,11 @@ namespace Slang if (!initExpr) { - if (!isRewriteMode()) - { - getSink()->diagnose(varDecl, Diagnostics::unimplemented, "variable declaration with no type must have initializer"); - } + getSink()->diagnose(varDecl, Diagnostics::unimplemented, "variable declaration with no type must have initializer"); } else { - if (!isRewriteMode()) - { - getSink()->diagnose(varDecl, Diagnostics::unimplemented, "type inference for variable declaration"); - } + getSink()->diagnose(varDecl, Diagnostics::unimplemented, "type inference for variable declaration"); } } @@ -1432,10 +1385,7 @@ namespace Slang // If type expression didn't name an interface, we'll emit an error here // TODO: deal with the case of an error in the type expression (don't cascade) - if (!isRewriteMode()) - { - getSink()->diagnose( base.exp, Diagnostics::expectedAnInterfaceGot, base.type); - } + getSink()->diagnose( base.exp, Diagnostics::expectedAnInterfaceGot, base.type); } RefPtr<ConstantIntVal> checkConstantIntVal( @@ -1451,10 +1401,7 @@ namespace Slang auto constIntVal = intVal.As<ConstantIntVal>(); if(!constIntVal) { - if (!isRewriteMode()) - { - getSink()->diagnose(expr->loc, Diagnostics::expectedIntegerConstantNotLiteral); - } + getSink()->diagnose(expr->loc, Diagnostics::expectedIntegerConstantNotLiteral); return nullptr; } return constIntVal; @@ -2610,10 +2557,7 @@ namespace Slang if (!resultType->Equals(prevResultType)) { // Bad dedeclaration - if (!isRewriteMode()) - { - getSink()->diagnose(funcDecl, Diagnostics::unimplemented, "redeclaration has a different return type"); - } + getSink()->diagnose(funcDecl, Diagnostics::unimplemented, "redeclaration has a different return type"); // Don't bother emitting other errors at this point break; @@ -2644,10 +2588,7 @@ namespace Slang if (funcDecl->Body && prevFuncDecl->Body) { // Redefinition - if (!isRewriteMode()) - { - getSink()->diagnose(funcDecl, Diagnostics::unimplemented, "function redefinition"); - } + getSink()->diagnose(funcDecl, Diagnostics::unimplemented, "function redefinition"); // Don't bother emitting other errors break; @@ -2673,10 +2614,7 @@ namespace Slang if (para->type.Equals(getSession()->getVoidType())) { - if (!isRewriteMode()) - { - getSink()->diagnose(para, Diagnostics::parameterCannotBeVoid); - } + getSink()->diagnose(para, Diagnostics::parameterCannotBeVoid); } } @@ -2695,10 +2633,7 @@ namespace Slang if (paraNames.Contains(para->getName())) { - if (!isRewriteMode()) - { - getSink()->diagnose(para, Diagnostics::parameterAlreadyDefined, para->getName()); - } + getSink()->diagnose(para, Diagnostics::parameterAlreadyDefined, para->getName()); } else paraNames.Add(para->getName()); @@ -2756,10 +2691,7 @@ namespace Slang auto outer = FindOuterStmt<BreakableStmt>(); if (!outer) { - if (!isRewriteMode()) - { - getSink()->diagnose(stmt, Diagnostics::breakOutsideLoop); - } + getSink()->diagnose(stmt, Diagnostics::breakOutsideLoop); } stmt->parentStmt = outer; } @@ -2768,10 +2700,7 @@ namespace Slang auto outer = FindOuterStmt<LoopStmt>(); if (!outer) { - if (!isRewriteMode()) - { - getSink()->diagnose(stmt, Diagnostics::continueOutsideLoop); - } + getSink()->diagnose(stmt, Diagnostics::continueOutsideLoop); } stmt->parentStmt = outer; } @@ -2883,10 +2812,7 @@ namespace Slang if (!switchStmt) { - if (!isRewriteMode()) - { - getSink()->diagnose(stmt, Diagnostics::caseOutsideSwitch); - } + getSink()->diagnose(stmt, Diagnostics::caseOutsideSwitch); } else { @@ -2902,10 +2828,7 @@ namespace Slang auto switchStmt = FindOuterStmt<SwitchStmt>(); if (!switchStmt) { - if (!isRewriteMode()) - { - getSink()->diagnose(stmt, Diagnostics::defaultOutsideSwitch); - } + getSink()->diagnose(stmt, Diagnostics::defaultOutsideSwitch); } stmt->parentStmt = switchStmt; } @@ -2937,10 +2860,7 @@ namespace Slang { if (function && !function->ReturnType.Equals(getSession()->getVoidType())) { - if (!isRewriteMode()) - { - getSink()->diagnose(stmt, Diagnostics::returnNeedsExpression); - } + getSink()->diagnose(stmt, Diagnostics::returnNeedsExpression); } } else @@ -3031,10 +2951,7 @@ namespace Slang // TODO(tfoley): How to handle the case where bound isn't known? if (GetMinBound(elementCount) <= 0) { - if (!isRewriteMode()) - { - getSink()->diagnose(varDecl, Diagnostics::invalidArraySize); - } + getSink()->diagnose(varDecl, Diagnostics::invalidArraySize); return; } } @@ -3058,10 +2975,7 @@ namespace Slang varDecl->type = typeExp; if (varDecl->type.Equals(getSession()->getVoidType())) { - if (!isRewriteMode()) - { - getSink()->diagnose(varDecl, Diagnostics::invalidTypeVoid); - } + getSink()->diagnose(varDecl, Diagnostics::invalidTypeVoid); } } @@ -3393,10 +3307,7 @@ namespace Slang auto result = TryCheckIntegerConstantExpression(expr.Ptr()); if (!result) { - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::expectedIntegerConstantNotConstant); - } + getSink()->diagnose(expr, Diagnostics::expectedIntegerConstantNotConstant); } return result; } @@ -3413,10 +3324,7 @@ namespace Slang if (!indexExpr->type->Equals(getSession()->getIntType()) && !indexExpr->type->Equals(getSession()->getUIntType())) { - if (!isRewriteMode()) - { - getSink()->diagnose(indexExpr, Diagnostics::subscriptIndexNonInteger); - } + getSink()->diagnose(indexExpr, Diagnostics::subscriptIndexNonInteger); return CreateErrorExpr(subscriptExpr.Ptr()); } @@ -3561,10 +3469,7 @@ namespace Slang fail: { - if (!isRewriteMode()) - { - getSink()->diagnose(subscriptExpr, Diagnostics::subscriptNonArray, baseType); - } + getSink()->diagnose(subscriptExpr, Diagnostics::subscriptNonArray, baseType); return CreateErrorExpr(subscriptExpr); } } @@ -3618,7 +3523,7 @@ namespace Slang { // Don't report an l-value issue on an errorneous expression } - else if (!isRewriteMode()) + else { getSink()->diagnose(expr, Diagnostics::assignNonLValue); } @@ -3650,10 +3555,7 @@ namespace Slang return; } } - if (!isRewriteMode()) - { - getSink()->diagnose(decl->targetType.exp, Diagnostics::unimplemented, "expected a nominal type here"); - } + getSink()->diagnose(decl->targetType.exp, Diagnostics::unimplemented, "expected a nominal type here"); } void visitExtensionDecl(ExtensionDecl* decl) @@ -3662,10 +3564,7 @@ namespace Slang if (!decl->targetType->As<DeclRefType>()) { - if (!isRewriteMode()) - { - getSink()->diagnose(decl->targetType.exp, Diagnostics::unimplemented, "expected a nominal type here"); - } + getSink()->diagnose(decl->targetType.exp, Diagnostics::unimplemented, "expected a nominal type here"); } // now check the members of the extension for (auto m : decl->Members) @@ -4543,18 +4442,12 @@ namespace Slang { if (argCount < paramCounts.required) { - if (!isRewriteMode()) - { - getSink()->diagnose(context.loc, Diagnostics::notEnoughArguments, argCount, paramCounts.required); - } + getSink()->diagnose(context.loc, Diagnostics::notEnoughArguments, argCount, paramCounts.required); } else { SLANG_ASSERT(argCount > paramCounts.allowed); - if (!isRewriteMode()) - { - getSink()->diagnose(context.loc, Diagnostics::tooManyArguments, argCount, paramCounts.allowed); - } + getSink()->diagnose(context.loc, Diagnostics::tooManyArguments, argCount, paramCounts.allowed); } } @@ -4576,11 +4469,8 @@ namespace Slang if (context.mode != OverloadResolveContext::Mode::JustTrying) { - if (!isRewriteMode()) - { - getSink()->diagnose(context.loc, Diagnostics::expectedPrefixOperator); - getSink()->diagnose(decl, Diagnostics::seeDefinitionOf, decl->getName()); - } + getSink()->diagnose(context.loc, Diagnostics::expectedPrefixOperator); + getSink()->diagnose(decl, Diagnostics::seeDefinitionOf, decl->getName()); } return false; @@ -4592,11 +4482,8 @@ namespace Slang if (context.mode != OverloadResolveContext::Mode::JustTrying) { - if (!isRewriteMode()) - { - getSink()->diagnose(context.loc, Diagnostics::expectedPostfixOperator); - getSink()->diagnose(decl, Diagnostics::seeDefinitionOf, decl->getName()); - } + getSink()->diagnose(context.loc, Diagnostics::expectedPostfixOperator); + getSink()->diagnose(decl, Diagnostics::seeDefinitionOf, decl->getName()); } return false; @@ -4908,16 +4795,13 @@ namespace Slang if (candidate.status == OverloadCandidate::Status::GenericArgumentInferenceFailed) { String callString = getCallSignatureString(context); - if (!isRewriteMode()) - { - getSink()->diagnose( - context.loc, - Diagnostics::genericArgumentInferenceFailed, - callString); + getSink()->diagnose( + context.loc, + Diagnostics::genericArgumentInferenceFailed, + callString); - String declString = getDeclSignatureString(candidate.item); - getSink()->diagnose(candidate.item.declRef, Diagnostics::genericSignatureTried, declString); - } + String declString = getDeclSignatureString(candidate.item); + getSink()->diagnose(candidate.item.declRef, Diagnostics::genericSignatureTried, declString); goto error; } @@ -6046,17 +5930,11 @@ namespace Slang if (funcName) { - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::noApplicableOverloadForNameWithArgs, funcName, argsList); - } + getSink()->diagnose(expr, Diagnostics::noApplicableOverloadForNameWithArgs, funcName, argsList); } else { - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::noApplicableWithArgs, argsList); - } + getSink()->diagnose(expr, Diagnostics::noApplicableWithArgs, argsList); } } else @@ -6065,21 +5943,14 @@ namespace Slang if (funcName) { - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::ambiguousOverloadForNameWithArgs, funcName, argsList); - } + getSink()->diagnose(expr, Diagnostics::ambiguousOverloadForNameWithArgs, funcName, argsList); } else { - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::ambiguousOverloadWithArgs, argsList); - } + getSink()->diagnose(expr, Diagnostics::ambiguousOverloadWithArgs, argsList); } } - if (!isRewriteMode()) { UInt candidateCount = context.bestCandidates.Count(); UInt maxCandidatesToPrint = 10; // don't show too many candidates at once... @@ -6125,10 +5996,7 @@ namespace Slang else { // Nothing at all was found that we could even consider invoking - if (!isRewriteMode()) - { - getSink()->diagnose(expr->FunctionExpr, Diagnostics::expectedFunction); - } + getSink()->diagnose(expr->FunctionExpr, Diagnostics::expectedFunction); expr->type = QualType(getSession()->getErrorType()); return expr; } @@ -6227,10 +6095,7 @@ namespace Slang // TODO(tfoley): print a reasonable message here... - if (!isRewriteMode()) - { - getSink()->diagnose(genericAppExpr, Diagnostics::unimplemented, "no applicable generic"); - } + getSink()->diagnose(genericAppExpr, Diagnostics::unimplemented, "no applicable generic"); return CreateErrorExpr(genericAppExpr); } @@ -6260,10 +6125,7 @@ namespace Slang else { // Nothing at all was found that we could even consider invoking - if (!isRewriteMode()) - { - getSink()->diagnose(genericAppExpr, Diagnostics::unimplemented, "expected a generic"); - } + getSink()->diagnose(genericAppExpr, Diagnostics::unimplemented, "expected a generic"); return CreateErrorExpr(genericAppExpr); } } @@ -6308,13 +6170,10 @@ namespace Slang if (pp < expr->Arguments.Count() && !expr->Arguments[pp]->type.IsLeftValue) { - if (!isRewriteMode()) - { - getSink()->diagnose( - expr->Arguments[pp], - Diagnostics::argumentExpectedLValue, - pp); - } + getSink()->diagnose( + expr->Arguments[pp], + Diagnostics::argumentExpectedLValue, + pp); } } } @@ -6355,10 +6214,7 @@ namespace Slang expr->loc); } - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::undefinedIdentifier2, expr->name); - } + getSink()->diagnose(expr, Diagnostics::undefinedIdentifier2, expr->name); return expr; } @@ -6422,10 +6278,7 @@ namespace Slang fail: // Default: in no other case succeds, then the cast failed and we emit a diagnostic. - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::invalidTypeCast, expr->Expression->type, targetType->ToString()); - } + getSink()->diagnose(expr, Diagnostics::invalidTypeCast, expr->Expression->type, targetType->ToString()); expr->type = QualType(getSession()->getErrorType()); return expr; #endif @@ -6540,10 +6393,7 @@ namespace Slang case 'w': case 'a': elementIndex = 3; break; default: // An invalid character in the swizzle is an error - if (!isRewriteMode() && !anyError) - { - getSink()->diagnose(swizExpr, Diagnostics::invalidSwizzleExpr, swizzleText, baseElementType->ToString()); - } + getSink()->diagnose(swizExpr, Diagnostics::invalidSwizzleExpr, swizzleText, baseElementType->ToString()); anyError = true; continue; } @@ -6554,10 +6404,7 @@ namespace Slang // Make sure the index is in range for the source type if (elementIndex >= limitElement) { - if (!isRewriteMode() && !anyError) - { - getSink()->diagnose(swizExpr, Diagnostics::invalidSwizzleExpr, swizzleText, baseElementType->ToString()); - } + getSink()->diagnose(swizExpr, Diagnostics::invalidSwizzleExpr, swizzleText, baseElementType->ToString()); anyError = true; continue; } @@ -6619,10 +6466,7 @@ namespace Slang } else { - if (!isRewriteMode()) - { - getSink()->diagnose(memberRefExpr, Diagnostics::unimplemented, "swizzle on vector of unknown size"); - } + getSink()->diagnose(memberRefExpr, Diagnostics::unimplemented, "swizzle on vector of unknown size"); return CreateErrorExpr(memberRefExpr); } } @@ -6637,10 +6481,7 @@ namespace Slang MemberExpr* expr, QualType const& baseType) { - if (!isRewriteMode()) - { - getSink()->diagnose(expr, Diagnostics::noMemberOfNameInType, expr->name, baseType); - } + getSink()->diagnose(expr, Diagnostics::noMemberOfNameInType, expr->name, baseType); expr->type = QualType(getSession()->getErrorType()); return expr; diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index dd9830c24..3834945f9 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2685,13 +2685,6 @@ struct EmitVisitor if(needClose) Emit(")"); } - void visitHiddenImplicitCastExpr(HiddenImplicitCastExpr* castExpr, ExprEmitArg const& arg) - { - // This was an implicit cast inserted in code parsed in "rewriter" mode, - // so we don't want to output it and change what the user's code looked like. - ExprVisitorWithArg::dispatch(castExpr->Arguments[0], arg); - } - void visitTypeCastExpr(TypeCastExpr* castExpr, ExprEmitArg const& arg) { // We emit a type cast expression as a constructor call @@ -7669,7 +7662,7 @@ String emitEntryPoint( // categories, each of which is reflected as a different code path // below: // - // 1. "Full rewriter" mode, where the user provides HLSL/GLSL, opts + // 1. REMOVED: "Full rewriter" mode, where the user provides HLSL/GLSL, opts // out of semantic checking, and doesn't make use of any Slang // code via `import`. // @@ -7684,7 +7677,7 @@ String emitEntryPoint( // via the same AST-to-AST pass that legalized the user's code. This // mode will eventually go away, but it is the main one used right now. // - // b) "With IR." If the user opts into using the IR, then we need to + // b) REMOVED: "With IR." If the user opts into using the IR, then we need to // apply the AST-to-AST pass to their HLSL/GLSL code, but *also* use // the IR to compile everything else. // @@ -7694,27 +7687,10 @@ String emitEntryPoint( // // We'll try to detect the cases here, starting with case (1): // - if ((translationUnit->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) - && translationUnit->compileRequest->loadedModulesList.Count() == 0) - { - // The user has opted out of semantic checking for their own code - // (in the "main" module), and also hasn't `import`ed any Slang - // modules that would require cross-compilation. - // - // Our goal in this mode is to print out the AST we parsed and - // hopefully reproduce something as close to the original as possible. - // - // The only deviation we *want* from the original code is that we will - // add new parameter binding annotations. - - sharedContext.program = translationUnitSyntax; - visitor.EmitDeclsInContainerUsingLayout( - translationUnitSyntax, - globalStructLayout); - } + // REMOVED. // // Next we will check for case (2a): - else if (!(translationUnit->compileRequest->compileFlags & SLANG_COMPILE_FLAG_USE_IR)) + if (!(translationUnit->compileRequest->compileFlags & SLANG_COMPILE_FLAG_USE_IR)) { TypeLegalizationContext typeLegalizationContext; typeLegalizationContext.session = entryPoint->compileRequest->mSession; @@ -7781,37 +7757,16 @@ String emitEntryPoint( typeLegalizationContext.irModule = irModule; - List<Decl*> astDecls; - if(translationUnit->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) - { - // We are in case (2b), where the main module is in unchecked - // HLSL/GLSL that we need to "rewrite," and any library code - // is in Slang that will need to be cross-compiled via the IR. - - // We first need to walk the AST part of the code to look - // for any places where it references declarations that - // are implemented in the IR, so that we can be sure to - // generate suitable IR code for them. + // We are in case (3), where all of the code is in Slang, and + // has already been lowered to IR as part of the front-end + // compilation work. We thus start by cloning any code needed + // by the entry point over to our fresh IR module. - findDeclsUsedByASTEntryPoint( - entryPoint, - target, - irSpecializationState, - astDecls); - } - else - { - // We are in case (3), where all of the code is in Slang, and - // has already been lowered to IR as part of the front-end - // compilation work. We thus start by cloning any code needed - // by the entry point over to our fresh IR module. + sharedContext.isFullIRMode = true; - sharedContext.isFullIRMode = true; - - specializeIRForEntryPoint( - irSpecializationState, - entryPoint); - } + specializeIRForEntryPoint( + irSpecializationState, + entryPoint); // If the user specified the flag that they want us to dump // IR, then do it here, for the target-specific, but @@ -7853,29 +7808,6 @@ String emitEntryPoint( #endif LoweredEntryPoint lowered; - if(translationUnit->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) - { - // In the (2b) case, once we have legalized the IR code, - // we now need to go in and legalize the AST code. - // This order is important because when referring to a variable - // that is defined in the IR, we need to legalize it first (which - // might split it into many decls) before we can legalize an AST - // expression that references that decl (which will also need - // to get split). - // - // We don't have to worry about references in the other direction; - // we don't allow the user to define something in unchecked AST - // code and then use it from the IR shader library. - - lowered = lowerEntryPoint( - entryPoint, - programLayout, - target, - &sharedContext.extensionUsageTracker, - irSpecializationState, - &typeLegalizationContext, - astDecls); - } // When emitting IR-based declarations, we wnat to // track which decls have already been lowered. @@ -7888,22 +7820,6 @@ String emitEntryPoint( // TODO: do we want to emit directly from IR, or translate the // IR back into AST for emission? visitor.emitIRModule(&context, irModule); - - // If we are in case (2b) and the user *also* has AST-based code - // that we need to output, we'll do it now. - if (translationUnit->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) - { - // First make sure that we've emitted any types that were declared - // in the IR, but then subsequently only used by the AST - for( auto decl : lowered.irDecls ) - { - visitor.emitIRUsedDeclRef(&context, makeDeclRef(decl)); - } - - visitor.EmitDeclsInContainer(lowered.program); - } - - // TODO: need to clean up the IR module here } String code = sharedContext.sb.ProduceString(); diff --git a/source/slang/expr-defs.h b/source/slang/expr-defs.h index 4b47cc883..3909c6b63 100644 --- a/source/slang/expr-defs.h +++ b/source/slang/expr-defs.h @@ -132,11 +132,6 @@ END_SYNTAX_CLASS() SYNTAX_CLASS(ImplicitCastExpr, TypeCastExpr) END_SYNTAX_CLASS() -// An implicit type-cast that should also be hidden on output, -// because we don't want to mess with the user's code -SYNTAX_CLASS(HiddenImplicitCastExpr, ImplicitCastExpr) -END_SYNTAX_CLASS() - SIMPLE_SYNTAX_CLASS(SelectExpr, OperatorExpr) SIMPLE_SYNTAX_CLASS(GenericAppExpr, AppExprBase) diff --git a/source/slang/options.cpp b/source/slang/options.cpp index a5ed8eca6..68d16f107 100644 --- a/source/slang/options.cpp +++ b/source/slang/options.cpp @@ -264,9 +264,7 @@ struct OptionsParser // else if (argStr == "-symbo") // options.SymbolToCompile = tryReadCommandLineArgument(arg, &argCursor, argEnd); //else - if (argStr == "-no-checking") - flags |= SLANG_COMPILE_FLAG_NO_CHECKING; - else if(argStr == "-split-mixed-types" ) + if(argStr == "-split-mixed-types" ) { flags |= SLANG_COMPILE_FLAG_SPLIT_MIXED_TYPES; } diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 538e5d576..037268244 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -2974,53 +2974,6 @@ namespace Slang RefPtr<Stmt> Parser::parseBlockStatement() { - // If we are being asked not to check things *and* we haven't - // seen any `import` declarations yet, then we can safely assume - // that function bodies should be left as-is. - if( (translationUnit->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) - && !haveSeenAnyImportDecls ) - { - // We have been asked to parse the input, but not attempt to understand it. - - // TODO: record start/end locations... - - List<Token> tokens; - - ReadToken(TokenType::LBrace); - - int depth = 1; - for( ;;) - { - switch( tokenReader.PeekTokenType() ) - { - case TokenType::EndOfFile: - goto done; - - case TokenType::RBrace: - depth--; - if(depth == 0) - goto done; - break; - - case TokenType::LBrace: - depth++; - break; - - default: - break; - } - - auto token = tokenReader.AdvanceToken(); - tokens.Add(token); - } - done: - ReadToken(TokenType::RBrace); - - RefPtr<UnparsedStmt> unparsedStmt = new UnparsedStmt(); - unparsedStmt->tokens = tokens; - return unparsedStmt; - } - RefPtr<ScopeDecl> scopeDecl = new ScopeDecl(); RefPtr<BlockStmt> blockStatement = new BlockStmt(); blockStatement->scopeDecl = scopeDecl; diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 0ba3e790c..90a9a3aef 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -267,11 +267,6 @@ void CompileRequest::generateIR() // in isolation. for( auto& translationUnit : translationUnits ) { - // Also skip IR generation if semantic checking is turned off - // for a given translation unit. - if(translationUnit->compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING) - continue; - translationUnit->irModule = generateIRForTranslationUnit(translationUnit); } } @@ -309,13 +304,6 @@ int CompileRequest::executeActionsInner() for (auto& translationUnit : translationUnits) { translationUnit->compileFlags |= compileFlags; - - // However, the "no checking" flag shouldn't be applied to - // any translation unit that is native Slang code. - if (translationUnit->sourceLanguage == SourceLanguage::Slang) - { - translationUnit->compileFlags &= ~SLANG_COMPILE_FLAG_NO_CHECKING; - } } // If no code-generation target was specified, then try to infer one from the source language, diff --git a/tests/bindings/gh-84.frag b/tests/bindings/gh-84.frag index b5cc1875e..407ba5043 100644 --- a/tests/bindings/gh-84.frag +++ b/tests/bindings/gh-84.frag @@ -1,5 +1,5 @@ #version 450 -//TEST:COMPARE_GLSL: +//DISABLED_TEST:COMPARE_GLSL: // Confirm implementation of GitHub issue #84 diff --git a/tests/bugs/gh-133.slang.glsl b/tests/bugs/gh-133.slang.glsl index 82f5fda49..9481d841f 100644 --- a/tests/bugs/gh-133.slang.glsl +++ b/tests/bugs/gh-133.slang.glsl @@ -6,6 +6,7 @@ struct Fragment uint foo; }; +layout(binding = 0) uniform U { uint bar; diff --git a/tests/compute/rewriter-array-type.hlsl b/tests/compute/rewriter-array-type.hlsl deleted file mode 100644 index 38a2abc1e..000000000 --- a/tests/compute/rewriter-array-type.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir - -//TEST_INPUT:cbuffer(data=[16 0 0 0 32 0 0 0]):dxbinding(0),glbinding(0) -//TEST_INPUT:cbuffer(data=[256 0 0 0 512 0 0 0 768 0 0 0 1024 0 0 0]):dxbinding(1),glbinding(1) -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out -//TEST_INPUT:ubuffer(data=[90 91 92 93], stride=4):dxbinding(1),glbinding(1) -//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(2),glbinding(2) - -// Test the case of user code with that uses the "rewriter" mode -// (`-no-checking` flag) and that uses a type declared in -// imported code (that will compile via IR). Also test -// the case where such a type requires legalization. - -import rewriter_types; - -RWStructuredBuffer<int> outputBuffer : register(u0); - -cbuffer C -{ - MyHelper myHelpers[2]; -} - -cbuffer D -{ - Other others[2]; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - uint tid = dispatchThreadID.x; - int inVal = tid; - int outVal = test(inVal, myHelpers[1], others[tid]); - outputBuffer[tid] = outVal; -}
\ No newline at end of file diff --git a/tests/compute/rewriter-array-type.hlsl.expected.txt b/tests/compute/rewriter-array-type.hlsl.expected.txt deleted file mode 100644 index 9bde1c082..000000000 --- a/tests/compute/rewriter-array-type.hlsl.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -120 -222 -324 -426 diff --git a/tests/compute/rewriter-parameter-block-complex.hlsl b/tests/compute/rewriter-parameter-block-complex.hlsl index 18a37a6ef..a1fb4cd19 100644 --- a/tests/compute/rewriter-parameter-block-complex.hlsl +++ b/tests/compute/rewriter-parameter-block-complex.hlsl @@ -1,6 +1,4 @@ -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking //TEST(compute):COMPARE_COMPUTE:-xslang -use-ir -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out diff --git a/tests/compute/rewriter-parameter-block-complex.hlsl.1.expected.txt b/tests/compute/rewriter-parameter-block-complex.hlsl.1.expected.txt deleted file mode 100644 index 883f72716..000000000 --- a/tests/compute/rewriter-parameter-block-complex.hlsl.1.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -1110 -1121 -1132 -1143 diff --git a/tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt b/tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt deleted file mode 100644 index 883f72716..000000000 --- a/tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -1110 -1121 -1132 -1143 diff --git a/tests/compute/rewriter-parameter-block.hlsl b/tests/compute/rewriter-parameter-block.hlsl index 0a6f5d52e..ebf1e6994 100644 --- a/tests/compute/rewriter-parameter-block.hlsl +++ b/tests/compute/rewriter-parameter-block.hlsl @@ -1,6 +1,4 @@ -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking //TEST(compute):COMPARE_COMPUTE:-xslang -use-ir -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out diff --git a/tests/compute/rewriter-parameter-block.hlsl.1.expected.txt b/tests/compute/rewriter-parameter-block.hlsl.1.expected.txt deleted file mode 100644 index 479b9e0da..000000000 --- a/tests/compute/rewriter-parameter-block.hlsl.1.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -11110 -11121 -11132 -11143 diff --git a/tests/compute/rewriter-parameter-block.hlsl.2.expected.txt b/tests/compute/rewriter-parameter-block.hlsl.2.expected.txt deleted file mode 100644 index 479b9e0da..000000000 --- a/tests/compute/rewriter-parameter-block.hlsl.2.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -11110 -11121 -11132 -11143 diff --git a/tests/compute/rewriter-types.hlsl b/tests/compute/rewriter-types.hlsl deleted file mode 100644 index 01da92997..000000000 --- a/tests/compute/rewriter-types.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir - -//TEST_INPUT:cbuffer(data=[16]):dxbinding(0),glbinding(0) -//TEST_INPUT:cbuffer(data=[256]):dxbinding(1),glbinding(1) -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out -//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(1),glbinding(1) - -// Test the case of user code with that uses the "rewriter" mode -// (`-no-checking` flag) and that uses a type declared in -// imported code (that will compile via IR). Also test -// the case where such a type requires legalization. - -import rewriter_types; - -RWStructuredBuffer<int> outputBuffer : register(u0); - -cbuffer C -{ - MyHelper myHelper; -} - -cbuffer D -{ - Other other; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - uint tid = dispatchThreadID.x; - int inVal = tid; - int outVal = test(inVal, myHelper, other); - outputBuffer[tid] = outVal; -}
\ No newline at end of file diff --git a/tests/compute/rewriter-types.hlsl.expected.txt b/tests/compute/rewriter-types.hlsl.expected.txt deleted file mode 100644 index b68ea4a4f..000000000 --- a/tests/compute/rewriter-types.hlsl.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -110 -112 -114 -116 diff --git a/tests/compute/rewriter-types.slang b/tests/compute/rewriter-types.slang deleted file mode 100644 index a627b7891..000000000 --- a/tests/compute/rewriter-types.slang +++ /dev/null @@ -1,17 +0,0 @@ -//TEST_IGNORE_FILE: - -struct MyHelper -{ - int val; - RWStructuredBuffer<int> buf; -}; - -struct Other -{ - int val; -}; - -int test(int inVal, MyHelper helper, Other other) -{ - return inVal + helper.val + helper.buf[inVal] + other.val; -} diff --git a/tests/compute/rewriter-use-ir-type.hlsl b/tests/compute/rewriter-use-ir-type.hlsl deleted file mode 100644 index 8d388addf..000000000 --- a/tests/compute/rewriter-use-ir-type.hlsl +++ /dev/null @@ -1,24 +0,0 @@ -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir - -//TEST_INPUT:cbuffer(data=[1 2 3 4 16 32 48 64]):dxbinding(0),glbinding(0) -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out - -import rewriter_use_ir_type; - -RWStructuredBuffer<int> outputBuffer : register(u0); - -cbuffer C : register(b0) -{ - Helper helper; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - uint tid = dispatchThreadID.x; - int inVal = tid; - - int outVal = helper.a[inVal]; - - outputBuffer[tid] = outVal; -}
\ No newline at end of file diff --git a/tests/compute/rewriter-use-ir-type.hlsl.expected.txt b/tests/compute/rewriter-use-ir-type.hlsl.expected.txt deleted file mode 100644 index 94ebaf900..000000000 --- a/tests/compute/rewriter-use-ir-type.hlsl.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -1 -2 -3 -4 diff --git a/tests/compute/rewriter-use-ir-type.slang b/tests/compute/rewriter-use-ir-type.slang deleted file mode 100644 index 8870f000f..000000000 --- a/tests/compute/rewriter-use-ir-type.slang +++ /dev/null @@ -1,6 +0,0 @@ -//TEST_IGNORE_FILE: - -struct Helper -{ - int4 a; -};
\ No newline at end of file diff --git a/tests/compute/rewriter.hlsl b/tests/compute/rewriter.hlsl deleted file mode 100644 index 35a630c62..000000000 --- a/tests/compute/rewriter.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir -//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(0),glbinding(0),out - -// Test that we can use Slang libraries that require IR cross-compilation -// (e.g., libraries that use generics) while writing the main code in -// vanilla HLSL/GLSL without checking enabled. - -import rewriter; - -RWStructuredBuffer<int> outputBuffer : register(u0); - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - uint tid = dispatchThreadID.x; - int inVal = outputBuffer[tid]; - int outVal = test(inVal); - outputBuffer[tid] = outVal; -}
\ No newline at end of file diff --git a/tests/compute/rewriter.hlsl.expected.txt b/tests/compute/rewriter.hlsl.expected.txt deleted file mode 100644 index a0d427709..000000000 --- a/tests/compute/rewriter.hlsl.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -10 -11 -12 -13 diff --git a/tests/compute/rewriter.slang b/tests/compute/rewriter.slang deleted file mode 100644 index 2895dfaca..000000000 --- a/tests/compute/rewriter.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST_IGNORE_FILE: - -// This file is a "library" used by the `rewriter.hlsl` test. -// It intentionally uses Slang features that can't be supported -// by naive source-to-source translation. - -interface IHelper -{ - int help(int inVal); -} - -struct MyHelper : IHelper -{ - int help(int inVal) - { - return 16 + inVal; - } -}; - -__generic<H : IHelper> -int doTest(H helper, int inVal) -{ - return helper.help(inVal); -} - -int test(int inVal) -{ - MyHelper helper; - return doTest<MyHelper>(helper, inVal); -} diff --git a/tests/cross-compile/compile-time-loop.slang.glsl b/tests/cross-compile/compile-time-loop.slang.glsl index a1f87be65..9f4bd385a 100644 --- a/tests/cross-compile/compile-time-loop.slang.glsl +++ b/tests/cross-compile/compile-time-loop.slang.glsl @@ -1,4 +1,5 @@ //TEST_IGNORE_FILE: +#version 420 layout(binding = 0) uniform texture2D t; diff --git a/tests/cross-compile/gl-layer-pick-version.slang.glsl b/tests/cross-compile/gl-layer-pick-version.slang.glsl index 55d419405..9e737cecf 100644 --- a/tests/cross-compile/gl-layer-pick-version.slang.glsl +++ b/tests/cross-compile/gl-layer-pick-version.slang.glsl @@ -6,11 +6,12 @@ struct VS_OUT uint layerID; }; -vec4 main_(VS_OUT vsOut) : SV_Target +vec4 main_(VS_OUT vsOut) { return vec4(float(vsOut.layerID)); } +layout(location = 0) out vec4 SLANG_out_main_result; void main() diff --git a/tests/cross-compile/integer-input.slang.glsl b/tests/cross-compile/integer-input.slang.glsl index ce6998a9a..7d45d4de1 100644 --- a/tests/cross-compile/integer-input.slang.glsl +++ b/tests/cross-compile/integer-input.slang.glsl @@ -1,12 +1,15 @@ //TEST_IGNORE_FILE: +#version 420 struct VS_OUT { uint drawID; }; +layout(location = 0) in flat uint SLANG_in_vsOut_drawID; +layout(location = 0) out vec4 SLANG_out_main_result; vec4 main_(VS_OUT vsOut) diff --git a/tests/cross-compile/matrix-mult.slang.glsl b/tests/cross-compile/matrix-mult.slang.glsl index 0349d854e..9a29e1ed5 100644 --- a/tests/cross-compile/matrix-mult.slang.glsl +++ b/tests/cross-compile/matrix-mult.slang.glsl @@ -1,4 +1,5 @@ //TEST_IGNORE_FILE: +#version 420 layout(binding = 0) uniform C diff --git a/tests/cross-compile/nointerpolation-input.slang.glsl b/tests/cross-compile/nointerpolation-input.slang.glsl index 279590fa5..d359f5bc8 100644 --- a/tests/cross-compile/nointerpolation-input.slang.glsl +++ b/tests/cross-compile/nointerpolation-input.slang.glsl @@ -1,12 +1,15 @@ //TEST_IGNORE_FILE: +#version 420 struct VS_OUT { float drawID; }; +layout(location = 0) in flat float SLANG_in_vsOut_drawID; +layout(location = 0) out vec4 SLANG_out_main_result; vec4 main_(VS_OUT vsOut) diff --git a/tests/glsl/sascha-willems/LICENSE.md b/tests/glsl/sascha-willems/LICENSE.md deleted file mode 100644 index 2c4cfd5b7..000000000 --- a/tests/glsl/sascha-willems/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Sascha Willems - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/tests/glsl/sascha-willems/README.md b/tests/glsl/sascha-willems/README.md deleted file mode 100644 index 3060f9b3d..000000000 --- a/tests/glsl/sascha-willems/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# GLSL Shaders from Sascha Willems' Vulkan Tutorials - - -These shaders are taken from the [repository][VulkanTutorials] of Vulkan examples developed by Sascha Willems. -The original code is licensed according to the terms in the [`LICSENSE.md`](LICENSE.md) file in this directory. - -[VulkanTutorials]: https://github.com/SaschaWillems/Vulkan/ "Vulkan C++ examples and demos" - diff --git a/tests/glsl/sascha-willems/base/textoverlay.frag b/tests/glsl/sascha-willems/base/textoverlay.frag deleted file mode 100644 index c77198765..000000000 --- a/tests/glsl/sascha-willems/base/textoverlay.frag +++ /dev/null @@ -1,21 +0,0 @@ -#version 450 core -//TEST:COMPARE_GLSL: -//TEST:COMPARE_GLSL:-DBINDING - -#if defined(__SLANG__) && defined(BINDING) -#define LAYOUT(X) /* empty */ -#else -#define LAYOUT(X) layout(X) -#endif - -LAYOUT(location = 0) in vec2 inUV; - -LAYOUT(binding = 0) uniform sampler2D samplerFont; - -LAYOUT(location = 0) out vec4 outFragColor; - -void main(void) -{ - float color = texture(samplerFont, inUV).r; - outFragColor = vec4(vec3(color), 1.0); -} diff --git a/tests/glsl/sascha-willems/base/textoverlay.vert b/tests/glsl/sascha-willems/base/textoverlay.vert deleted file mode 100644 index 5d5dacab6..000000000 --- a/tests/glsl/sascha-willems/base/textoverlay.vert +++ /dev/null @@ -1,25 +0,0 @@ -#version 450 core -//TEST:COMPARE_GLSL: -//TEST:COMPARE_GLSL:-DBINDING - -#if defined(__SLANG__) && defined(BINDING) -#define LAYOUT(X) /* empty */ -#else -#define LAYOUT(X) layout(X) -#endif - -LAYOUT(location = 0) in vec2 inPos; -LAYOUT(location = 1) in vec2 inUV; - -LAYOUT(location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main(void) -{ - gl_Position = vec4(inPos, 0.0, 1.0); - outUV = inUV; -} diff --git a/tests/glsl/sascha-willems/bloom/colorpass.frag b/tests/glsl/sascha-willems/bloom/colorpass.frag deleted file mode 100644 index 63d518d29..000000000 --- a/tests/glsl/sascha-willems/bloom/colorpass.frag +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D colorMap; - -layout (location = 0) in vec3 inColor; -layout (location = 1) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor.rgb = inColor; -// outFragColor = texture(colorMap, inUV);// * vec4(inColor, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/bloom/colorpass.vert b/tests/glsl/sascha-willems/bloom/colorpass.vert deleted file mode 100644 index d2f7f4e6f..000000000 --- a/tests/glsl/sascha-willems/bloom/colorpass.vert +++ /dev/null @@ -1,31 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outColor; -layout (location = 1) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - outColor = inColor; - gl_Position = ubo.projection * ubo.view * ubo.model * inPos; -} diff --git a/tests/glsl/sascha-willems/bloom/gaussblur.frag b/tests/glsl/sascha-willems/bloom/gaussblur.frag deleted file mode 100644 index 4cf4696cf..000000000 --- a/tests/glsl/sascha-willems/bloom/gaussblur.frag +++ /dev/null @@ -1,48 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (binding = 0) uniform UBO -{ - float blurScale; - float blurStrength; -} ubo; - -layout (constant_id = 0) const int blurdirection = 0; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - float weight[5]; - weight[0] = 0.227027; - weight[1] = 0.1945946; - weight[2] = 0.1216216; - weight[3] = 0.054054; - weight[4] = 0.016216; - - vec2 tex_offset = 1.0 / textureSize(samplerColor, 0) * ubo.blurScale; // gets size of single texel - vec3 result = texture(samplerColor, inUV).rgb * weight[0]; // current fragment's contribution - for(int i = 1; i < 5; ++i) - { - if (blurdirection == 1) - { - // H - result += texture(samplerColor, inUV + vec2(tex_offset.x * i, 0.0)).rgb * weight[i] * ubo.blurStrength; - result += texture(samplerColor, inUV - vec2(tex_offset.x * i, 0.0)).rgb * weight[i] * ubo.blurStrength; - } - else - { - // V - result += texture(samplerColor, inUV + vec2(0.0, tex_offset.y * i)).rgb * weight[i] * ubo.blurStrength; - result += texture(samplerColor, inUV - vec2(0.0, tex_offset.y * i)).rgb * weight[i] * ubo.blurStrength; - } - } - outFragColor = vec4(result, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/bloom/gaussblur.vert b/tests/glsl/sascha-willems/bloom/gaussblur.vert deleted file mode 100644 index 548284554..000000000 --- a/tests/glsl/sascha-willems/bloom/gaussblur.vert +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/bloom/phongpass.frag b/tests/glsl/sascha-willems/bloom/phongpass.frag deleted file mode 100644 index 9a449f6d1..000000000 --- a/tests/glsl/sascha-willems/bloom/phongpass.frag +++ /dev/null @@ -1,34 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D colorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 ambient = vec3(0.0f); - - // Adjust light calculations for glow color - if ((inColor.r >= 0.9) || (inColor.g >= 0.9) || (inColor.b >= 0.9)) - { - ambient = inColor * 0.25; - } - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 8.0) * vec3(0.75); - outFragColor = vec4(ambient + diffuse + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/bloom/phongpass.vert b/tests/glsl/sascha-willems/bloom/phongpass.vert deleted file mode 100644 index a3c77cb48..000000000 --- a/tests/glsl/sascha-willems/bloom/phongpass.vert +++ /dev/null @@ -1,49 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: -//TEST:COMPARE_GLSL:-DBINDING - -#if defined(__SLANG__) && defined(BINDING) -#define LAYOUT(X) /* empty */ -#else -#define LAYOUT(X) layout(X) -#endif - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -LAYOUT(location = 0) in vec4 inPos; -LAYOUT(location = 1) in vec2 inUV; -LAYOUT(location = 2) in vec3 inColor; -LAYOUT(location = 3) in vec3 inNormal; - -LAYOUT(binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; -} ubo; - -LAYOUT(location = 0) out vec3 outNormal; -LAYOUT(location = 1) out vec2 outUV; -LAYOUT(location = 2) out vec3 outColor; -LAYOUT(location = 3) out vec3 outViewVec; -LAYOUT(location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - gl_Position = ubo.projection * ubo.view * ubo.model * inPos; - - vec3 lightPos = vec3(-5.0, -5.0, 0.0); - vec4 pos = ubo.view * ubo.model * inPos; - outNormal = mat3(ubo.view * ubo.model) * inNormal; - outLightVec = lightPos - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/bloom/skybox.frag b/tests/glsl/sascha-willems/bloom/skybox.frag deleted file mode 100644 index 611eb37db..000000000 --- a/tests/glsl/sascha-willems/bloom/skybox.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube samplerCubeMap; - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerCubeMap, inUVW); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/bloom/skybox.vert b/tests/glsl/sascha-willems/bloom/skybox.vert deleted file mode 100644 index f06b3d38d..000000000 --- a/tests/glsl/sascha-willems/bloom/skybox.vert +++ /dev/null @@ -1,28 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - - -void main() -{ - outUVW = inPos; - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/computecullandlod/cull.comp b/tests/glsl/sascha-willems/computecullandlod/cull.comp deleted file mode 100644 index d04beb2ec..000000000 --- a/tests/glsl/sascha-willems/computecullandlod/cull.comp +++ /dev/null @@ -1,127 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to lack of support for math on specialization constants -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (constant_id = 0) const int MAX_LOD_LEVEL = 5; - -struct InstanceData -{ - vec3 pos; - float scale; -}; - -// Binding 0: Instance input data for culling -layout (binding = 0, std140) buffer Instances -{ - InstanceData instances[ ]; -}; - -// Same layout as VkDrawIndexedIndirectCommand -struct IndexedIndirectCommand -{ - uint indexCount; - uint instanceCount; - uint firstIndex; - uint vertexOffset; - uint firstInstance; -}; - -// Binding 1: Multi draw output -layout (binding = 1, std430) writeonly buffer IndirectDraws -{ - IndexedIndirectCommand indirectDraws[ ]; -}; - -// Binding 2: Uniform block object with matrices -layout (binding = 2) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 cameraPos; - vec4 frustumPlanes[6]; -} ubo; - -// Binding 3: Indirect draw stats -layout (binding = 3) buffer UBOOut -{ - uint drawCount; - uint lodCount[MAX_LOD_LEVEL + 1]; -} uboOut; - -// Binding 4: level-of-detail information -struct LOD -{ - uint firstIndex; - uint indexCount; - float distance; - float _pad0; -}; -layout (binding = 4) readonly buffer LODs -{ - LOD lods[ ]; -}; - -layout (local_size_x = 16) in; - -bool frustumCheck(vec4 pos, float radius) -{ - // Check sphere against frustum planes - for (int i = 0; i < 6; i++) - { - if (dot(pos, ubo.frustumPlanes[i]) + radius < 0.0) - { - return false; - } - } - return true; -} - -layout (local_size_x = 16) in; - -void main() -{ - uint idx = gl_GlobalInvocationID.x + gl_GlobalInvocationID.y * gl_NumWorkGroups.x * gl_WorkGroupSize.x; - - // Clear stats on first invocation - if (idx == 0) - { - atomicExchange(uboOut.drawCount, 0); - for (uint i = 0; i < MAX_LOD_LEVEL + 1; i++) - { - atomicExchange(uboOut.lodCount[i], 0); - } - } - - vec4 pos = vec4(instances[idx].pos.xyz, 1.0); - - // Check if object is within current viewing frustum - if (frustumCheck(pos, 1.0)) - { - indirectDraws[idx].instanceCount = 1; - - // Increase number of indirect draw counts - atomicAdd(uboOut.drawCount, 1); - - // Select appropriate LOD level based on distance to camera - uint lodLevel = MAX_LOD_LEVEL; - for (uint i = 0; i < MAX_LOD_LEVEL; i++) - { - if (distance(instances[idx].pos.xyz, ubo.cameraPos.xyz) < lods[i].distance) - { - lodLevel = i; - break; - } - } - indirectDraws[idx].firstIndex = lods[lodLevel].firstIndex; - indirectDraws[idx].indexCount = lods[lodLevel].indexCount; - // Update stats - atomicAdd(uboOut.lodCount[lodLevel], 1); - } - else - { - indirectDraws[idx].instanceCount = 0; - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computecullandlod/indirectdraw.frag b/tests/glsl/sascha-willems/computecullandlod/indirectdraw.frag deleted file mode 100644 index c1e2240f3..000000000 --- a/tests/glsl/sascha-willems/computecullandlod/indirectdraw.frag +++ /dev/null @@ -1,21 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 ambient = vec3(0.25); - vec3 diffuse = vec3(max(dot(N, L), 0.0)); - outFragColor = vec4((ambient + diffuse) * inColor, 1.0); -} diff --git a/tests/glsl/sascha-willems/computecullandlod/indirectdraw.vert b/tests/glsl/sascha-willems/computecullandlod/indirectdraw.vert deleted file mode 100644 index 3f4a4b8c2..000000000 --- a/tests/glsl/sascha-willems/computecullandlod/indirectdraw.vert +++ /dev/null @@ -1,46 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// Vertex attributes -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -// Instanced attributes -layout (location = 4) in vec3 instancePos; -layout (location = 5) in float instanceScale; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - - outNormal = inNormal; - - vec4 pos = vec4((inPos.xyz * instanceScale) + instancePos, 1.0); - - gl_Position = ubo.projection * ubo.modelview * pos; - - vec4 wPos = ubo.modelview * vec4(pos.xyz, 1.0); - vec4 lPos = vec4(0.0, 10.0, 50.0, 1.0); - outLightVec = lPos.xyz - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/computenbody/particle.frag b/tests/glsl/sascha-willems/computenbody/particle.frag deleted file mode 100644 index e67d2e00f..000000000 --- a/tests/glsl/sascha-willems/computenbody/particle.frag +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerColorMap; -layout (binding = 1) uniform sampler2D samplerGradientRamp; - -layout (location = 0) in float inGradientPos; - -layout (location = 0) out vec4 outFragColor; - -void main () -{ - vec3 color = texture(samplerGradientRamp, vec2(inGradientPos, 0.0)).rgb; - outFragColor.rgb = texture(samplerColorMap, gl_PointCoord).rgb * color; -} diff --git a/tests/glsl/sascha-willems/computenbody/particle.vert b/tests/glsl/sascha-willems/computenbody/particle.vert deleted file mode 100644 index eedd185d9..000000000 --- a/tests/glsl/sascha-willems/computenbody/particle.vert +++ /dev/null @@ -1,36 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec4 inVel; - -layout (location = 0) out float outGradientPos; - -layout (binding = 2) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec2 screendim; -} ubo; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; -}; - -void main () -{ - const float spriteSize = 0.005 * inPos.w; // Point size influenced by mass (stored in inPos.w); - - vec4 eyePos = ubo.modelview * vec4(inPos.x, inPos.y, inPos.z, 1.0); - vec4 projectedCorner = ubo.projection * vec4(0.5 * spriteSize, 0.5 * spriteSize, eyePos.z, eyePos.w); - gl_PointSize = clamp(ubo.screendim.x * projectedCorner.x / projectedCorner.w, 1.0, 128.0); - - gl_Position = ubo.projection * eyePos; - - outGradientPos = inVel.w; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computenbody/particle_calculate.comp b/tests/glsl/sascha-willems/computenbody/particle_calculate.comp deleted file mode 100644 index 82cbe35a0..000000000 --- a/tests/glsl/sascha-willems/computenbody/particle_calculate.comp +++ /dev/null @@ -1,75 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -struct Particle -{ - vec4 pos; - vec4 vel; -}; - -// Binding 0 : Position storage buffer -layout(std140, binding = 0) buffer Pos -{ - Particle particles[ ]; -}; - -layout (local_size_x = 256) in; - -layout (binding = 1) uniform UBO -{ - float deltaT; - float destX; - float destY; - int particleCount; -} ubo; - -layout (constant_id = 0) const int SHARED_DATA_SIZE = 512; -layout (constant_id = 1) const float GRAVITY = 0.002; -layout (constant_id = 2) const float POWER = 0.75; -layout (constant_id = 3) const float SOFTEN = 0.0075; - -// Share data between computer shader invocations to speed up caluclations -shared vec4 sharedData[SHARED_DATA_SIZE]; - -void main() -{ - // Current SSBO index - uint index = gl_GlobalInvocationID.x; - if (index >= ubo.particleCount) - return; - - vec4 position = particles[index].pos; - vec4 velocity = particles[index].vel; - vec4 acceleration = vec4(0.0); - - for (int i = 0; i < ubo.particleCount; i += SHARED_DATA_SIZE) - { - if (i + gl_LocalInvocationID.x < ubo.particleCount) - { - sharedData[gl_LocalInvocationID.x] = particles[i + gl_LocalInvocationID.x].pos; - } - else - { - sharedData[gl_LocalInvocationID.x] = vec4(0.0); - } - - memoryBarrierShared(); - - for (int j = 0; j < gl_WorkGroupSize.x; j++) - { - vec4 other = sharedData[j]; - vec3 len = other.xyz - position.xyz; - acceleration.xyz += GRAVITY * len * other.w / pow(dot(len, len) + SOFTEN, POWER); - } - } - - particles[index].vel.xyz += ubo.deltaT * acceleration.xyz; - - // Gradient texture position - particles[index].vel.w += 0.1 * ubo.deltaT; - if (particles[index].vel.w > 1.0) - particles[index].vel.w -= 1.0; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computenbody/particle_integrate.comp b/tests/glsl/sascha-willems/computenbody/particle_integrate.comp deleted file mode 100644 index 7085bee01..000000000 --- a/tests/glsl/sascha-willems/computenbody/particle_integrate.comp +++ /dev/null @@ -1,36 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -struct Particle -{ - vec4 pos; - vec4 vel; -}; - -// Binding 0 : Position storage buffer -layout(std140, binding = 0) buffer Pos -{ - Particle particles[ ]; -}; - -layout (local_size_x = 256) in; - -layout (binding = 1) uniform UBO -{ - float deltaT; - float destX; - float destY; - int particleCount; -} ubo; - -void main() -{ - int index = int(gl_GlobalInvocationID); - vec4 position = particles[index].pos; - vec4 velocity = particles[index].vel; - position += ubo.deltaT * velocity; - particles[index].pos = position; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computeparticles/particle.comp b/tests/glsl/sascha-willems/computeparticles/particle.comp deleted file mode 100644 index 4faf181a4..000000000 --- a/tests/glsl/sascha-willems/computeparticles/particle.comp +++ /dev/null @@ -1,80 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -struct Particle -{ - vec2 pos; - vec2 vel; - vec4 gradientPos; -}; - -// Binding 0 : Position storage buffer -layout(std140, binding = 0) buffer Pos -{ - Particle particles[ ]; -}; - -layout (local_size_x = 256) in; - -layout (binding = 1) uniform UBO -{ - float deltaT; - float destX; - float destY; - int particleCount; -} ubo; - -vec2 attraction(vec2 pos, vec2 attractPos) -{ - vec2 delta = attractPos - pos; - const float damp = 0.5; - float dDampedDot = dot(delta, delta) + damp; - float invDist = 1.0f / sqrt(dDampedDot); - float invDistCubed = invDist*invDist*invDist; - return delta * invDistCubed * 0.0035; -} - -vec2 repulsion(vec2 pos, vec2 attractPos) -{ - vec2 delta = attractPos - pos; - float targetDistance = sqrt(dot(delta, delta)); - return delta * (1.0 / (targetDistance * targetDistance * targetDistance)) * -0.000035; -} - -void main() -{ - // Current SSBO index - uint index = gl_GlobalInvocationID.x; - // Don't try to write beyond particle count - if (index >= ubo.particleCount) - return; - - // Read position and velocity - vec2 vVel = particles[index].vel.xy; - vec2 vPos = particles[index].pos.xy; - - vec2 destPos = vec2(ubo.destX, ubo.destY); - - vec2 delta = destPos - vPos; - float targetDistance = sqrt(dot(delta, delta)); - vVel += repulsion(vPos, destPos.xy) * 0.05; - - // Move by velocity - vPos += vVel * ubo.deltaT; - - // collide with boundary - if ((vPos.x < -1.0) || (vPos.x > 1.0) || (vPos.y < -1.0) || (vPos.y > 1.0)) - vVel = (-vVel * 0.1) + attraction(vPos, destPos) * 12; - else - particles[index].pos.xy = vPos; - - // Write back - particles[index].vel.xy = vVel; - particles[index].gradientPos.x += 0.02 * ubo.deltaT; - if (particles[index].gradientPos.x > 1.0) - particles[index].gradientPos.x -= 1.0; -} - diff --git a/tests/glsl/sascha-willems/computeparticles/particle.frag b/tests/glsl/sascha-willems/computeparticles/particle.frag deleted file mode 100644 index ac6077261..000000000 --- a/tests/glsl/sascha-willems/computeparticles/particle.frag +++ /dev/null @@ -1,19 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerColorMap; -layout (binding = 1) uniform sampler2D samplerGradientRamp; - -layout (location = 0) in vec4 inColor; -layout (location = 1) in float inGradientPos; - -layout (location = 0) out vec4 outFragColor; - -void main () -{ - vec3 color = texture(samplerGradientRamp, vec2(inGradientPos, 0.0)).rgb; - outFragColor.rgb = texture(samplerColorMap, gl_PointCoord).rgb * color; -} diff --git a/tests/glsl/sascha-willems/computeparticles/particle.vert b/tests/glsl/sascha-willems/computeparticles/particle.vert deleted file mode 100644 index b134c4898..000000000 --- a/tests/glsl/sascha-willems/computeparticles/particle.vert +++ /dev/null @@ -1,25 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec2 inPos; -layout (location = 1) in vec4 inGradientPos; - -layout (location = 0) out vec4 outColor; -layout (location = 1) out float outGradientPos; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; -}; - -void main () -{ - gl_PointSize = 8.0; - outColor = vec4(0.035); - outGradientPos = inGradientPos.x; - gl_Position = vec4(inPos.xy, 1.0, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computeshader/edgedetect.comp b/tests/glsl/sascha-willems/computeshader/edgedetect.comp deleted file mode 100644 index 0c6bb32fa..000000000 --- a/tests/glsl/sascha-willems/computeshader/edgedetect.comp +++ /dev/null @@ -1,48 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (local_size_x = 16, local_size_y = 16) in; -layout (binding = 0, rgba8) uniform readonly image2D inputImage; -layout (binding = 1, rgba8) uniform image2D resultImage; - -float conv(in float[9] kernel, in float[9] data, in float denom, in float offset) -{ - float res = 0.0; - for (int i=0; i<9; ++i) - { - res += kernel[i] * data[i]; - } - return clamp(res/denom + offset, 0.0, 1.0); -} - -struct ImageData -{ - float avg[9]; -} imageData; - -void main() -{ - // Fetch neighbouring texels - int n = -1; - for (int i=-1; i<2; ++i) - { - for(int j=-1; j<2; ++j) - { - n++; - vec3 rgb = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x + i, gl_GlobalInvocationID.y + j)).rgb; - imageData.avg[n] = (rgb.r + rgb.g + rgb.b) / 3.0; - } - } - - float[9] kernel; - kernel[0] = -1.0/8.0; kernel[1] = -1.0/8.0; kernel[2] = -1.0/8.0; - kernel[3] = -1.0/8.0; kernel[4] = 1.0; kernel[5] = -1.0/8.0; - kernel[6] = -1.0/8.0; kernel[7] = -1.0/8.0; kernel[8] = -1.0/8.0; - - vec4 res = vec4(vec3(conv(kernel, imageData.avg, 0.1, 0.0)), 1.0); - - imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), res); -} diff --git a/tests/glsl/sascha-willems/computeshader/emboss.comp b/tests/glsl/sascha-willems/computeshader/emboss.comp deleted file mode 100644 index ad0fef510..000000000 --- a/tests/glsl/sascha-willems/computeshader/emboss.comp +++ /dev/null @@ -1,48 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (local_size_x = 16, local_size_y = 16) in; -layout (binding = 0, rgba8) uniform readonly image2D inputImage; -layout (binding = 1, rgba8) uniform image2D resultImage; - -float conv(in float[9] kernel, in float[9] data, in float denom, in float offset) -{ - float res = 0.0; - for (int i=0; i<9; ++i) - { - res += kernel[i] * data[i]; - } - return clamp(res/denom + offset, 0.0, 1.0); -} - -struct ImageData -{ - float avg[9]; -} imageData; - -void main() -{ - // Fetch neighbouring texels - int n = -1; - for (int i=-1; i<2; ++i) - { - for(int j=-1; j<2; ++j) - { - n++; - vec3 rgb = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x + i, gl_GlobalInvocationID.y + j)).rgb; - imageData.avg[n] = (rgb.r + rgb.g + rgb.b) / 3.0; - } - } - - float[9] kernel; - kernel[0] = -1.0; kernel[1] = 0.0; kernel[2] = 0.0; - kernel[3] = 0.0; kernel[4] = -1.0; kernel[5] = 0.0; - kernel[6] = 0.0; kernel[7] = 0.0; kernel[8] = 2.0; - - vec4 res = vec4(vec3(conv(kernel, imageData.avg, 1.0, 0.50)), 1.0); - - imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), res); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computeshader/sharpen.comp b/tests/glsl/sascha-willems/computeshader/sharpen.comp deleted file mode 100644 index dc71ae447..000000000 --- a/tests/glsl/sascha-willems/computeshader/sharpen.comp +++ /dev/null @@ -1,57 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (local_size_x = 16, local_size_y = 16) in; -layout (binding = 0, rgba8) uniform readonly image2D inputImage; -layout (binding = 1, rgba8) uniform image2D resultImage; - -float conv(in float[9] kernel, in float[9] data, in float denom, in float offset) -{ - float res = 0.0; - for (int i=0; i<9; ++i) - { - res += kernel[i] * data[i]; - } - return clamp(res/denom + offset, 0.0, 1.0); -} - -struct ImageData -{ - float r[9]; - float g[9]; - float b[9]; -} imageData; - -void main() -{ - - // Fetch neighbouring texels - int n = -1; - for (int i=-1; i<2; ++i) - { - for(int j=-1; j<2; ++j) - { - n++; - vec3 rgb = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x + i, gl_GlobalInvocationID.y + j)).rgb; - imageData.r[n] = rgb.r; - imageData.g[n] = rgb.g; - imageData.b[n] = rgb.b; - } - } - - float[9] kernel; - kernel[0] = -1.0; kernel[1] = -1.0; kernel[2] = -1.0; - kernel[3] = -1.0; kernel[4] = 9.0; kernel[5] = -1.0; - kernel[6] = -1.0; kernel[7] = -1.0; kernel[8] = -1.0; - - vec4 res = vec4( - conv(kernel, imageData.r, 1.0, 0.0), - conv(kernel, imageData.g, 1.0, 0.0), - conv(kernel, imageData.b, 1.0, 0.0), - 1.0); - - imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), res); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computeshader/texture.frag b/tests/glsl/sascha-willems/computeshader/texture.frag deleted file mode 100644 index 6d54f2f33..000000000 --- a/tests/glsl/sascha-willems/computeshader/texture.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerColor, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/computeshader/texture.vert b/tests/glsl/sascha-willems/computeshader/texture.vert deleted file mode 100644 index c1ad3e070..000000000 --- a/tests/glsl/sascha-willems/computeshader/texture.vert +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/cubemap/reflect.frag b/tests/glsl/sascha-willems/cubemap/reflect.frag deleted file mode 100644 index 2ee1d95e7..000000000 --- a/tests/glsl/sascha-willems/cubemap/reflect.frag +++ /dev/null @@ -1,36 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube samplerColor; - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in float inLodBias; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; -layout (location = 5) in mat4 inInvModelView; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 cI = normalize (inPos); - vec3 cR = reflect (cI, normalize(inNormal)); - - cR = vec3(inInvModelView * vec4(cR, 0.0)); - cR.x *= -1.0; - - vec4 color = texture(samplerColor, cR, inLodBias); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 ambient = vec3(0.5) * color.rgb; - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.5); - outFragColor = vec4(ambient + diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/cubemap/reflect.vert b/tests/glsl/sascha-willems/cubemap/reflect.vert deleted file mode 100644 index dcf746738..000000000 --- a/tests/glsl/sascha-willems/cubemap/reflect.vert +++ /dev/null @@ -1,42 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - float lodBias; -} ubo; - -layout (location = 0) out vec3 outPos; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out float outLodBias; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; -layout (location = 5) out mat4 outInvModelView; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - outPos = vec3(ubo.model * vec4(inPos, 1.0)); - outNormal = mat3(ubo.model) * inNormal; - outLodBias = ubo.lodBias; - - outInvModelView = inverse(ubo.model); - - vec3 lightPos = vec3(0.0f, -5.0f, 5.0f); - outLightVec = lightPos.xyz - outPos.xyz; - outViewVec = -outPos.xyz; -} diff --git a/tests/glsl/sascha-willems/cubemap/skybox.frag b/tests/glsl/sascha-willems/cubemap/skybox.frag deleted file mode 100644 index 611eb37db..000000000 --- a/tests/glsl/sascha-willems/cubemap/skybox.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube samplerCubeMap; - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerCubeMap, inUVW); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/cubemap/skybox.vert b/tests/glsl/sascha-willems/cubemap/skybox.vert deleted file mode 100644 index 7011212e0..000000000 --- a/tests/glsl/sascha-willems/cubemap/skybox.vert +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - outUVW.x *= -1.0; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/debugmarker/colorpass.frag b/tests/glsl/sascha-willems/debugmarker/colorpass.frag deleted file mode 100644 index de5dcb4dc..000000000 --- a/tests/glsl/sascha-willems/debugmarker/colorpass.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor.rgb = inColor; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/debugmarker/colorpass.vert b/tests/glsl/sascha-willems/debugmarker/colorpass.vert deleted file mode 100644 index 46b93f8dc..000000000 --- a/tests/glsl/sascha-willems/debugmarker/colorpass.vert +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - { - outColor = inColor; - } - gl_Position = ubo.projection * ubo.model * inPos; -} diff --git a/tests/glsl/sascha-willems/debugmarker/postprocess.frag b/tests/glsl/sascha-willems/debugmarker/postprocess.frag deleted file mode 100644 index 0546baaa4..000000000 --- a/tests/glsl/sascha-willems/debugmarker/postprocess.frag +++ /dev/null @@ -1,43 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // Single pass gauss blur - - const vec2 texOffset = vec2(0.01, 0.01); - - vec2 tc0 = inUV + vec2(-texOffset.s, -texOffset.t); - vec2 tc1 = inUV + vec2( 0.0, -texOffset.t); - vec2 tc2 = inUV + vec2(+texOffset.s, -texOffset.t); - vec2 tc3 = inUV + vec2(-texOffset.s, 0.0); - vec2 tc4 = inUV + vec2( 0.0, 0.0); - vec2 tc5 = inUV + vec2(+texOffset.s, 0.0); - vec2 tc6 = inUV + vec2(-texOffset.s, +texOffset.t); - vec2 tc7 = inUV + vec2( 0.0, +texOffset.t); - vec2 tc8 = inUV + vec2(+texOffset.s, +texOffset.t); - - vec4 col0 = texture(samplerColor, tc0); - vec4 col1 = texture(samplerColor, tc1); - vec4 col2 = texture(samplerColor, tc2); - vec4 col3 = texture(samplerColor, tc3); - vec4 col4 = texture(samplerColor, tc4); - vec4 col5 = texture(samplerColor, tc5); - vec4 col6 = texture(samplerColor, tc6); - vec4 col7 = texture(samplerColor, tc7); - vec4 col8 = texture(samplerColor, tc8); - - vec4 sum = (1.0 * col0 + 2.0 * col1 + 1.0 * col2 + - 2.0 * col3 + 4.0 * col4 + 2.0 * col5 + - 1.0 * col6 + 2.0 * col7 + 1.0 * col8) / 16.0; - outFragColor = vec4(sum.rgb, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/debugmarker/postprocess.vert b/tests/glsl/sascha-willems/debugmarker/postprocess.vert deleted file mode 100644 index 6a368e9b6..000000000 --- a/tests/glsl/sascha-willems/debugmarker/postprocess.vert +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * vec2(2.0f, 2.0f) + vec2(-1.0f, -1.0f), 0.0f, 1.0f); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/debugmarker/toon.frag b/tests/glsl/sascha-willems/debugmarker/toon.frag deleted file mode 100644 index ed9832f11..000000000 --- a/tests/glsl/sascha-willems/debugmarker/toon.frag +++ /dev/null @@ -1,40 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // Desaturate color - vec3 color = vec3(mix(inColor, vec3(dot(vec3(0.2126,0.7152,0.0722), inColor)), 0.65)); - - // High ambient colors because mesh materials are pretty dark - vec3 ambient = color * vec3(1.0); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * color; - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outFragColor = vec4(ambient + diffuse * 1.75 + specular, 1.0); - - float intensity = dot(N,L); - float shade = 1.0; - shade = intensity < 0.5 ? 0.75 : shade; - shade = intensity < 0.35 ? 0.6 : shade; - shade = intensity < 0.25 ? 0.5 : shade; - shade = intensity < 0.1 ? 0.25 : shade; - - outFragColor.rgb = inColor * 3.0 * shade; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/debugmarker/toon.vert b/tests/glsl/sascha-willems/debugmarker/toon.vert deleted file mode 100644 index d0b3be251..000000000 --- a/tests/glsl/sascha-willems/debugmarker/toon.vert +++ /dev/null @@ -1,42 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferred/debug.frag b/tests/glsl/sascha-willems/deferred/debug.frag deleted file mode 100644 index 6b77990b5..000000000 --- a/tests/glsl/sascha-willems/deferred/debug.frag +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerPosition; -layout (binding = 2) uniform sampler2D samplerNormal; -layout (binding = 3) uniform sampler2D samplerAlbedo; - -layout (location = 0) in vec3 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 components[3]; - components[0] = texture(samplerPosition, inUV.st).rgb; - components[1] = texture(samplerNormal, inUV.st).rgb; - components[2] = texture(samplerAlbedo, inUV.st).rgb; - // Uncomment to display specular component - //components[2] = vec3(texture(samplerAlbedo, inUV.st).a); - - // Select component depending on z coordinate of quad - highp int index = int(inUV.z); - outFragColor.rgb = components[index]; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferred/debug.vert b/tests/glsl/sascha-willems/deferred/debug.vert deleted file mode 100644 index de1b380f6..000000000 --- a/tests/glsl/sascha-willems/deferred/debug.vert +++ /dev/null @@ -1,28 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 3) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec3(inUV.st, inNormal.z); - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/deferred/deferred.frag b/tests/glsl/sascha-willems/deferred/deferred.frag deleted file mode 100644 index aead2f872..000000000 --- a/tests/glsl/sascha-willems/deferred/deferred.frag +++ /dev/null @@ -1,76 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerposition; -layout (binding = 2) uniform sampler2D samplerNormal; -layout (binding = 3) uniform sampler2D samplerAlbedo; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragcolor; - -struct Light { - vec4 position; - vec3 color; - float radius; -}; - -layout (binding = 4) uniform UBO -{ - Light lights[6]; - vec4 viewPos; -} ubo; - - -void main() -{ - // Get G-Buffer values - vec3 fragPos = texture(samplerposition, inUV).rgb; - vec3 normal = texture(samplerNormal, inUV).rgb; - vec4 albedo = texture(samplerAlbedo, inUV); - - #define lightCount 6 - #define ambient 0.0 - - // Ambient part - vec3 fragcolor = albedo.rgb * ambient; - - for(int i = 0; i < lightCount; ++i) - { - // Vector to light - vec3 L = ubo.lights[i].position.xyz - fragPos; - // Distance from light to fragment position - float dist = length(L); - - // Viewer to fragment - vec3 V = ubo.viewPos.xyz - fragPos; - V = normalize(V); - - //if(dist < ubo.lights[i].radius) - { - // Light to fragment - L = normalize(L); - - // Attenuation - float atten = ubo.lights[i].radius / (pow(dist, 2.0) + 1.0); - - // Diffuse part - vec3 N = normalize(normal); - float NdotL = max(0.0, dot(N, L)); - vec3 diff = ubo.lights[i].color * albedo.rgb * NdotL * atten; - - // Specular part - // Specular map values are stored in alpha of albedo mrt - vec3 R = reflect(-L, N); - float NdotR = max(0.0, dot(R, V)); - vec3 spec = ubo.lights[i].color * albedo.a * pow(NdotR, 16.0) * atten; - - fragcolor += diff + spec; - } - } - - outFragcolor = vec4(fragcolor, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferred/deferred.vert b/tests/glsl/sascha-willems/deferred/deferred.vert deleted file mode 100644 index 548284554..000000000 --- a/tests/glsl/sascha-willems/deferred/deferred.vert +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/deferred/mrt.frag b/tests/glsl/sascha-willems/deferred/mrt.frag deleted file mode 100644 index 4bd2a10a5..000000000 --- a/tests/glsl/sascha-willems/deferred/mrt.frag +++ /dev/null @@ -1,34 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; -layout (binding = 2) uniform sampler2D samplerNormalMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inWorldPos; -layout (location = 4) in vec3 inTangent; - -layout (location = 0) out vec4 outPosition; -layout (location = 1) out vec4 outNormal; -layout (location = 2) out vec4 outAlbedo; - -void main() -{ - outPosition = vec4(inWorldPos, 1.0); - - // Calculate normal in tangent space - vec3 N = normalize(inNormal); - N.y = -N.y; - vec3 T = normalize(inTangent); - vec3 B = cross(N, T); - mat3 TBN = mat3(T, B, N); - vec3 tnorm = TBN * normalize(texture(samplerNormalMap, inUV).xyz * 2.0 - vec3(1.0)); - outNormal = vec4(tnorm, 1.0); - - outAlbedo = texture(samplerColor, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferred/mrt.vert b/tests/glsl/sascha-willems/deferred/mrt.vert deleted file mode 100644 index 26f764176..000000000 --- a/tests/glsl/sascha-willems/deferred/mrt.vert +++ /dev/null @@ -1,53 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; -layout (location = 4) in vec3 inTangent; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec4 instancePos[3]; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outColor; -layout (location = 3) out vec3 outWorldPos; -layout (location = 4) out vec3 outTangent; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec4 tmpPos = inPos + ubo.instancePos[gl_InstanceIndex]; - - gl_Position = ubo.projection * ubo.view * ubo.model * tmpPos; - - outUV = inUV; - outUV.t = 1.0 - outUV.t; - - // Vertex position in world space - outWorldPos = vec3(ubo.model * tmpPos); - // GL to Vulkan coord space - outWorldPos.y = -outWorldPos.y; - - // Normal in world space - mat3 mNormal = transpose(inverse(mat3(ubo.model))); - outNormal = mNormal * normalize(inNormal); - outTangent = mNormal * normalize(inTangent); - - // Currently just vertex color - outColor = inColor; -} diff --git a/tests/glsl/sascha-willems/deferredmultisampling/debug.frag b/tests/glsl/sascha-willems/deferredmultisampling/debug.frag deleted file mode 100644 index f404711dd..000000000 --- a/tests/glsl/sascha-willems/deferredmultisampling/debug.frag +++ /dev/null @@ -1,56 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2DMS samplerPosition; -layout (binding = 2) uniform sampler2DMS samplerNormal; -layout (binding = 3) uniform sampler2DMS samplerAlbedo; - -layout (location = 0) in vec3 inUV; - -layout (location = 0) out vec4 outFragColor; - -#define NUM_SAMPLES 8 - -vec4 resolve(sampler2DMS tex, ivec2 uv) -{ - vec4 result = vec4(0.0); - int count = 0; - for (int i = 0; i < NUM_SAMPLES; i++) - { - vec4 val = texelFetch(tex, uv, i); - result += val; - count++; - } - return result / float(NUM_SAMPLES); -} - -void main() -{ - ivec2 attDim = textureSize(samplerPosition); - ivec2 UV = ivec2(inUV.st * attDim * 2.0); - - highp int index = 0; - if (inUV.s > 0.5) - { - index = 1; - UV.s -= attDim.x; - } - if (inUV.t > 0.5) - { - index = 2; - UV.t -= attDim.y; - } - - vec3 components[3]; - components[0] = resolve(samplerPosition, UV).rgb; - components[1] = resolve(samplerNormal, UV).rgb; - components[2] = resolve(samplerAlbedo, UV).rgb; - // Uncomment to display specular component - //components[2] = vec3(texture(samplerAlbedo, inUV.st).a); - - // Select component depending on UV - outFragColor.rgb = components[index]; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredmultisampling/debug.vert b/tests/glsl/sascha-willems/deferredmultisampling/debug.vert deleted file mode 100644 index c62c3364a..000000000 --- a/tests/glsl/sascha-willems/deferredmultisampling/debug.vert +++ /dev/null @@ -1,24 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec3((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2, 0.0); - gl_Position = vec4(outUV.st * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/deferredmultisampling/deferred.frag b/tests/glsl/sascha-willems/deferredmultisampling/deferred.frag deleted file mode 100644 index 59f855281..000000000 --- a/tests/glsl/sascha-willems/deferredmultisampling/deferred.frag +++ /dev/null @@ -1,104 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2DMS samplerPosition; -layout (binding = 2) uniform sampler2DMS samplerNormal; -layout (binding = 3) uniform sampler2DMS samplerAlbedo; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragcolor; - -struct Light { - vec4 position; - vec3 color; - float radius; -}; - -layout (binding = 4) uniform UBO -{ - Light lights[6]; - vec4 viewPos; - ivec2 windowSize; -} ubo; - -layout (constant_id = 0) const int NUM_SAMPLES = 8; - -#define NUM_LIGHTS 6 - -// Manual resolve for MSAA samples -vec4 resolve(sampler2DMS tex, ivec2 uv) -{ - vec4 result = vec4(0.0); - for (int i = 0; i < NUM_SAMPLES; i++) - { - vec4 val = texelFetch(tex, uv, i); - result += val; - } - // Average resolved samples - return result / float(NUM_SAMPLES); -} - -vec3 calculateLighting(vec3 pos, vec3 normal, vec4 albedo) -{ - vec3 result = vec3(0.0); - - for(int i = 0; i < NUM_LIGHTS; ++i) - { - // Vector to light - vec3 L = ubo.lights[i].position.xyz - pos; - // Distance from light to fragment position - float dist = length(L); - - // Viewer to fragment - vec3 V = ubo.viewPos.xyz - pos; - V = normalize(V); - - // Light to fragment - L = normalize(L); - - // Attenuation - float atten = ubo.lights[i].radius / (pow(dist, 2.0) + 1.0); - - // Diffuse part - vec3 N = normalize(normal); - float NdotL = max(0.0, dot(N, L)); - vec3 diff = ubo.lights[i].color * albedo.rgb * NdotL * atten; - - // Specular part - vec3 R = reflect(-L, N); - float NdotR = max(0.0, dot(R, V)); - vec3 spec = ubo.lights[i].color * albedo.a * pow(NdotR, 8.0) * atten; - - result += diff + spec; - } - return result; -} - -void main() -{ - ivec2 attDim = textureSize(samplerPosition); - ivec2 UV = ivec2(inUV * attDim); - - #define ambient 0.15 - - // Ambient part - vec4 alb = resolve(samplerAlbedo, UV); - vec3 fragColor = vec3(0.0); - - // Calualte lighting for every MSAA sample - for (int i = 0; i < NUM_SAMPLES; i++) - { - vec3 pos = texelFetch(samplerPosition, UV, i).rgb; - vec3 normal = texelFetch(samplerNormal, UV, i).rgb; - vec4 albedo = texelFetch(samplerAlbedo, UV, i); - fragColor += calculateLighting(pos, normal, albedo); - } - - fragColor = (alb.rgb * ambient) + fragColor / float(NUM_SAMPLES); - - outFragcolor = vec4(fragColor, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredmultisampling/deferred.vert b/tests/glsl/sascha-willems/deferredmultisampling/deferred.vert deleted file mode 100644 index af8eef6dd..000000000 --- a/tests/glsl/sascha-willems/deferredmultisampling/deferred.vert +++ /dev/null @@ -1,24 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/deferredmultisampling/mrt.frag b/tests/glsl/sascha-willems/deferredmultisampling/mrt.frag deleted file mode 100644 index 4bd2a10a5..000000000 --- a/tests/glsl/sascha-willems/deferredmultisampling/mrt.frag +++ /dev/null @@ -1,34 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; -layout (binding = 2) uniform sampler2D samplerNormalMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inWorldPos; -layout (location = 4) in vec3 inTangent; - -layout (location = 0) out vec4 outPosition; -layout (location = 1) out vec4 outNormal; -layout (location = 2) out vec4 outAlbedo; - -void main() -{ - outPosition = vec4(inWorldPos, 1.0); - - // Calculate normal in tangent space - vec3 N = normalize(inNormal); - N.y = -N.y; - vec3 T = normalize(inTangent); - vec3 B = cross(N, T); - mat3 TBN = mat3(T, B, N); - vec3 tnorm = TBN * normalize(texture(samplerNormalMap, inUV).xyz * 2.0 - vec3(1.0)); - outNormal = vec4(tnorm, 1.0); - - outAlbedo = texture(samplerColor, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredmultisampling/mrt.vert b/tests/glsl/sascha-willems/deferredmultisampling/mrt.vert deleted file mode 100644 index 5cc127297..000000000 --- a/tests/glsl/sascha-willems/deferredmultisampling/mrt.vert +++ /dev/null @@ -1,53 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; -layout (location = 4) in vec3 inTangent; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec4 instancePos[3]; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outColor; -layout (location = 3) out vec3 outWorldPos; -layout (location = 4) out vec3 outTangent; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec4 tmpPos = vec4(inPos.xyz, 1.0) + ubo.instancePos[gl_InstanceIndex]; - - gl_Position = ubo.projection * ubo.view * ubo.model * tmpPos; - - outUV = inUV; - outUV.t = 1.0 - outUV.t; - - // Vertex position in world space - outWorldPos = vec3(ubo.model * tmpPos); - // GL to Vulkan coord space - outWorldPos.y = -outWorldPos.y; - - // Normal in world space - mat3 mNormal = transpose(inverse(mat3(ubo.model))); - outNormal = mNormal * normalize(inNormal); - outTangent = mNormal * normalize(inTangent); - - // Currently just vertex color - outColor = inColor; -} diff --git a/tests/glsl/sascha-willems/deferredshadows/debug.frag b/tests/glsl/sascha-willems/deferredshadows/debug.frag deleted file mode 100644 index f9136b24d..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/debug.frag +++ /dev/null @@ -1,30 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerPosition; -layout (binding = 2) uniform sampler2D samplerNormal; -layout (binding = 3) uniform sampler2D samplerAlbedo; -layout (binding = 5) uniform sampler2DArray samplerDepth; - -layout (location = 0) in vec3 inUV; - -layout (location = 0) out vec4 outFragColor; - -float LinearizeDepth(float depth) -{ - float n = 0.1; // camera z near - float f = 64.0; // camera z far - float z = depth; - return (2.0 * n) / (f + n - z * (f - n)); -} - -void main() -{ - // Display depth from light's point-of-view - // inUV.w = number of light source - float depth = texture(samplerDepth, vec3(inUV)).r; - outFragColor = vec4(vec3(1.0 - LinearizeDepth(depth)), 0.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredshadows/debug.vert b/tests/glsl/sascha-willems/deferredshadows/debug.vert deleted file mode 100644 index 8742202c2..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/debug.vert +++ /dev/null @@ -1,30 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec3 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec3(inUV.st, gl_InstanceIndex); - vec4 tmpPos = vec4(inPos, 1.0); - tmpPos.y += gl_InstanceIndex; - tmpPos.xy *= vec2(1.0/4.0, 1.0/3.0); - gl_Position = ubo.projection * ubo.modelview * tmpPos; -} diff --git a/tests/glsl/sascha-willems/deferredshadows/deferred.frag b/tests/glsl/sascha-willems/deferredshadows/deferred.frag deleted file mode 100644 index ba3998bd6..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/deferred.frag +++ /dev/null @@ -1,147 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerposition; -layout (binding = 2) uniform sampler2D samplerNormal; -layout (binding = 3) uniform sampler2D samplerAlbedo; -// Depth from the light's point of view -//layout (binding = 5) uniform sampler2DShadow samplerShadowMap; -layout (binding = 5) uniform sampler2DArray samplerShadowMap; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -#define LIGHT_COUNT 3 -#define SHADOW_FACTOR 0.25 -#define AMBIENT_LIGHT 0.1 -#define USE_PCF - -struct Light -{ - vec4 position; - vec4 target; - vec4 color; - mat4 viewMatrix; -}; - -layout (binding = 4) uniform UBO -{ - vec4 viewPos; - Light lights[LIGHT_COUNT]; - int useShadows; -} ubo; - -float textureProj(vec4 P, float layer, vec2 offset) -{ - float shadow = 1.0; - vec4 shadowCoord = P / P.w; - shadowCoord.st = shadowCoord.st * 0.5 + 0.5; - - if (shadowCoord.z > -1.0 && shadowCoord.z < 1.0) - { - float dist = texture(samplerShadowMap, vec3(shadowCoord.st + offset, layer)).r; - if (shadowCoord.w > 0.0 && dist < shadowCoord.z) - { - shadow = SHADOW_FACTOR; - } - } - return shadow; -} - -float filterPCF(vec4 sc, float layer) -{ - ivec2 texDim = textureSize(samplerShadowMap, 0).xy; - float scale = 1.5; - float dx = scale * 1.0 / float(texDim.x); - float dy = scale * 1.0 / float(texDim.y); - - float shadowFactor = 0.0; - int count = 0; - int range = 1; - - for (int x = -range; x <= range; x++) - { - for (int y = -range; y <= range; y++) - { - shadowFactor += textureProj(sc, layer, vec2(dx*x, dy*y)); - count++; - } - - } - return shadowFactor / count; -} - -void main() -{ - // Get G-Buffer values - vec3 fragPos = texture(samplerposition, inUV).rgb; - vec3 normal = texture(samplerNormal, inUV).rgb; - vec4 albedo = texture(samplerAlbedo, inUV); - - // Ambient part - vec3 fragcolor = albedo.rgb * AMBIENT_LIGHT; - - vec3 N = normalize(normal); - - float shadow = 0.0; - - for(int i = 0; i < LIGHT_COUNT; ++i) - { - // Vector to light - vec3 L = ubo.lights[i].position.xyz - fragPos; - // Distance from light to fragment position - float dist = length(L); - L = normalize(L); - - // Viewer to fragment - vec3 V = ubo.viewPos.xyz - fragPos; - V = normalize(V); - - float lightCosInnerAngle = cos(radians(15.0)); - float lightCosOuterAngle = cos(radians(25.0)); - float lightRange = 100.0; - - // Direction vector from source to target - vec3 dir = normalize(ubo.lights[i].position.xyz - ubo.lights[i].target.xyz); - - // Dual cone spot light with smooth transition between inner and outer angle - float cosDir = dot(L, dir); - float spotEffect = smoothstep(lightCosOuterAngle, lightCosInnerAngle, cosDir); - float heightAttenuation = smoothstep(lightRange, 0.0f, dist); - - // Diffuse lighting - float NdotL = max(0.0, dot(N, L)); - vec3 diff = vec3(NdotL); - - // Specular lighting - vec3 R = reflect(-L, N); - float NdotR = max(0.0, dot(R, V)); - vec3 spec = vec3(pow(NdotR, 16.0) * albedo.a * 2.5); - - fragcolor += vec3((diff + spec) * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb * albedo.rgb; - } - - // Shadow calculations in a separate pass - if (ubo.useShadows > 0) - { - for(int i = 0; i < LIGHT_COUNT; ++i) - { - vec4 shadowClip = ubo.lights[i].viewMatrix * vec4(fragPos, 1.0); - - float shadowFactor; - #ifdef USE_PCF - shadowFactor= filterPCF(shadowClip, i); - #else - shadowFactor = textureProj(shadowClip, i, vec2(0.0)); - #endif - - fragcolor *= shadowFactor; - } - } - - outFragColor.rgb = fragcolor; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredshadows/deferred.vert b/tests/glsl/sascha-willems/deferredshadows/deferred.vert deleted file mode 100644 index cd17f9726..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/deferred.vert +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/deferredshadows/mrt.frag b/tests/glsl/sascha-willems/deferredshadows/mrt.frag deleted file mode 100644 index 7a31f54e9..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/mrt.frag +++ /dev/null @@ -1,33 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; -layout (binding = 2) uniform sampler2D samplerNormalMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inWorldPos; -layout (location = 4) in vec3 inTangent; - -layout (location = 0) out vec4 outPosition; -layout (location = 1) out vec4 outNormal; -layout (location = 2) out vec4 outAlbedo; - -void main() -{ - outPosition = vec4(inWorldPos, 1.0); - - // Calculate normal in tangent space - vec3 N = normalize(inNormal); - vec3 T = normalize(inTangent); - vec3 B = cross(N, T); - mat3 TBN = mat3(T, B, N); - vec3 tnorm = TBN * normalize(texture(samplerNormalMap, inUV).xyz * 2.0 - vec3(1.0)); - outNormal = vec4(tnorm, 1.0); - - outAlbedo = texture(samplerColor, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredshadows/mrt.vert b/tests/glsl/sascha-willems/deferredshadows/mrt.vert deleted file mode 100644 index 815c2833f..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/mrt.vert +++ /dev/null @@ -1,51 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; -layout (location = 4) in vec3 inTangent; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec4 instancePos[3]; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outColor; -layout (location = 3) out vec3 outWorldPos; -layout (location = 4) out vec3 outTangent; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec4 tmpPos = inPos + ubo.instancePos[gl_InstanceIndex]; - - gl_Position = ubo.projection * ubo.view * ubo.model * tmpPos; - - outUV = inUV; - outUV.t = 1.0 - outUV.t; - - // Vertex position in world space - outWorldPos = vec3(ubo.model * tmpPos); - - // Normal in world space - mat3 mNormal = transpose(inverse(mat3(ubo.model))); - outNormal = mNormal * normalize(inNormal); - outTangent = mNormal * normalize(inTangent); - - // Currently just vertex color - outColor = inColor; -} diff --git a/tests/glsl/sascha-willems/deferredshadows/shadow.frag b/tests/glsl/sascha-willems/deferredshadows/shadow.frag deleted file mode 100644 index 23217ad42..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/shadow.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout(location = 0) out float fragmentdepth; - -void main() -{ - fragmentdepth = gl_FragCoord.z; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredshadows/shadow.geom b/tests/glsl/sascha-willems/deferredshadows/shadow.geom deleted file mode 100644 index 7f71c108a..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/shadow.geom +++ /dev/null @@ -1,36 +0,0 @@ -#version 420 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -#define LIGHT_COUNT 3 - -layout (triangles, invocations = LIGHT_COUNT) in; -layout (triangle_strip, max_vertices = 3) out; - -layout (binding = 0) uniform UBO -{ - mat4 mvp[LIGHT_COUNT]; - vec4 instancePos[3]; -} ubo; - -layout (location = 0) in int inInstanceIndex[]; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec4 instancedPos = ubo.instancePos[inInstanceIndex[0]]; - for (int i = 0; i < gl_in.length(); i++) - { - gl_Layer = gl_InvocationID; - vec4 tmpPos = gl_in[i].gl_Position + instancedPos; - gl_Position = ubo.mvp[gl_InvocationID] * tmpPos; - EmitVertex(); - } - EndPrimitive(); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/deferredshadows/shadow.vert b/tests/glsl/sascha-willems/deferredshadows/shadow.vert deleted file mode 100644 index b16c66414..000000000 --- a/tests/glsl/sascha-willems/deferredshadows/shadow.vert +++ /dev/null @@ -1,20 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; - -layout (location = 0) out int outInstanceIndex; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outInstanceIndex = gl_InstanceIndex; - gl_Position = inPos; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/displacement/base.frag b/tests/glsl/sascha-willems/displacement/base.frag deleted file mode 100644 index 3ab30270c..000000000 --- a/tests/glsl/sascha-willems/displacement/base.frag +++ /dev/null @@ -1,30 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 2) uniform sampler2D colorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inEyePos; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(vec3(1.0)); - - outFragColor.rgb = texture(colorMap, inUV).rgb; - - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec4 IAmbient = vec4(0.0, 0.0, 0.0, 1.0); - vec4 IDiffuse = vec4(1.0) * max(dot(inNormal, inLightVec), 0.0); - - outFragColor = vec4((IAmbient + IDiffuse) * vec4(texture(colorMap, inUV).rgb, 1.0)); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/displacement/base.vert b/tests/glsl/sascha-willems/displacement/base.vert deleted file mode 100644 index c684afabb..000000000 --- a/tests/glsl/sascha-willems/displacement/base.vert +++ /dev/null @@ -1,19 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; - -void main(void) -{ - gl_Position = vec4(inPos.xyz, 1.0); - outUV = inUV * 3.0; - outNormal = inNormal; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/displacement/displacement.tesc b/tests/glsl/sascha-willems/displacement/displacement.tesc deleted file mode 100644 index 73bf237c0..000000000 --- a/tests/glsl/sascha-willems/displacement/displacement.tesc +++ /dev/null @@ -1,33 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform UBO -{ - float tessLevel; -} ubo; - -layout (vertices = 3) out; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec2 inUV[]; - -layout (location = 0) out vec3 outNormal[3]; -layout (location = 1) out vec2 outUV[3]; - -void main() -{ - if (gl_InvocationID == 0) - { - gl_TessLevelInner[0] = ubo.tessLevel; - gl_TessLevelOuter[0] = ubo.tessLevel; - gl_TessLevelOuter[1] = ubo.tessLevel; - gl_TessLevelOuter[2] = ubo.tessLevel; - } - - gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; - outNormal[gl_InvocationID] = inNormal[gl_InvocationID]; - outUV[gl_InvocationID] = inUV[gl_InvocationID]; -} diff --git a/tests/glsl/sascha-willems/displacement/displacement.tese b/tests/glsl/sascha-willems/displacement/displacement.tese deleted file mode 100644 index bd061ec2a..000000000 --- a/tests/glsl/sascha-willems/displacement/displacement.tese +++ /dev/null @@ -1,40 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; - float tessAlpha; - float tessStrength; -} ubo; - -layout (binding = 2) uniform sampler2D displacementMap; - -layout(triangles, equal_spacing, ccw) in; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec2 inUV[]; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outEyesPos; -layout (location = 3) out vec3 outLightVec; - -void main() -{ - gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + (gl_TessCoord.y * gl_in[1].gl_Position) + (gl_TessCoord.z * gl_in[2].gl_Position); - outUV = gl_TessCoord.x * inUV[0] + gl_TessCoord.y * inUV[1] + gl_TessCoord.z * inUV[2]; - outNormal = gl_TessCoord.x * inNormal[0] + gl_TessCoord.y * inNormal[1] + gl_TessCoord.z * inNormal[2]; - - gl_Position.xyz += normalize(outNormal) * (max(textureLod(displacementMap, outUV.st, 0.0).a, 0.0) * ubo.tessStrength); - - outEyesPos = (gl_Position).xyz; - outLightVec = normalize(ubo.lightPos.xyz - outEyesPos); - - gl_Position = ubo.projection * ubo.model * gl_Position; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/distancefieldfonts/bitmap.frag b/tests/glsl/sascha-willems/distancefieldfonts/bitmap.frag deleted file mode 100644 index 5f6303c3c..000000000 --- a/tests/glsl/sascha-willems/distancefieldfonts/bitmap.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = vec4(texture(samplerColor, inUV).a); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/distancefieldfonts/bitmap.vert b/tests/glsl/sascha-willems/distancefieldfonts/bitmap.vert deleted file mode 100644 index 4ed4e6246..000000000 --- a/tests/glsl/sascha-willems/distancefieldfonts/bitmap.vert +++ /dev/null @@ -1,22 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; - -void main() -{ - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/distancefieldfonts/sdf.frag b/tests/glsl/sascha-willems/distancefieldfonts/sdf.frag deleted file mode 100644 index a0a4babb4..000000000 --- a/tests/glsl/sascha-willems/distancefieldfonts/sdf.frag +++ /dev/null @@ -1,36 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (binding = 2) uniform UBO -{ - vec4 outlineColor; - float outlineWidth; - float outline; -} ubo; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - float distance = texture(samplerColor, inUV).a; - float smoothWidth = fwidth(distance); - float alpha = smoothstep(0.5 - smoothWidth, 0.5 + smoothWidth, distance); - vec3 rgb = vec3(alpha); - - if (ubo.outline > 0.0) - { - float w = 1.0 - ubo.outlineWidth; - alpha = smoothstep(w - smoothWidth, w + smoothWidth, distance); - rgb += mix(vec3(alpha), ubo.outlineColor.rgb, alpha); - } - - outFragColor = vec4(rgb, alpha); - -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/distancefieldfonts/sdf.vert b/tests/glsl/sascha-willems/distancefieldfonts/sdf.vert deleted file mode 100644 index 4ed4e6246..000000000 --- a/tests/glsl/sascha-willems/distancefieldfonts/sdf.vert +++ /dev/null @@ -1,22 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; - -void main() -{ - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/dynamicuniformbuffer/base.frag b/tests/glsl/sascha-willems/dynamicuniformbuffer/base.frag deleted file mode 100644 index 496c70b14..000000000 --- a/tests/glsl/sascha-willems/dynamicuniformbuffer/base.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = vec4(inColor, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/dynamicuniformbuffer/base.vert b/tests/glsl/sascha-willems/dynamicuniformbuffer/base.vert deleted file mode 100644 index 5440e88d2..000000000 --- a/tests/glsl/sascha-willems/dynamicuniformbuffer/base.vert +++ /dev/null @@ -1,34 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inColor; - -layout (binding = 0) uniform UboView -{ - mat4 projection; - mat4 view; -} uboView; - -layout (binding = 1) uniform UboInstance -{ - mat4 model; -} uboInstance; - -layout (location = 0) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - mat4 modelView = uboView.view * uboInstance.model; - vec3 worldPos = vec3(modelView * vec4(inPos, 1.0)); - gl_Position = uboView.projection * modelView * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/gears/gears.frag b/tests/glsl/sascha-willems/gears/gears.frag deleted file mode 100644 index db3dcd5e2..000000000 --- a/tests/glsl/sascha-willems/gears/gears.frag +++ /dev/null @@ -1,25 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inEyePos; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec4 IAmbient = vec4(0.2, 0.2, 0.2, 1.0); - vec4 IDiffuse = vec4(0.5, 0.5, 0.5, 0.5) * max(dot(inNormal, inLightVec), 0.0); - float specular = 0.25; - vec4 ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 0.8) * specular; - - outFragColor = vec4((IAmbient + IDiffuse) * vec4(inColor, 1.0) + ISpecular); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/gears/gears.vert b/tests/glsl/sascha-willems/gears/gears.vert deleted file mode 100644 index 3799e0000..000000000 --- a/tests/glsl/sascha-willems/gears/gears.vert +++ /dev/null @@ -1,35 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 normal; - mat4 view; - vec3 lightpos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outEyePos; -layout (location = 3) out vec3 outLightVec; - -void main() -{ - outNormal = normalize(mat3(ubo.normal) * inNormal); - outColor = inColor; - mat4 modelView = ubo.view * ubo.model; - vec4 pos = modelView * inPos; - outEyePos = vec3(modelView * pos); - vec4 lightPos = vec4(ubo.lightpos, 1.0) * modelView; - outLightVec = normalize(lightPos.xyz - outEyePos); - gl_Position = ubo.projection * pos; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/geometryshader/base.frag b/tests/glsl/sascha-willems/geometryshader/base.frag deleted file mode 100644 index 768117a92..000000000 --- a/tests/glsl/sascha-willems/geometryshader/base.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main(void) -{ - outFragColor = vec4(inColor, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/geometryshader/base.vert b/tests/glsl/sascha-willems/geometryshader/base.vert deleted file mode 100644 index a3ba3830f..000000000 --- a/tests/glsl/sascha-willems/geometryshader/base.vert +++ /dev/null @@ -1,21 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; - -layout (location = 0) out vec3 outNormal; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main(void) -{ - outNormal = inNormal; - gl_Position = vec4(inPos.xyz, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/geometryshader/mesh.frag b/tests/glsl/sascha-willems/geometryshader/mesh.frag deleted file mode 100644 index d31ff7124..000000000 --- a/tests/glsl/sascha-willems/geometryshader/mesh.frag +++ /dev/null @@ -1,24 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 ambient = vec3(0.1); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outFragColor = vec4((ambient + diffuse) * inColor.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/geometryshader/mesh.vert b/tests/glsl/sascha-willems/geometryshader/mesh.vert deleted file mode 100644 index 4caae7b2e..000000000 --- a/tests/glsl/sascha-willems/geometryshader/mesh.vert +++ /dev/null @@ -1,39 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (set = 0, binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - gl_Position = ubo.projection * ubo.model * inPos; - - vec4 pos = ubo.model * vec4(inPos.xyz, 1.0); - outNormal = mat3(ubo.model) * inNormal; - - vec3 lightPos = vec3(1.0f, -1.0f, 1.0f); - outLightVec = lightPos.xyz - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/geometryshader/normaldebug.geom b/tests/glsl/sascha-willems/geometryshader/normaldebug.geom deleted file mode 100644 index d3c487731..000000000 --- a/tests/glsl/sascha-willems/geometryshader/normaldebug.geom +++ /dev/null @@ -1,38 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (triangles) in; -layout (line_strip, max_vertices = 6) out; - -layout (binding = 1) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) in vec3 inNormal[]; - -layout (location = 0) out vec3 outColor; - -void main(void) -{ - float normalLength = 0.02; - for(int i=0; i<gl_in.length(); i++) - { - vec3 pos = gl_in[i].gl_Position.xyz; - vec3 normal = inNormal[i].xyz; - - gl_Position = ubo.projection * (ubo.model * vec4(pos, 1.0)); - outColor = vec3(1.0, 0.0, 0.0); - EmitVertex(); - - gl_Position = ubo.projection * (ubo.model * vec4(pos + normal * normalLength, 1.0)); - outColor = vec3(0.0, 0.0, 1.0); - EmitVertex(); - - EndPrimitive(); - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/hdr/bloom.frag b/tests/glsl/sascha-willems/hdr/bloom.frag deleted file mode 100644 index bc26005e6..000000000 --- a/tests/glsl/sascha-willems/hdr/bloom.frag +++ /dev/null @@ -1,67 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerColor0; -layout (binding = 1) uniform sampler2D samplerColor1; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outColor; - -layout (constant_id = 0) const int dir = 0; - -void main(void) -{ - // From the OpenGL Super bible - const float weights[] = float[](0.0024499299678342, - 0.0043538453346397, - 0.0073599963704157, - 0.0118349786570722, - 0.0181026699707781, - 0.0263392293891488, - 0.0364543006660986, - 0.0479932050577658, - 0.0601029809166942, - 0.0715974486241365, - 0.0811305381519717, - 0.0874493212267511, - 0.0896631113333857, - 0.0874493212267511, - 0.0811305381519717, - 0.0715974486241365, - 0.0601029809166942, - 0.0479932050577658, - 0.0364543006660986, - 0.0263392293891488, - 0.0181026699707781, - 0.0118349786570722, - 0.0073599963704157, - 0.0043538453346397, - 0.0024499299678342); - - - const float blurScale = 0.003; - const float blurStrength = 1.0; - - float ar = 1.0; - // Aspect ratio for vertical blur pass - if (dir == 1) - { - vec2 ts = textureSize(samplerColor1, 0); - ar = ts.y / ts.x; - } - - vec2 P = inUV.yx - vec2(0, (weights.length() >> 1) * ar * blurScale); - - vec4 color = vec4(0.0); - for (int i = 0; i < weights.length(); i++) - { - vec2 dv = vec2(0.0, i * blurScale) * ar; - color += texture(samplerColor1, P + dv) * weights[i] * blurStrength; - } - - outColor = color; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/hdr/bloom.vert b/tests/glsl/sascha-willems/hdr/bloom.vert deleted file mode 100644 index 548284554..000000000 --- a/tests/glsl/sascha-willems/hdr/bloom.vert +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/hdr/composition.frag b/tests/glsl/sascha-willems/hdr/composition.frag deleted file mode 100644 index 13f2f5838..000000000 --- a/tests/glsl/sascha-willems/hdr/composition.frag +++ /dev/null @@ -1,17 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerColor0; -layout (binding = 1) uniform sampler2D samplerColor1; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outColor; - -void main() -{ - outColor = texture(samplerColor0, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/hdr/composition.vert b/tests/glsl/sascha-willems/hdr/composition.vert deleted file mode 100644 index 548284554..000000000 --- a/tests/glsl/sascha-willems/hdr/composition.vert +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/hdr/gbuffer.frag b/tests/glsl/sascha-willems/hdr/gbuffer.frag deleted file mode 100644 index 476534d76..000000000 --- a/tests/glsl/sascha-willems/hdr/gbuffer.frag +++ /dev/null @@ -1,95 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube samplerEnvMap; - -layout (location = 0) in vec3 inUVW; -layout (location = 1) in vec3 inPos; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; -layout (location = 5) in mat4 inInvModelView; - -layout (location = 0) out vec4 outColor0; -layout (location = 1) out vec4 outColor1; - -layout (constant_id = 0) const int type = 0; - -#define PI 3.1415926 -#define TwoPI (2.0 * PI) - -layout (binding = 2) uniform UBO { - float exposure; -} ubo; - -void main() -{ - vec4 color; - vec3 wcNormal; - - switch (type) { - case 0: // Skybox - { - vec3 normal = normalize(inUVW); - color = texture(samplerEnvMap, normal); - } - break; - - case 1: // Reflect - { - vec3 wViewVec = mat3(inInvModelView) * normalize(inViewVec); - vec3 normal = normalize(inNormal); - vec3 wNormal = mat3(inInvModelView) * normal; - - float NdotL = max(dot(normal, inLightVec), 0.0); - - vec3 eyeDir = normalize(inViewVec); - vec3 halfVec = normalize(inLightVec + eyeDir); - float NdotH = max(dot(normal, halfVec), 0.0); - float NdotV = max(dot(normal, eyeDir), 0.0); - float VdotH = max(dot(eyeDir, halfVec), 0.0); - - // Geometric attenuation - float NH2 = 2.0 * NdotH; - float g1 = (NH2 * NdotV) / VdotH; - float g2 = (NH2 * NdotL) / VdotH; - float geoAtt = min(1.0, min(g1, g2)); - - const float F0 = 0.6; - const float k = 0.2; - - // Fresnel (schlick approximation) - float fresnel = pow(1.0 - VdotH, 5.0); - fresnel *= (1.0 - F0); - fresnel += F0; - - float spec = (fresnel * geoAtt) / (NdotV * NdotL * 3.14); - - color = texture(samplerEnvMap, reflect(-wViewVec, wNormal)); - - color = vec4(color.rgb * NdotL * (k + spec * (1.0 - k)), 1.0); - } - break; - - case 2: // Refract - { - vec3 wViewVec = mat3(inInvModelView) * normalize(inViewVec); - vec3 wNormal = mat3(inInvModelView) * inNormal; - color = texture(samplerEnvMap, refract(-wViewVec, wNormal, 1.0/1.6)); - } - break; - } - - - // Color with manual exposure into attachment 0 - outColor0.rgb = vec3(1.0) - exp(-color.rgb * ubo.exposure); - - // Bright parts for bloom into attachment 1 - float l = dot(outColor0.rgb, vec3(0.2126, 0.7152, 0.0722)); - float threshold = 0.75; - outColor1.rgb = (l > threshold) ? outColor0.rgb : vec3(0.0); - outColor1.a = 1.0; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/hdr/gbuffer.vert b/tests/glsl/sascha-willems/hdr/gbuffer.vert deleted file mode 100644 index 862203774..000000000 --- a/tests/glsl/sascha-willems/hdr/gbuffer.vert +++ /dev/null @@ -1,51 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; - -layout (constant_id = 0) const int type = 0; - -layout (binding = 0) uniform UBO { - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec3 outUVW; -layout (location = 1) out vec3 outPos; -layout (location = 2) out vec3 outNormal; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; -layout (location = 5) out mat4 outInvModelView; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - - switch(type) { - case 0: // Skybox - outPos = vec3(mat3(ubo.modelview) * inPos); - gl_Position = vec4(ubo.projection * vec4(outPos, 1.0)); - break; - case 1: // Object - outPos = vec3(ubo.modelview * vec4(inPos, 1.0)); - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); - break; - } - outPos = vec3(ubo.modelview * vec4(inPos, 1.0)); - outNormal = mat3(ubo.modelview) * inNormal; - - outInvModelView = inverse(ubo.modelview); - - vec3 lightPos = vec3(0.0f, -5.0f, 5.0f); - outLightVec = lightPos.xyz - outPos.xyz; - outViewVec = -outPos.xyz; -} diff --git a/tests/glsl/sascha-willems/imgui/scene.frag b/tests/glsl/sascha-willems/imgui/scene.frag deleted file mode 100644 index 77eded98b..000000000 --- a/tests/glsl/sascha-willems/imgui/scene.frag +++ /dev/null @@ -1,23 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - float diffuse = max(dot(N, L), 0.0); - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outFragColor = vec4(diffuse * inColor + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/imgui/scene.vert b/tests/glsl/sascha-willems/imgui/scene.vert deleted file mode 100644 index 921b1dbe6..000000000 --- a/tests/glsl/sascha-willems/imgui/scene.vert +++ /dev/null @@ -1,39 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/imgui/ui.frag b/tests/glsl/sascha-willems/imgui/ui.frag deleted file mode 100644 index 51e89bd7b..000000000 --- a/tests/glsl/sascha-willems/imgui/ui.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (binding = 0) uniform sampler2D fontSampler; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec4 inColor; - -layout (location = 0) out vec4 outColor; - -void main() -{ - outColor = inColor * texture(fontSampler, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/imgui/ui.vert b/tests/glsl/sascha-willems/imgui/ui.vert deleted file mode 100644 index cf95e08d3..000000000 --- a/tests/glsl/sascha-willems/imgui/ui.vert +++ /dev/null @@ -1,26 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec2 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec4 inColor; - -layout (push_constant) uniform PushConstants { - vec2 scale; - vec2 translate; -} pushConstants; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec4 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - outColor = inColor; - gl_Position = vec4(inPos * pushConstants.scale + pushConstants.translate, 0.0, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/indirectdraw/ground.frag b/tests/glsl/sascha-willems/indirectdraw/ground.frag deleted file mode 100644 index 47589e181..000000000 --- a/tests/glsl/sascha-willems/indirectdraw/ground.frag +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 2) uniform sampler2D samplerColor; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // Last array layer is terrain tex - vec4 color = texture(samplerColor, inUV); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 ambient = vec3(0.65); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.1); - outFragColor = vec4((ambient + diffuse) * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/indirectdraw/ground.vert b/tests/glsl/sascha-willems/indirectdraw/ground.vert deleted file mode 100644 index fa6bbe5c6..000000000 --- a/tests/glsl/sascha-willems/indirectdraw/ground.vert +++ /dev/null @@ -1,44 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// Vertex attributes -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - outUV = inUV * 32.0; - outNormal = inNormal; - - vec4 pos = vec4(inPos.xyz, 1.0); - - gl_Position = ubo.projection * ubo.modelview * pos; - - vec4 wPos = ubo.modelview * vec4(pos.xyz, 1.0); - vec4 lPos = vec4(0.0, -5.0, 0.0, 1.0); - outLightVec = lPos.xyz - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/indirectdraw/indirectdraw.frag b/tests/glsl/sascha-willems/indirectdraw/indirectdraw.frag deleted file mode 100644 index 3c7913201..000000000 --- a/tests/glsl/sascha-willems/indirectdraw/indirectdraw.frag +++ /dev/null @@ -1,31 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2DArray samplerArray; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerArray, inUV); - - if (color.a < 0.5) - { - discard; - } - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 ambient = vec3(0.65); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - outFragColor = vec4((ambient + diffuse) * color.rgb, 1.0); -} diff --git a/tests/glsl/sascha-willems/indirectdraw/indirectdraw.vert b/tests/glsl/sascha-willems/indirectdraw/indirectdraw.vert deleted file mode 100644 index a4d7e9132..000000000 --- a/tests/glsl/sascha-willems/indirectdraw/indirectdraw.vert +++ /dev/null @@ -1,83 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// Vertex attributes -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -// Instanced attributes -layout (location = 4) in vec3 instancePos; -layout (location = 5) in vec3 instanceRot; -layout (location = 6) in float instanceScale; -layout (location = 7) in int instanceTexIndex; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - outUV = vec3(inUV, instanceTexIndex); - outUV.t = 1.0 - outUV.t; - - mat4 mx, my, mz; - - // rotate around x - float s = sin(instanceRot.x); - float c = cos(instanceRot.x); - - mx[0] = vec4(c, s, 0.0, 0.0); - mx[1] = vec4(-s, c, 0.0, 0.0); - mx[2] = vec4(0.0, 0.0, 1.0, 0.0); - mx[3] = vec4(0.0, 0.0, 0.0, 1.0); - - // rotate around y - s = sin(instanceRot.y); - c = cos(instanceRot.y); - - my[0] = vec4(c, 0.0, s, 0.0); - my[1] = vec4(0.0, 1.0, 0.0, 0.0); - my[2] = vec4(-s, 0.0, c, 0.0); - my[3] = vec4(0.0, 0.0, 0.0, 1.0); - - // rot around z - s = sin(instanceRot.z); - c = cos(instanceRot.z); - - mz[0] = vec4(1.0, 0.0, 0.0, 0.0); - mz[1] = vec4(0.0, c, s, 0.0); - mz[2] = vec4(0.0, -s, c, 0.0); - mz[3] = vec4(0.0, 0.0, 0.0, 1.0); - - mat4 rotMat = mz * my * mx; - - outNormal = inNormal * mat3(rotMat); - - vec4 pos = vec4((inPos.xyz * instanceScale) + instancePos, 1.0) * rotMat; - - gl_Position = ubo.projection * ubo.modelview * pos; - - vec4 wPos = ubo.modelview * vec4(pos.xyz, 1.0); - vec4 lPos = vec4(0.0, -5.0, 0.0, 1.0); - outLightVec = lPos.xyz - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/indirectdraw/skysphere.frag b/tests/glsl/sascha-willems/indirectdraw/skysphere.frag deleted file mode 100644 index 5c6f4cc7b..000000000 --- a/tests/glsl/sascha-willems/indirectdraw/skysphere.frag +++ /dev/null @@ -1,18 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 2) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - const vec4 gradientStart = vec4(0.93, 0.9, 0.81, 1.0); - const vec4 gradientEnd = vec4(0.35, 0.5, 1.0, 1.0); - outFragColor = mix(gradientStart, gradientEnd, min(0.5 - inUV.t, 0.5)/0.15 + 0.5); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/indirectdraw/skysphere.vert b/tests/glsl/sascha-willems/indirectdraw/skysphere.vert deleted file mode 100644 index 03e563b39..000000000 --- a/tests/glsl/sascha-willems/indirectdraw/skysphere.vert +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// Vertex attributes -layout (location = 0) in vec4 inPos; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; -} ubo; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2(inUV.s, 1.0-inUV.t); - // Skysphere always at center, only use rotation part of modelview matrix - gl_Position = ubo.projection * mat4(mat3(ubo.modelview)) * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/instancing/instancing.frag b/tests/glsl/sascha-willems/instancing/instancing.frag deleted file mode 100644 index cdec8971b..000000000 --- a/tests/glsl/sascha-willems/instancing/instancing.frag +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2DArray samplerArray; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerArray, inUV) * vec4(inColor, 1.0); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.1) * inColor; - vec3 specular = (dot(N,L) > 0.0) ? pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75) * color.r : vec3(0.0); - outFragColor = vec4(diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/instancing/instancing.vert b/tests/glsl/sascha-willems/instancing/instancing.vert deleted file mode 100644 index 9f7516453..000000000 --- a/tests/glsl/sascha-willems/instancing/instancing.vert +++ /dev/null @@ -1,85 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// Vertex attributes -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -// Instanced attributes -layout (location = 4) in vec3 instancePos; -layout (location = 5) in vec3 instanceRot; -layout (location = 6) in float instanceScale; -layout (location = 7) in int instanceTexIndex; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; - float locSpeed; - float globSpeed; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -void main() -{ - outColor = inColor; - outUV = vec3(inUV, instanceTexIndex); - - mat3 mx, my, mz; - - // rotate around x - float s = sin(instanceRot.x + ubo.locSpeed); - float c = cos(instanceRot.x + ubo.locSpeed); - - mx[0] = vec3(c, s, 0.0); - mx[1] = vec3(-s, c, 0.0); - mx[2] = vec3(0.0, 0.0, 1.0); - - // rotate around y - s = sin(instanceRot.y + ubo.locSpeed); - c = cos(instanceRot.y + ubo.locSpeed); - - my[0] = vec3(c, 0.0, s); - my[1] = vec3(0.0, 1.0, 0.0); - my[2] = vec3(-s, 0.0, c); - - // rot around z - s = sin(instanceRot.z + ubo.locSpeed); - c = cos(instanceRot.z + ubo.locSpeed); - - mz[0] = vec3(1.0, 0.0, 0.0); - mz[1] = vec3(0.0, c, s); - mz[2] = vec3(0.0, -s, c); - - mat3 rotMat = mz * my * mx; - - mat4 gRotMat; - s = sin(instanceRot.y + ubo.globSpeed); - c = cos(instanceRot.y + ubo.globSpeed); - gRotMat[0] = vec4(c, 0.0, s, 0.0); - gRotMat[1] = vec4(0.0, 1.0, 0.0, 0.0); - gRotMat[2] = vec4(-s, 0.0, c, 0.0); - gRotMat[3] = vec4(0.0, 0.0, 0.0, 1.0); - - vec4 locPos = vec4(inPos.xyz * rotMat, 1.0); - vec4 pos = vec4((locPos.xyz * instanceScale) + instancePos, 1.0); - - gl_Position = ubo.projection * ubo.modelview * gRotMat * pos; - outNormal = mat3(ubo.modelview * gRotMat) * inverse(rotMat) * inNormal; - - pos = ubo.modelview * vec4(inPos.xyz + instancePos, 1.0); - vec3 lPos = mat3(ubo.modelview) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/instancing/planet.frag b/tests/glsl/sascha-willems/instancing/planet.frag deleted file mode 100644 index eb6d19242..000000000 --- a/tests/glsl/sascha-willems/instancing/planet.frag +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColorMap, inUV) * vec4(inColor, 1.0) * 1.5; - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 4.0) * vec3(0.5) * color.r; - outFragColor = vec4(diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/instancing/planet.vert b/tests/glsl/sascha-willems/instancing/planet.vert deleted file mode 100644 index ad0177933..000000000 --- a/tests/glsl/sascha-willems/instancing/planet.vert +++ /dev/null @@ -1,36 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -void main() -{ - outColor = inColor; - outUV = inUV * vec2(10.0, 6.0); - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.modelview * vec4(inPos, 1.0); - outNormal = mat3(ubo.modelview) * inNormal; - vec3 lPos = mat3(ubo.modelview) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/instancing/starfield.frag b/tests/glsl/sascha-willems/instancing/starfield.frag deleted file mode 100644 index bb4c2823a..000000000 --- a/tests/glsl/sascha-willems/instancing/starfield.frag +++ /dev/null @@ -1,35 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outFragColor; - -#define HASHSCALE3 vec3(443.897, 441.423, 437.195) -#define STARFREQUENCY 0.01 - -// Hash function by Dave Hoskins (https://www.shadertoy.com/view/4djSRW) -float hash33(vec3 p3) -{ - p3 = fract(p3 * HASHSCALE3); - p3 += dot(p3, p3.yxz+vec3(19.19)); - return fract((p3.x + p3.y)*p3.z + (p3.x+p3.z)*p3.y + (p3.y+p3.z)*p3.x); -} - -vec3 starField(vec3 pos) -{ - vec3 color = vec3(0.0); - float threshhold = (1.0 - STARFREQUENCY); - float rnd = hash33(pos); - if (rnd >= threshhold) - { - float starCol = pow((rnd - threshhold) / (1.0 - threshhold), 16.0); - color += vec3(starCol); - } - return color; -} - -void main() -{ - outFragColor = vec4(starField(inUVW), 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/instancing/starfield.vert b/tests/glsl/sascha-willems/instancing/starfield.vert deleted file mode 100644 index 82721aefd..000000000 --- a/tests/glsl/sascha-willems/instancing/starfield.vert +++ /dev/null @@ -1,10 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) out vec3 outUVW; - -void main() -{ - outUVW = vec3((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUVW.st * 2.0f - 1.0f, 0.0f, 1.0f); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/mesh/mesh.frag b/tests/glsl/sascha-willems/mesh/mesh.frag deleted file mode 100644 index 01fd2046f..000000000 --- a/tests/glsl/sascha-willems/mesh/mesh.frag +++ /dev/null @@ -1,28 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColorMap, inUV) * vec4(inColor, 1.0); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outFragColor = vec4(diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/mesh/mesh.vert b/tests/glsl/sascha-willems/mesh/mesh.vert deleted file mode 100644 index d0b3be251..000000000 --- a/tests/glsl/sascha-willems/mesh/mesh.vert +++ /dev/null @@ -1,42 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/multithreading/phong.frag b/tests/glsl/sascha-willems/multithreading/phong.frag deleted file mode 100644 index 663fd81b9..000000000 --- a/tests/glsl/sascha-willems/multithreading/phong.frag +++ /dev/null @@ -1,24 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 8.0) * vec3(0.75); - outFragColor = vec4(diffuse + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/multithreading/phong.vert b/tests/glsl/sascha-willems/multithreading/phong.vert deleted file mode 100644 index 67f803dfd..000000000 --- a/tests/glsl/sascha-willems/multithreading/phong.vert +++ /dev/null @@ -1,43 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (std140, push_constant) uniform PushConsts -{ - mat4 mvp; - vec3 color; -} pushConsts; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -void main() -{ - outNormal = inNormal; - - if ( (inColor.r == 1.0) && (inColor.g == 0.0) && (inColor.b == 0.0)) - { - outColor = pushConsts.color; - } - else - { - outColor = inColor; - } - - gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0); - - vec4 pos = pushConsts.mvp * vec4(inPos, 1.0); - outNormal = mat3(pushConsts.mvp) * inNormal; -// vec3 lPos = ubo.lightPos.xyz; -vec3 lPos = vec3(0.0); - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/multithreading/starsphere.frag b/tests/glsl/sascha-willems/multithreading/starsphere.frag deleted file mode 100644 index 7136a0499..000000000 --- a/tests/glsl/sascha-willems/multithreading/starsphere.frag +++ /dev/null @@ -1,43 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outFragColor; - -#define HASHSCALE3 vec3(443.897, 441.423, 437.195) -#define STARFREQUENCY 0.01 - -// Hash function by Dave Hoskins (https://www.shadertoy.com/view/4djSRW) -float hash33(vec3 p3) -{ - p3 = fract(p3 * HASHSCALE3); - p3 += dot(p3, p3.yxz+vec3(19.19)); - return fract((p3.x + p3.y)*p3.z + (p3.x+p3.z)*p3.y + (p3.y+p3.z)*p3.x); -} - -vec3 starField(vec3 pos) -{ - vec3 color = vec3(0.0); - float threshhold = (1.0 - STARFREQUENCY); - float rnd = hash33(pos); - if (rnd >= threshhold) - { - float starCol = pow((rnd - threshhold) / (1.0 - threshhold), 16.0); - color += vec3(starCol); - } - return color; -} - -void main() -{ - // Fake atmosphere at the bottom - vec3 atmosphere = clamp(vec3(0.1, 0.15, 0.4) * (inUVW.t - 5.0), 0.0, 1.0); - - vec3 color = starField(inUVW) + atmosphere; - - outFragColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/multithreading/starsphere.vert b/tests/glsl/sascha-willems/multithreading/starsphere.vert deleted file mode 100644 index c80106f45..000000000 --- a/tests/glsl/sascha-willems/multithreading/starsphere.vert +++ /dev/null @@ -1,20 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (std140, push_constant) uniform PushConsts -{ - mat4 mvp; -} pushConsts; - -layout (location = 0) out vec3 outUVW; - -void main() -{ - outUVW = inPos; - gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/occlusionquery/mesh.frag b/tests/glsl/sascha-willems/occlusionquery/mesh.frag deleted file mode 100644 index af644729d..000000000 --- a/tests/glsl/sascha-willems/occlusionquery/mesh.frag +++ /dev/null @@ -1,32 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in float inVisible; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - - -void main() -{ - if (inVisible > 0.0) - { - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 8.0) * vec3(0.75); - outFragColor = vec4(diffuse + specular, 1.0); - } - else - { - outFragColor = vec4(vec3(0.1), 1.0); - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/occlusionquery/mesh.vert b/tests/glsl/sascha-willems/occlusionquery/mesh.vert deleted file mode 100644 index 02a930fe9..000000000 --- a/tests/glsl/sascha-willems/occlusionquery/mesh.vert +++ /dev/null @@ -1,42 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; - float visible; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out float outVisible; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outVisible = ubo.visible; - - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.modelview * vec4(inPos, 1.0); - outNormal = mat3(ubo.modelview) * inNormal; - outLightVec = ubo.lightPos.xyz - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/occlusionquery/occluder.frag b/tests/glsl/sascha-willems/occlusionquery/occluder.frag deleted file mode 100644 index 37b13e5c0..000000000 --- a/tests/glsl/sascha-willems/occlusionquery/occluder.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = vec4(inColor, 0.5); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/occlusionquery/occluder.vert b/tests/glsl/sascha-willems/occlusionquery/occluder.vert deleted file mode 100644 index 8adca67d2..000000000 --- a/tests/glsl/sascha-willems/occlusionquery/occluder.vert +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/occlusionquery/simple.frag b/tests/glsl/sascha-willems/occlusionquery/simple.frag deleted file mode 100644 index 108acc1c1..000000000 --- a/tests/glsl/sascha-willems/occlusionquery/simple.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = vec4(1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/occlusionquery/simple.vert b/tests/glsl/sascha-willems/occlusionquery/simple.vert deleted file mode 100644 index b869b7a9c..000000000 --- a/tests/glsl/sascha-willems/occlusionquery/simple.vert +++ /dev/null @@ -1,26 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/offscreen/mirror.frag b/tests/glsl/sascha-willems/offscreen/mirror.frag deleted file mode 100644 index c8b31bd2b..000000000 --- a/tests/glsl/sascha-willems/offscreen/mirror.frag +++ /dev/null @@ -1,44 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; -layout (binding = 2) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec4 inPos; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 tmp = vec4(1.0 / inPos.w); - vec4 projCoord = inPos * tmp; - - // Scale and bias - projCoord += vec4(1.0); - projCoord *= vec4(0.5); - - // Slow single pass blur - // For demonstration purposes only - const float blurSize = 1.0 / 512.0; - - vec4 color = texture(samplerColorMap, inUV); - outFragColor = color * 0.25; - - if (gl_FrontFacing) - { - // Only render mirrored scene on front facing (upper) side of mirror surface - vec4 reflection = vec4(0.0); - for (int x = -3; x <= 3; x++) - { - for (int y = -3; y <= 3; y++) - { - reflection += texture(samplerColor, vec2(projCoord.s + x * blurSize, projCoord.t + y * blurSize)) / 49.0; - } - } - outFragColor += reflection * 1.5 * (color.r); - }; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/offscreen/mirror.vert b/tests/glsl/sascha-willems/offscreen/mirror.vert deleted file mode 100644 index a4c0cb7f5..000000000 --- a/tests/glsl/sascha-willems/offscreen/mirror.vert +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec4 outPos; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - outPos = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - gl_Position = outPos; -} diff --git a/tests/glsl/sascha-willems/offscreen/phong.frag b/tests/glsl/sascha-willems/offscreen/phong.frag deleted file mode 100644 index 43fc662a9..000000000 --- a/tests/glsl/sascha-willems/offscreen/phong.frag +++ /dev/null @@ -1,30 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inEyePos; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec4 IAmbient = vec4(0.1, 0.1, 0.1, 1.0); - vec4 IDiffuse = vec4(max(dot(inNormal, inLightVec), 0.0)); - float specular = 0.75; - vec4 ISpecular = vec4(0.0); - if (dot(inEyePos, inNormal) < 0.0) - { - ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 16.0) * specular; - } - - outFragColor = vec4((IAmbient + IDiffuse) * vec4(inColor, 1.0) + ISpecular); - -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/offscreen/phong.vert b/tests/glsl/sascha-willems/offscreen/phong.vert deleted file mode 100644 index 5bef0fa1e..000000000 --- a/tests/glsl/sascha-willems/offscreen/phong.vert +++ /dev/null @@ -1,40 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outEyePos; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_ClipDistance[]; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - gl_Position = ubo.projection * ubo.model * inPos; - outEyePos = vec3(ubo.model * inPos); - outLightVec = normalize(ubo.lightPos.xyz - outEyePos); - - // Clip against reflection plane - vec4 clipPlane = vec4(0.0, -1.0, 0.0, 1.5); - gl_ClipDistance[0] = dot(inPos, clipPlane); -} diff --git a/tests/glsl/sascha-willems/offscreen/quad.frag b/tests/glsl/sascha-willems/offscreen/quad.frag deleted file mode 100644 index 6d54f2f33..000000000 --- a/tests/glsl/sascha-willems/offscreen/quad.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerColor, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/offscreen/quad.vert b/tests/glsl/sascha-willems/offscreen/quad.vert deleted file mode 100644 index c1ad3e070..000000000 --- a/tests/glsl/sascha-willems/offscreen/quad.vert +++ /dev/null @@ -1,27 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/parallax/parallax.frag b/tests/glsl/sascha-willems/parallax/parallax.frag deleted file mode 100644 index 79dcab907..000000000 --- a/tests/glsl/sascha-willems/parallax/parallax.frag +++ /dev/null @@ -1,144 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (binding = 1) uniform sampler2D sColorMap; -layout (binding = 2) uniform sampler2D sNormalHeightMap; - -layout (binding = 3) uniform UBO -{ - float heightScale; - float parallaxBias; - float numLayers; - int mappingMode; -} ubo; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec3 inTangentLightPos; -layout (location = 2) in vec3 inTangentViewPos; -layout (location = 3) in vec3 inTangentFragPos; - -layout (location = 0) out vec4 outColor; - -vec2 parallax_uv(vec2 uv, vec3 view_dir, int type) -{ - if (type == 2) { - // Parallax mapping - float depth = 1.0 - texture(sNormalHeightMap, uv).a; - vec2 p = view_dir.xy * (depth * (ubo.heightScale * 0.5) + ubo.parallaxBias) / view_dir.z; - return uv - p; - } else { - float layer_depth = 1.0 / ubo.numLayers; - float cur_layer_depth = 0.0; - vec2 delta_uv = view_dir.xy * ubo.heightScale / (view_dir.z * ubo.numLayers); - vec2 cur_uv = uv; - - float depth_from_tex = 1.0 - texture(sNormalHeightMap, cur_uv).a; - - for (int i = 0; i < 32; i++) { - cur_layer_depth += layer_depth; - cur_uv -= delta_uv; - depth_from_tex = 1.0 - texture(sNormalHeightMap, cur_uv).a; - if (depth_from_tex < cur_layer_depth) { - break; - } - } - - if (type == 3) { - // Steep parallax mapping - return cur_uv; - } else { - // Parallax occlusion mapping - vec2 prev_uv = cur_uv + delta_uv; - float next = depth_from_tex - cur_layer_depth; - float prev = 1.0 - texture(sNormalHeightMap, prev_uv).a - cur_layer_depth + layer_depth; - float weight = next / (next - prev); - return mix(cur_uv, prev_uv, weight); - } - } -} - -vec2 parallaxMapping(vec2 uv, vec3 viewDir) -{ - float height = 1.0 - texture(sNormalHeightMap, uv).a; - vec2 p = viewDir.xy * (height * (ubo.heightScale * 0.5) + ubo.parallaxBias) / viewDir.z; - return uv - p; -} - -vec2 steepParallaxMapping(vec2 uv, vec3 viewDir) -{ - float layerDepth = 1.0 / ubo.numLayers; - float currLayerDepth = 0.0; - vec2 deltaUV = viewDir.xy * ubo.heightScale / (viewDir.z * ubo.numLayers); - vec2 currUV = uv; - float height = 1.0 - texture(sNormalHeightMap, currUV).a; - for (int i = 0; i < ubo.numLayers; i++) { - currLayerDepth += layerDepth; - currUV -= deltaUV; - height = 1.0 - texture(sNormalHeightMap, currUV).a; - if (height < currLayerDepth) { - break; - } - } - return currUV; -} - -vec2 parallaxOcclusionMapping(vec2 uv, vec3 viewDir) -{ - float layerDepth = 1.0 / ubo.numLayers; - float currLayerDepth = 0.0; - vec2 deltaUV = viewDir.xy * ubo.heightScale / (viewDir.z * ubo.numLayers); - vec2 currUV = uv; - float height = 1.0 - texture(sNormalHeightMap, currUV).a; - for (int i = 0; i < ubo.numLayers; i++) { - currLayerDepth += layerDepth; - currUV -= deltaUV; - height = 1.0 - texture(sNormalHeightMap, currUV).a; - if (height < currLayerDepth) { - break; - } - } - vec2 prevUV = currUV + deltaUV; - float nextDepth = height - currLayerDepth; - float prevDepth = 1.0 - texture(sNormalHeightMap, prevUV).a - currLayerDepth + layerDepth; - return mix(currUV, prevUV, nextDepth / (nextDepth - prevDepth)); -} - -void main(void) -{ - vec3 V = normalize(inTangentViewPos - inTangentFragPos); - vec2 uv = inUV; - - if (ubo.mappingMode == 0) { - // Color only - outColor = texture(sColorMap, inUV); - } else { - switch(ubo.mappingMode) { - case 2: - uv = parallaxMapping(inUV, V); - break; - case 3: - uv = steepParallaxMapping(inUV, V); - break; - case 4: - uv = parallaxOcclusionMapping(inUV, V); - break; - } - - // Discard fragments at texture border - if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { - discard; - } - - vec3 N = normalize(texture(sNormalHeightMap, uv).rgb * 2.0 - 1.0); - vec3 L = normalize(inTangentLightPos - inTangentFragPos); - vec3 R = reflect(-L, N); - vec3 H = normalize(L + V); - - vec3 color = texture(sColorMap, uv).rgb; - vec3 ambient = 0.2 * color; - vec3 diffuse = max(dot(L, N), 0.0) * color; - vec3 specular = vec3(0.15) * pow(max(dot(N, H), 0.0), 32.0); - - outColor = vec4(ambient + diffuse + specular, 1.0f); - } -} diff --git a/tests/glsl/sascha-willems/parallax/parallax.vert b/tests/glsl/sascha-willems/parallax/parallax.vert deleted file mode 100644 index 3032d9c6e..000000000 --- a/tests/glsl/sascha-willems/parallax/parallax.vert +++ /dev/null @@ -1,38 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec3 inTangent; -layout (location = 4) in vec3 inBiTangent; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - vec4 lightPos; - vec4 cameraPos; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec3 outTangentLightPos; -layout (location = 2) out vec3 outTangentViewPos; -layout (location = 3) out vec3 outTangentFragPos; - -void main(void) -{ - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos, 1.0f); - outTangentFragPos = vec3(ubo.model * vec4(inPos, 1.0)); - outUV = inUV; - - vec3 T = normalize(mat3(ubo.model) * inTangent); - vec3 B = normalize(mat3(ubo.model) * inBiTangent); - vec3 N = normalize(mat3(ubo.model) * inNormal); - mat3 TBN = transpose(mat3(T, B, N)); - - outTangentLightPos = TBN * ubo.lightPos.xyz; - outTangentViewPos = TBN * ubo.cameraPos.xyz; - outTangentFragPos = TBN * outTangentFragPos; -} diff --git a/tests/glsl/sascha-willems/particlefire/normalmap.frag b/tests/glsl/sascha-willems/particlefire/normalmap.frag deleted file mode 100644 index 9f3af4cf1..000000000 --- a/tests/glsl/sascha-willems/particlefire/normalmap.frag +++ /dev/null @@ -1,45 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D sColorMap; -layout (binding = 2) uniform sampler2D sNormalHeightMap; - -#define lightRadius 45.0 - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec3 inLightVec; -layout (location = 2) in vec3 inLightVecB; -layout (location = 5) in vec3 inLightDir; -layout (location = 6) in vec3 inViewVec; - -layout (location = 0) out vec4 outFragColor; - -void main(void) -{ - vec3 specularColor = vec3(0.85, 0.5, 0.0); - - float invRadius = 1.0/lightRadius; - float ambient = 0.25; - - vec3 rgb, normal; - - rgb = texture(sColorMap, inUV).rgb; - normal = normalize((texture(sNormalHeightMap, inUV).rgb - 0.5) * 2.0); - - float distSqr = dot(inLightVecB, inLightVecB); - vec3 lVec = inLightVecB * inversesqrt(distSqr); - - float atten = max(clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0), ambient); - float diffuse = clamp(dot(lVec, normal), 0.0, 1.0); - - vec3 light = normalize(-inLightVec); - vec3 view = normalize(inViewVec); - vec3 reflectDir = reflect(-light, normal); - - float specular = pow(max(dot(view, reflectDir), 0.0), 4.0); - - outFragColor = vec4((rgb * atten + (diffuse * rgb + 0.5 * specular * specularColor.rgb)) * atten, 1.0); -} diff --git a/tests/glsl/sascha-willems/particlefire/normalmap.vert b/tests/glsl/sascha-willems/particlefire/normalmap.vert deleted file mode 100644 index a93c16b00..000000000 --- a/tests/glsl/sascha-willems/particlefire/normalmap.vert +++ /dev/null @@ -1,60 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec3 inTangent; -layout (location = 4) in vec3 inBiTangent; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 normal; - vec4 lightPos; - vec4 cameraPos; -} ubo; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; -}; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec3 outLightVec; -layout (location = 2) out vec3 outLightVecB; -layout (location = 5) out vec3 outLightDir; -layout (location = 6) out vec3 outViewVec; - -void main(void) -{ - vec3 vertexPosition = vec3(ubo.model * vec4(inPos, 1.0)); - outLightDir = normalize(ubo.lightPos.xyz - vertexPosition); - - // Setup (t)angent-(b)inormal-(n)ormal matrix for converting - // object coordinates into tangent space - mat3 tbnMatrix; - tbnMatrix[0] = mat3(ubo.normal) * inTangent; - tbnMatrix[1] = mat3(ubo.normal) * inBiTangent; - tbnMatrix[2] = mat3(ubo.normal) * inNormal; - - outLightVec.xyz = vec3(ubo.lightPos.xyz - vertexPosition.xyz) * tbnMatrix; - - vec3 lightDist = ubo.lightPos.xyz - inPos.xyz; - outLightVecB.x = dot(inTangent.xyz, lightDist); - outLightVecB.y = dot(inBiTangent.xyz, lightDist); - outLightVecB.z = dot(inNormal, lightDist); - - outViewVec.x = dot(inTangent, inPos.xyz); - outViewVec.y = dot(inBiTangent, inPos.xyz); - outViewVec.z = dot(inNormal, inPos.xyz); - - outUV = inUV; - - gl_Position = ubo.projection * ubo.model * vec4(inPos, 1.0); -} diff --git a/tests/glsl/sascha-willems/particlefire/particle.frag b/tests/glsl/sascha-willems/particlefire/particle.frag deleted file mode 100644 index 104fe406c..000000000 --- a/tests/glsl/sascha-willems/particlefire/particle.frag +++ /dev/null @@ -1,47 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerSmoke; -layout (binding = 2) uniform sampler2D samplerFire; - -layout (location = 0) in vec4 inColor; -layout (location = 1) in float inAlpha; -layout (location = 2) in flat int inType; -layout (location = 3) in float inRotation; - - -layout (location = 0) out vec4 outFragColor; - -void main () -{ - vec4 color; - float alpha = (inAlpha <= 1.0) ? inAlpha : 2.0 - inAlpha; - - // Rotate texture coordinates - // Rotate UV - float rotCenter = 0.5; - float rotCos = cos(inRotation); - float rotSin = sin(inRotation); - vec2 rotUV = vec2( - rotCos * (gl_PointCoord.x - rotCenter) + rotSin * (gl_PointCoord.y - rotCenter) + rotCenter, - rotCos * (gl_PointCoord.y - rotCenter) - rotSin * (gl_PointCoord.x - rotCenter) + rotCenter); - - - if (inType == 0) - { - // Flame - color = texture(samplerFire, rotUV); - outFragColor.a = 0.0; - } - else - { - // Smoke - color = texture(samplerSmoke, rotUV); - outFragColor.a = color.a * alpha; - } - - outFragColor.rgb = color.rgb * inColor.rgb * alpha; -} diff --git a/tests/glsl/sascha-willems/particlefire/particle.vert b/tests/glsl/sascha-willems/particlefire/particle.vert deleted file mode 100644 index a5d3c561b..000000000 --- a/tests/glsl/sascha-willems/particlefire/particle.vert +++ /dev/null @@ -1,50 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec4 inColor; -layout (location = 2) in float inAlpha; -layout (location = 3) in float inSize; -layout (location = 4) in float inRotation; -layout (location = 5) in int inType; - -layout (location = 0) out vec4 outColor; -layout (location = 1) out float outAlpha; -layout (location = 2) out flat int outType; -layout (location = 3) out float outRotation; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec2 viewportDim; - float pointSize; -} ubo; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; -}; - -void main () -{ - outColor = inColor; - outAlpha = inAlpha; - outType = inType; - outRotation = inRotation; - - gl_Position = ubo.projection * ubo.modelview * vec4(inPos.xyz, 1.0); - - // Base size of the point sprites - float spriteSize = 8.0 * inSize; - - // Scale particle size depending on camera projection - vec4 eyePos = ubo.modelview * vec4(inPos.xyz, 1.0); - vec4 projectedCorner = ubo.projection * vec4(0.5 * spriteSize, 0.5 * spriteSize, eyePos.z, eyePos.w); - gl_PointSize = ubo.viewportDim.x * projectedCorner.x / projectedCorner.w; - -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbrbasic/pbr.frag b/tests/glsl/sascha-willems/pbrbasic/pbr.frag deleted file mode 100644 index 06a69e1e9..000000000 --- a/tests/glsl/sascha-willems/pbrbasic/pbr.frag +++ /dev/null @@ -1,128 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inWorldPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -layout (binding = 1) uniform UBOShared { - vec4 lights[4]; -} uboParams; - -layout (location = 0) out vec4 outColor; - -layout(push_constant) uniform PushConsts { - layout(offset = 12) float roughness; - layout(offset = 16) float metallic; - layout(offset = 20) float r; - layout(offset = 24) float g; - layout(offset = 28) float b; -} material; - -const float PI = 3.14159265359; - -//#define ROUGHNESS_PATTERN 1 - -vec3 materialcolor() -{ - return vec3(material.r, material.g, material.b); -} - -// Normal Distribution function -------------------------------------- -float D_GGX(float dotNH, float roughness) -{ - float alpha = roughness * roughness; - float alpha2 = alpha * alpha; - float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0; - return (alpha2)/(PI * denom*denom); -} - -// Geometric Shadowing function -------------------------------------- -float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness) -{ - float r = (roughness + 1.0); - float k = (r*r) / 8.0; - float GL = dotNL / (dotNL * (1.0 - k) + k); - float GV = dotNV / (dotNV * (1.0 - k) + k); - return GL * GV; -} - -// Fresnel function ---------------------------------------------------- -vec3 F_Schlick(float cosTheta, float metallic) -{ - vec3 F0 = mix(vec3(0.04), materialcolor(), metallic); // * material.specular - vec3 F = F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); - return F; -} - -// Specular BRDF composition -------------------------------------------- - -vec3 BRDF(vec3 L, vec3 V, vec3 N, float metallic, float roughness) -{ - // Precalculate vectors and dot products - vec3 H = normalize (V + L); - float dotNV = clamp(dot(N, V), 0.0, 1.0); - float dotNL = clamp(dot(N, L), 0.0, 1.0); - float dotLH = clamp(dot(L, H), 0.0, 1.0); - float dotNH = clamp(dot(N, H), 0.0, 1.0); - - // Light color fixed - vec3 lightColor = vec3(1.0); - - vec3 color = vec3(0.0); - - if (dotNL > 0.0) - { - float rroughness = max(0.05, roughness); - // D = Normal distribution (Distribution of the microfacets) - float D = D_GGX(dotNH, roughness); - // G = Geometric shadowing term (Microfacets shadowing) - float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); - // F = Fresnel factor (Reflectance depending on angle of incidence) - vec3 F = F_Schlick(dotNV, metallic); - - vec3 spec = D * F * G / (4.0 * dotNL * dotNV); - - color += spec * dotNL * lightColor; - } - - return color; -} - -// ---------------------------------------------------------------------------- -void main() -{ - vec3 N = normalize(inNormal); - vec3 V = normalize(ubo.camPos - inWorldPos); - - float roughness = material.roughness; - - // Add striped pattern to roughness based on vertex position -#ifdef ROUGHNESS_PATTERN - roughness = max(roughness, step(fract(inWorldPos.y * 2.02), 0.5)); -#endif - - // Specular contribution - vec3 Lo = vec3(0.0); - for (int i = 0; i < uboParams.lights.length(); i++) { - vec3 L = normalize(uboParams.lights[i].xyz - inWorldPos); - Lo += BRDF(L, V, N, material.metallic, roughness); - }; - - // Combine with ambient - vec3 color = materialcolor() * 0.02; - color += Lo; - - // Gamma correct - color = pow(color, vec3(0.4545)); - - outColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbrbasic/pbr.vert b/tests/glsl/sascha-willems/pbrbasic/pbr.vert deleted file mode 100644 index 9a85b892a..000000000 --- a/tests/glsl/sascha-willems/pbrbasic/pbr.vert +++ /dev/null @@ -1,39 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -layout (location = 0) out vec3 outWorldPos; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec2 outUV; - -layout(push_constant) uniform PushConsts { - vec3 objPos; -} pushConsts; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec3 locPos = vec3(ubo.model * vec4(inPos, 1.0)); - outWorldPos = locPos + pushConsts.objPos; - outNormal = mat3(ubo.model) * inNormal; - outUV = inUV; - gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0); -} diff --git a/tests/glsl/sascha-willems/pbribl/filtercube.vert b/tests/glsl/sascha-willems/pbribl/filtercube.vert deleted file mode 100644 index 07f02c8b5..000000000 --- a/tests/glsl/sascha-willems/pbribl/filtercube.vert +++ /dev/null @@ -1,20 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inPos; - -layout(push_constant) uniform PushConsts { - layout (offset = 0) mat4 mvp; -} pushConsts; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex { - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/pbribl/genbrdflut.frag b/tests/glsl/sascha-willems/pbribl/genbrdflut.frag deleted file mode 100644 index 25f00af1f..000000000 --- a/tests/glsl/sascha-willems/pbribl/genbrdflut.frag +++ /dev/null @@ -1,91 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec2 inUV; -layout (location = 0) out vec4 outColor; -layout (constant_id = 0) const uint NUM_SAMPLES = 1024u; - -const float PI = 3.1415926536; - -// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ -float random(vec2 co) -{ - float a = 12.9898; - float b = 78.233; - float c = 43758.5453; - float dt= dot(co.xy ,vec2(a,b)); - float sn= mod(dt,3.14); - return fract(sin(sn) * c); -} - -vec2 hammersley2d(uint i, uint N) -{ - // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - uint bits = (i << 16u) | (i >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - float rdi = float(bits) * 2.3283064365386963e-10; - return vec2(float(i) /float(N), rdi); -} - -// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf -vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal) -{ - // Maps a 2D point to a hemisphere with spread based on roughness - float alpha = roughness * roughness; - float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1; - float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y)); - float sinTheta = sqrt(1.0 - cosTheta * cosTheta); - vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); - - // Tangent space - vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangentX = normalize(cross(up, normal)); - vec3 tangentY = normalize(cross(normal, tangentX)); - - // Convert to world Space - return normalize(tangentX * H.x + tangentY * H.y + normal * H.z); -} - -// Geometric Shadowing function -float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness) -{ - float k = (roughness * roughness) / 2.0; - float GL = dotNL / (dotNL * (1.0 - k) + k); - float GV = dotNV / (dotNV * (1.0 - k) + k); - return GL * GV; -} - -vec2 BRDF(float NoV, float roughness) -{ - // Normal always points along z-axis for the 2D lookup - const vec3 N = vec3(0.0, 0.0, 1.0); - vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV); - - vec2 LUT = vec2(0.0); - for(uint i = 0u; i < NUM_SAMPLES; i++) { - vec2 Xi = hammersley2d(i, NUM_SAMPLES); - vec3 H = importanceSample_GGX(Xi, roughness, N); - vec3 L = 2.0 * dot(V, H) * H - V; - - float dotNL = max(dot(N, L), 0.0); - float dotNV = max(dot(N, V), 0.0); - float dotVH = max(dot(V, H), 0.0); - float dotNH = max(dot(H, N), 0.0); - - if (dotNL > 0.0) { - float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); - float G_Vis = (G * dotVH) / (dotNH * dotNV); - float Fc = pow(1.0 - dotVH, 5.0); - LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis); - } - } - return LUT / float(NUM_SAMPLES); -} - -void main() -{ - outColor = vec4(BRDF(inUV.s, 1.0-inUV.t), 0.0, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbribl/genbrdflut.vert b/tests/glsl/sascha-willems/pbribl/genbrdflut.vert deleted file mode 100644 index 8576b78b4..000000000 --- a/tests/glsl/sascha-willems/pbribl/genbrdflut.vert +++ /dev/null @@ -1,10 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) out vec2 outUV; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbribl/irradiancecube.frag b/tests/glsl/sascha-willems/pbribl/irradiancecube.frag deleted file mode 100644 index 926c68c4c..000000000 --- a/tests/glsl/sascha-willems/pbribl/irradiancecube.frag +++ /dev/null @@ -1,38 +0,0 @@ -// Generates an irradiance cube from an environment map using convolution - -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inPos; -layout (location = 0) out vec4 outColor; -layout (binding = 0) uniform samplerCube samplerEnv; - -layout(push_constant) uniform PushConsts { - layout (offset = 64) float deltaPhi; - layout (offset = 68) float deltaTheta; -} consts; - -#define PI 3.1415926535897932384626433832795 - -void main() -{ - vec3 N = normalize(inPos); - vec3 up = vec3(0.0, 1.0, 0.0); - vec3 right = normalize(cross(up, N)); - up = cross(N, right); - - const float TWO_PI = PI * 2.0; - const float HALF_PI = PI * 0.5; - - vec3 color = vec3(0.0); - uint sampleCount = 0u; - for (float phi = 0.0; phi < TWO_PI; phi += consts.deltaPhi) { - for (float theta = 0.0; theta < HALF_PI; theta += consts.deltaTheta) { - vec3 tempVec = cos(phi) * right + sin(phi) * up; - vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec; - color += texture(samplerEnv, sampleVector).rgb * cos(theta) * sin(theta); - sampleCount++; - } - } - outColor = vec4(PI * color / float(sampleCount), 1.0); -} diff --git a/tests/glsl/sascha-willems/pbribl/pbribl.frag b/tests/glsl/sascha-willems/pbribl/pbribl.frag deleted file mode 100644 index d04c46256..000000000 --- a/tests/glsl/sascha-willems/pbribl/pbribl.frag +++ /dev/null @@ -1,163 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inWorldPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO { - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -layout (binding = 1) uniform UBOParams { - vec4 lights[4]; - float exposure; - float gamma; -} uboParams; - -layout(push_constant) uniform PushConsts { - layout(offset = 12) float roughness; - layout(offset = 16) float metallic; - layout(offset = 20) float specular; - layout(offset = 24) float r; - layout(offset = 28) float g; - layout(offset = 32) float b; -} material; - -layout (binding = 2) uniform samplerCube samplerIrradiance; -layout (binding = 3) uniform sampler2D samplerBRDFLUT; -layout (binding = 4) uniform samplerCube prefilteredMap; - -layout (location = 0) out vec4 outColor; - -#define PI 3.1415926535897932384626433832795 -#define ALBEDO vec3(material.r, material.g, material.b) - -// From http://filmicgames.com/archives/75 -vec3 Uncharted2Tonemap(vec3 x) -{ - float A = 0.15; - float B = 0.50; - float C = 0.10; - float D = 0.20; - float E = 0.02; - float F = 0.30; - return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F; -} - -// Normal Distribution function -------------------------------------- -float D_GGX(float dotNH, float roughness) -{ - float alpha = roughness * roughness; - float alpha2 = alpha * alpha; - float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0; - return (alpha2)/(PI * denom*denom); -} - -// Geometric Shadowing function -------------------------------------- -float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness) -{ - float r = (roughness + 1.0); - float k = (r*r) / 8.0; - float GL = dotNL / (dotNL * (1.0 - k) + k); - float GV = dotNV / (dotNV * (1.0 - k) + k); - return GL * GV; -} - -// Fresnel function ---------------------------------------------------- -vec3 F_Schlick(float cosTheta, vec3 F0) -{ - return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); -} -vec3 F_SchlickR(float cosTheta, vec3 F0, float roughness) -{ - return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(1.0 - cosTheta, 5.0); -} - -vec3 prefilteredReflection(vec3 R, float roughness) -{ - const float MAX_REFLECTION_LOD = 9.0; // todo: param/const - float lod = roughness * MAX_REFLECTION_LOD; - float lodf = floor(lod); - float lodc = ceil(lod); - vec3 a = textureLod(prefilteredMap, R, lodf).rgb; - vec3 b = textureLod(prefilteredMap, R, lodc).rgb; - return mix(a, b, lod - lodf); -} - -vec3 specularContribution(vec3 L, vec3 V, vec3 N, vec3 F0, float metallic, float roughness) -{ - // Precalculate vectors and dot products - vec3 H = normalize (V + L); - float dotNH = clamp(dot(N, H), 0.0, 1.0); - float dotNV = clamp(dot(N, V), 0.0, 1.0); - float dotNL = clamp(dot(N, L), 0.0, 1.0); - - // Light color fixed - vec3 lightColor = vec3(1.0); - - vec3 color = vec3(0.0); - - if (dotNL > 0.0) { - // D = Normal distribution (Distribution of the microfacets) - float D = D_GGX(dotNH, roughness); - // G = Geometric shadowing term (Microfacets shadowing) - float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); - // F = Fresnel factor (Reflectance depending on angle of incidence) - vec3 F = F_Schlick(dotNV, F0); - vec3 spec = D * F * G / (4.0 * dotNL * dotNV + 0.001); - vec3 kD = (vec3(1.0) - F) * (1.0 - metallic); - color += (kD * ALBEDO / PI + spec) * dotNL; - } - - return color; -} - -void main() -{ - vec3 N = normalize(inNormal); - vec3 V = normalize(ubo.camPos - inWorldPos); - vec3 R = reflect(-V, N); - - float metallic = material.metallic; - float roughness = material.roughness; - - vec3 F0 = vec3(0.04); - F0 = mix(F0, ALBEDO, metallic); - - vec3 Lo = vec3(0.0); - for(int i = 0; i < uboParams.lights[i].length(); i++) { - vec3 L = normalize(uboParams.lights[i].xyz - inWorldPos); - Lo += specularContribution(L, V, N, F0, metallic, roughness); - } - - vec2 brdf = texture(samplerBRDFLUT, vec2(max(dot(N, V), 0.0), roughness)).rg; - vec3 reflection = prefilteredReflection(R, roughness).rgb; - vec3 irradiance = texture(samplerIrradiance, N).rgb; - - // Diffuse based on irradiance - vec3 diffuse = irradiance * ALBEDO; - - vec3 F = F_SchlickR(max(dot(N, V), 0.0), F0, roughness); - - // Specular reflectance - vec3 specular = reflection * (F * brdf.x + brdf.y); - - // Ambient part - vec3 kD = 1.0 - F; - kD *= 1.0 - metallic; - vec3 ambient = (kD * diffuse + specular); - - vec3 color = ambient + Lo; - - // Tone mapping - color = Uncharted2Tonemap(color * uboParams.exposure); - color = color * (1.0f / Uncharted2Tonemap(vec3(11.2f))); - // Gamma correction - color = pow(color, vec3(1.0f / uboParams.gamma)); - - outColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbribl/pbribl.vert b/tests/glsl/sascha-willems/pbribl/pbribl.vert deleted file mode 100644 index c8d65cc32..000000000 --- a/tests/glsl/sascha-willems/pbribl/pbribl.vert +++ /dev/null @@ -1,40 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -layout (location = 0) out vec3 outWorldPos; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec2 outUV; - -layout(push_constant) uniform PushConsts { - vec3 objPos; -} pushConsts; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec3 locPos = vec3(ubo.model * vec4(inPos, 1.0)); - outWorldPos = locPos + pushConsts.objPos; - outNormal = mat3(ubo.model) * inNormal; - outUV = inUV; - outUV.t = 1.0 - inUV.t; - gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0); -} diff --git a/tests/glsl/sascha-willems/pbribl/prefilterenvmap.frag b/tests/glsl/sascha-willems/pbribl/prefilterenvmap.frag deleted file mode 100644 index d5231a2d1..000000000 --- a/tests/glsl/sascha-willems/pbribl/prefilterenvmap.frag +++ /dev/null @@ -1,106 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inPos; -layout (location = 0) out vec4 outColor; - -layout (binding = 0) uniform samplerCube samplerEnv; - -layout(push_constant) uniform PushConsts { - layout (offset = 64) float roughness; - layout (offset = 68) uint numSamples; -} consts; - -const float PI = 3.1415926536; - -// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ -float random(vec2 co) -{ - float a = 12.9898; - float b = 78.233; - float c = 43758.5453; - float dt= dot(co.xy ,vec2(a,b)); - float sn= mod(dt,3.14); - return fract(sin(sn) * c); -} - -vec2 hammersley2d(uint i, uint N) -{ - // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - uint bits = (i << 16u) | (i >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - float rdi = float(bits) * 2.3283064365386963e-10; - return vec2(float(i) /float(N), rdi); -} - -// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf -vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal) -{ - // Maps a 2D point to a hemisphere with spread based on roughness - float alpha = roughness * roughness; - float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1; - float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y)); - float sinTheta = sqrt(1.0 - cosTheta * cosTheta); - vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); - - // Tangent space - vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangentX = normalize(cross(up, normal)); - vec3 tangentY = normalize(cross(normal, tangentX)); - - // Convert to world Space - return normalize(tangentX * H.x + tangentY * H.y + normal * H.z); -} - -// Normal Distribution function -float D_GGX(float dotNH, float roughness) -{ - float alpha = roughness * roughness; - float alpha2 = alpha * alpha; - float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0; - return (alpha2)/(PI * denom*denom); -} - -vec3 prefilterEnvMap(vec3 R, float roughness) -{ - vec3 N = R; - vec3 V = R; - vec3 color = vec3(0.0); - float totalWeight = 0.0; - float envMapDim = float(textureSize(samplerEnv, 0).s); - for(uint i = 0u; i < consts.numSamples; i++) { - vec2 Xi = hammersley2d(i, consts.numSamples); - vec3 H = importanceSample_GGX(Xi, roughness, N); - vec3 L = 2.0 * dot(V, H) * H - V; - float dotNL = clamp(dot(N, L), 0.0, 1.0); - if(dotNL > 0.0) { - // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/ - - float dotNH = clamp(dot(N, H), 0.0, 1.0); - float dotVH = clamp(dot(V, H), 0.0, 1.0); - - // Probability Distribution Function - float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001; - // Slid angle of current smple - float omegaS = 1.0 / (float(consts.numSamples) * pdf); - // Solid angle of 1 pixel across all cube faces - float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim); - // Biased (+1.0) mip level for better result - float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f); - color += textureLod(samplerEnv, L, mipLevel).rgb * dotNL; - totalWeight += dotNL; - - } - } - return (color / totalWeight); -} - - -void main() -{ - vec3 N = normalize(inPos); - outColor = vec4(prefilterEnvMap(N, consts.roughness), 1.0); -} diff --git a/tests/glsl/sascha-willems/pbribl/skybox.frag b/tests/glsl/sascha-willems/pbribl/skybox.frag deleted file mode 100644 index a66c8bdaa..000000000 --- a/tests/glsl/sascha-willems/pbribl/skybox.frag +++ /dev/null @@ -1,40 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (binding = 2) uniform samplerCube samplerEnv; - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outColor; - -layout (binding = 1) uniform UBOParams { - vec4 lights[4]; - float exposure; - float gamma; -} uboParams; - -// From http://filmicworlds.com/blog/filmic-tonemapping-operators/ -vec3 Uncharted2Tonemap(vec3 color) -{ - float A = 0.15; - float B = 0.50; - float C = 0.10; - float D = 0.20; - float E = 0.02; - float F = 0.30; - float W = 11.2; - return ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F; -} - -void main() -{ - vec3 color = texture(samplerEnv, inUVW).rgb; - - // Tone mapping - color = Uncharted2Tonemap(color * uboParams.exposure); - color = color * (1.0f / Uncharted2Tonemap(vec3(11.2f))); - // Gamma correction - color = pow(color, vec3(1.0f / uboParams.gamma)); - - outColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbribl/skybox.vert b/tests/glsl/sascha-willems/pbribl/skybox.vert deleted file mode 100644 index 1802e74e4..000000000 --- a/tests/glsl/sascha-willems/pbribl/skybox.vert +++ /dev/null @@ -1,28 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/pbrtexture/filtercube.vert b/tests/glsl/sascha-willems/pbrtexture/filtercube.vert deleted file mode 100644 index 07f02c8b5..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/filtercube.vert +++ /dev/null @@ -1,20 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec3 inPos; - -layout(push_constant) uniform PushConsts { - layout (offset = 0) mat4 mvp; -} pushConsts; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex { - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/pbrtexture/genbrdflut.frag b/tests/glsl/sascha-willems/pbrtexture/genbrdflut.frag deleted file mode 100644 index 25f00af1f..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/genbrdflut.frag +++ /dev/null @@ -1,91 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: - -layout (location = 0) in vec2 inUV; -layout (location = 0) out vec4 outColor; -layout (constant_id = 0) const uint NUM_SAMPLES = 1024u; - -const float PI = 3.1415926536; - -// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ -float random(vec2 co) -{ - float a = 12.9898; - float b = 78.233; - float c = 43758.5453; - float dt= dot(co.xy ,vec2(a,b)); - float sn= mod(dt,3.14); - return fract(sin(sn) * c); -} - -vec2 hammersley2d(uint i, uint N) -{ - // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - uint bits = (i << 16u) | (i >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - float rdi = float(bits) * 2.3283064365386963e-10; - return vec2(float(i) /float(N), rdi); -} - -// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf -vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal) -{ - // Maps a 2D point to a hemisphere with spread based on roughness - float alpha = roughness * roughness; - float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1; - float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y)); - float sinTheta = sqrt(1.0 - cosTheta * cosTheta); - vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); - - // Tangent space - vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangentX = normalize(cross(up, normal)); - vec3 tangentY = normalize(cross(normal, tangentX)); - - // Convert to world Space - return normalize(tangentX * H.x + tangentY * H.y + normal * H.z); -} - -// Geometric Shadowing function -float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness) -{ - float k = (roughness * roughness) / 2.0; - float GL = dotNL / (dotNL * (1.0 - k) + k); - float GV = dotNV / (dotNV * (1.0 - k) + k); - return GL * GV; -} - -vec2 BRDF(float NoV, float roughness) -{ - // Normal always points along z-axis for the 2D lookup - const vec3 N = vec3(0.0, 0.0, 1.0); - vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV); - - vec2 LUT = vec2(0.0); - for(uint i = 0u; i < NUM_SAMPLES; i++) { - vec2 Xi = hammersley2d(i, NUM_SAMPLES); - vec3 H = importanceSample_GGX(Xi, roughness, N); - vec3 L = 2.0 * dot(V, H) * H - V; - - float dotNL = max(dot(N, L), 0.0); - float dotNV = max(dot(N, V), 0.0); - float dotVH = max(dot(V, H), 0.0); - float dotNH = max(dot(H, N), 0.0); - - if (dotNL > 0.0) { - float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); - float G_Vis = (G * dotVH) / (dotNH * dotNV); - float Fc = pow(1.0 - dotVH, 5.0); - LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis); - } - } - return LUT / float(NUM_SAMPLES); -} - -void main() -{ - outColor = vec4(BRDF(inUV.s, 1.0-inUV.t), 0.0, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbrtexture/genbrdflut.vert b/tests/glsl/sascha-willems/pbrtexture/genbrdflut.vert deleted file mode 100644 index 2eeb90cf3..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/genbrdflut.vert +++ /dev/null @@ -1,10 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) out vec2 outUV; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbrtexture/irradiancecube.frag b/tests/glsl/sascha-willems/pbrtexture/irradiancecube.frag deleted file mode 100644 index e94c0f93c..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/irradiancecube.frag +++ /dev/null @@ -1,38 +0,0 @@ -//TEST:COMPARE_GLSL: -// Generates an irradiance cube from an environment map using convolution - -#version 450 - -layout (location = 0) in vec3 inPos; -layout (location = 0) out vec4 outColor; -layout (binding = 0) uniform samplerCube samplerEnv; - -layout(push_constant) uniform PushConsts { - layout (offset = 64) float deltaPhi; - layout (offset = 68) float deltaTheta; -} consts; - -#define PI 3.1415926535897932384626433832795 - -void main() -{ - vec3 N = normalize(inPos); - vec3 up = vec3(0.0, 1.0, 0.0); - vec3 right = normalize(cross(up, N)); - up = cross(N, right); - - const float TWO_PI = PI * 2.0; - const float HALF_PI = PI * 0.5; - - vec3 color = vec3(0.0); - uint sampleCount = 0u; - for (float phi = 0.0; phi < TWO_PI; phi += consts.deltaPhi) { - for (float theta = 0.0; theta < HALF_PI; theta += consts.deltaTheta) { - vec3 tempVec = cos(phi) * right + sin(phi) * up; - vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec; - color += texture(samplerEnv, sampleVector).rgb * cos(theta) * sin(theta); - sampleCount++; - } - } - outColor = vec4(PI * color / float(sampleCount), 1.0); -} diff --git a/tests/glsl/sascha-willems/pbrtexture/pbrtexture.frag b/tests/glsl/sascha-willems/pbrtexture/pbrtexture.frag deleted file mode 100644 index eb0a14bcc..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/pbrtexture.frag +++ /dev/null @@ -1,179 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) in vec3 inWorldPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO { - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -layout (binding = 1) uniform UBOParams { - vec4 lights[4]; - float exposure; - float gamma; -} uboParams; - -layout (binding = 2) uniform samplerCube samplerIrradiance; -layout (binding = 3) uniform sampler2D samplerBRDFLUT; -layout (binding = 4) uniform samplerCube prefilteredMap; - -layout (binding = 5) uniform sampler2D albedoMap; -layout (binding = 6) uniform sampler2D normalMap; -layout (binding = 7) uniform sampler2D aoMap; -layout (binding = 8) uniform sampler2D metallicMap; -layout (binding = 9) uniform sampler2D roughnessMap; - - -layout (location = 0) out vec4 outColor; - -#define PI 3.1415926535897932384626433832795 -#define ALBEDO pow(texture(albedoMap, inUV).rgb, vec3(2.2)) - -// From http://filmicgames.com/archives/75 -vec3 Uncharted2Tonemap(vec3 x) -{ - float A = 0.15; - float B = 0.50; - float C = 0.10; - float D = 0.20; - float E = 0.02; - float F = 0.30; - return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F; -} - -// Normal Distribution function -------------------------------------- -float D_GGX(float dotNH, float roughness) -{ - float alpha = roughness * roughness; - float alpha2 = alpha * alpha; - float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0; - return (alpha2)/(PI * denom*denom); -} - -// Geometric Shadowing function -------------------------------------- -float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness) -{ - float r = (roughness + 1.0); - float k = (r*r) / 8.0; - float GL = dotNL / (dotNL * (1.0 - k) + k); - float GV = dotNV / (dotNV * (1.0 - k) + k); - return GL * GV; -} - -// Fresnel function ---------------------------------------------------- -vec3 F_Schlick(float cosTheta, vec3 F0) -{ - return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); -} -vec3 F_SchlickR(float cosTheta, vec3 F0, float roughness) -{ - return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(1.0 - cosTheta, 5.0); -} - -vec3 prefilteredReflection(vec3 R, float roughness) -{ - const float MAX_REFLECTION_LOD = 9.0; // todo: param/const - float lod = roughness * MAX_REFLECTION_LOD; - float lodf = floor(lod); - float lodc = ceil(lod); - vec3 a = textureLod(prefilteredMap, R, lodf).rgb; - vec3 b = textureLod(prefilteredMap, R, lodc).rgb; - return mix(a, b, lod - lodf); -} - -vec3 specularContribution(vec3 L, vec3 V, vec3 N, vec3 F0, float metallic, float roughness) -{ - // Precalculate vectors and dot products - vec3 H = normalize (V + L); - float dotNH = clamp(dot(N, H), 0.0, 1.0); - float dotNV = clamp(dot(N, V), 0.0, 1.0); - float dotNL = clamp(dot(N, L), 0.0, 1.0); - - // Light color fixed - vec3 lightColor = vec3(1.0); - - vec3 color = vec3(0.0); - - if (dotNL > 0.0) { - // D = Normal distribution (Distribution of the microfacets) - float D = D_GGX(dotNH, roughness); - // G = Geometric shadowing term (Microfacets shadowing) - float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); - // F = Fresnel factor (Reflectance depending on angle of incidence) - vec3 F = F_Schlick(dotNV, F0); - vec3 spec = D * F * G / (4.0 * dotNL * dotNV + 0.001); - vec3 kD = (vec3(1.0) - F) * (1.0 - metallic); - color += (kD * ALBEDO / PI + spec) * dotNL; - } - - return color; -} - -// See http://www.thetenthplanet.de/archives/1180 -vec3 perturbNormal() -{ - vec3 tangentNormal = texture(normalMap, inUV).xyz * 2.0 - 1.0; - - vec3 q1 = dFdx(inWorldPos); - vec3 q2 = dFdy(inWorldPos); - vec2 st1 = dFdx(inUV); - vec2 st2 = dFdy(inUV); - - vec3 N = normalize(inNormal); - vec3 T = normalize(q1 * st2.t - q2 * st1.t); - vec3 B = -normalize(cross(N, T)); - mat3 TBN = mat3(T, B, N); - - return normalize(TBN * tangentNormal); -} - -void main() -{ - vec3 N = perturbNormal(); - vec3 V = normalize(ubo.camPos - inWorldPos); - vec3 R = reflect(-V, N); - - float metallic = texture(metallicMap, inUV).r; - float roughness = texture(roughnessMap, inUV).r; - - vec3 F0 = vec3(0.04); - F0 = mix(F0, ALBEDO, metallic); - - vec3 Lo = vec3(0.0); - for(int i = 0; i < uboParams.lights[i].length(); i++) { - vec3 L = normalize(uboParams.lights[i].xyz - inWorldPos); - Lo += specularContribution(L, V, N, F0, metallic, roughness); - } - - vec2 brdf = texture(samplerBRDFLUT, vec2(max(dot(N, V), 0.0), roughness)).rg; - vec3 reflection = prefilteredReflection(R, roughness).rgb; - vec3 irradiance = texture(samplerIrradiance, N).rgb; - - // Diffuse based on irradiance - vec3 diffuse = irradiance * ALBEDO; - - vec3 F = F_SchlickR(max(dot(N, V), 0.0), F0, roughness); - - // Specular reflectance - vec3 specular = reflection * (F * brdf.x + brdf.y); - - // Ambient part - vec3 kD = 1.0 - F; - kD *= 1.0 - metallic; - vec3 ambient = (kD * diffuse + specular) * texture(aoMap, inUV).rrr; - - vec3 color = ambient + Lo; - - // Tone mapping - color = Uncharted2Tonemap(color * uboParams.exposure); - color = color * (1.0f / Uncharted2Tonemap(vec3(11.2f))); - // Gamma correction - color = pow(color, vec3(1.0f / uboParams.gamma)); - - outColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbrtexture/pbrtexture.vert b/tests/glsl/sascha-willems/pbrtexture/pbrtexture.vert deleted file mode 100644 index 9962220a8..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/pbrtexture.vert +++ /dev/null @@ -1,36 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -layout (location = 0) out vec3 outWorldPos; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec3 locPos = vec3(ubo.model * vec4(inPos, 1.0)); - outWorldPos = locPos; - outNormal = mat3(ubo.model) * inNormal; - outUV = inUV; - outUV.t = 1.0 - inUV.t; - gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0); -} diff --git a/tests/glsl/sascha-willems/pbrtexture/prefilterenvmap.frag b/tests/glsl/sascha-willems/pbrtexture/prefilterenvmap.frag deleted file mode 100644 index 912780c82..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/prefilterenvmap.frag +++ /dev/null @@ -1,106 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) in vec3 inPos; -layout (location = 0) out vec4 outColor; - -layout (binding = 0) uniform samplerCube samplerEnv; - -layout(push_constant) uniform PushConsts { - layout (offset = 64) float roughness; - layout (offset = 68) uint numSamples; -} consts; - -const float PI = 3.1415926536; - -// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ -float random(vec2 co) -{ - float a = 12.9898; - float b = 78.233; - float c = 43758.5453; - float dt= dot(co.xy ,vec2(a,b)); - float sn= mod(dt,3.14); - return fract(sin(sn) * c); -} - -vec2 hammersley2d(uint i, uint N) -{ - // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - uint bits = (i << 16u) | (i >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - float rdi = float(bits) * 2.3283064365386963e-10; - return vec2(float(i) /float(N), rdi); -} - -// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf -vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal) -{ - // Maps a 2D point to a hemisphere with spread based on roughness - float alpha = roughness * roughness; - float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1; - float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y)); - float sinTheta = sqrt(1.0 - cosTheta * cosTheta); - vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); - - // Tangent space - vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangentX = normalize(cross(up, normal)); - vec3 tangentY = normalize(cross(normal, tangentX)); - - // Convert to world Space - return normalize(tangentX * H.x + tangentY * H.y + normal * H.z); -} - -// Normal Distribution function -float D_GGX(float dotNH, float roughness) -{ - float alpha = roughness * roughness; - float alpha2 = alpha * alpha; - float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0; - return (alpha2)/(PI * denom*denom); -} - -vec3 prefilterEnvMap(vec3 R, float roughness) -{ - vec3 N = R; - vec3 V = R; - vec3 color = vec3(0.0); - float totalWeight = 0.0; - float envMapDim = float(textureSize(samplerEnv, 0).s); - for(uint i = 0u; i < consts.numSamples; i++) { - vec2 Xi = hammersley2d(i, consts.numSamples); - vec3 H = importanceSample_GGX(Xi, roughness, N); - vec3 L = 2.0 * dot(V, H) * H - V; - float dotNL = clamp(dot(N, L), 0.0, 1.0); - if(dotNL > 0.0) { - // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/ - - float dotNH = clamp(dot(N, H), 0.0, 1.0); - float dotVH = clamp(dot(V, H), 0.0, 1.0); - - // Probability Distribution Function - float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001; - // Slid angle of current smple - float omegaS = 1.0 / (float(consts.numSamples) * pdf); - // Solid angle of 1 pixel across all cube faces - float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim); - // Biased (+1.0) mip level for better result - float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f); - color += textureLod(samplerEnv, L, mipLevel).rgb * dotNL; - totalWeight += dotNL; - - } - } - return (color / totalWeight); -} - - -void main() -{ - vec3 N = normalize(inPos); - outColor = vec4(prefilterEnvMap(N, consts.roughness), 1.0); -} diff --git a/tests/glsl/sascha-willems/pbrtexture/skybox.frag b/tests/glsl/sascha-willems/pbrtexture/skybox.frag deleted file mode 100644 index d80d44487..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/skybox.frag +++ /dev/null @@ -1,40 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (binding = 2) uniform samplerCube samplerEnv; - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outColor; - -layout (binding = 1) uniform UBOParams { - vec4 lights[4]; - float exposure; - float gamma; -} uboParams; - -// From http://filmicworlds.com/blog/filmic-tonemapping-operators/ -vec3 Uncharted2Tonemap(vec3 color) -{ - float A = 0.15; - float B = 0.50; - float C = 0.10; - float D = 0.20; - float E = 0.02; - float F = 0.30; - float W = 11.2; - return ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F; -} - -void main() -{ - vec3 color = texture(samplerEnv, inUVW).rgb; - - // Tone mapping - color = Uncharted2Tonemap(color * uboParams.exposure); - color = color * (1.0f / Uncharted2Tonemap(vec3(11.2f))); - // Gamma correction - color = pow(color, vec3(1.0f / uboParams.gamma)); - - outColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pbrtexture/skybox.vert b/tests/glsl/sascha-willems/pbrtexture/skybox.vert deleted file mode 100644 index e77f89773..000000000 --- a/tests/glsl/sascha-willems/pbrtexture/skybox.vert +++ /dev/null @@ -1,28 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/pipelines/phong.frag b/tests/glsl/sascha-willems/pipelines/phong.frag deleted file mode 100644 index f8dddd1cf..000000000 --- a/tests/glsl/sascha-willems/pipelines/phong.frag +++ /dev/null @@ -1,31 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // Desaturate color - vec3 color = vec3(mix(inColor, vec3(dot(vec3(0.2126,0.7152,0.0722), inColor)), 0.65)); - - // High ambient colors because mesh materials are pretty dark - vec3 ambient = color * vec3(1.0); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * color; - vec3 specular = pow(max(dot(R, V), 0.0), 32.0) * vec3(0.35); - outFragColor = vec4(ambient + diffuse * 1.75 + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pipelines/phong.vert b/tests/glsl/sascha-willems/pipelines/phong.vert deleted file mode 100644 index 44fd2e692..000000000 --- a/tests/glsl/sascha-willems/pipelines/phong.vert +++ /dev/null @@ -1,42 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pipelines/toon.frag b/tests/glsl/sascha-willems/pipelines/toon.frag deleted file mode 100644 index bb19e9a2f..000000000 --- a/tests/glsl/sascha-willems/pipelines/toon.frag +++ /dev/null @@ -1,40 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // Desaturate color - vec3 color = vec3(mix(inColor, vec3(dot(vec3(0.2126,0.7152,0.0722), inColor)), 0.65)); - - // High ambient colors because mesh materials are pretty dark - vec3 ambient = color * vec3(1.0); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * color; - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outFragColor = vec4(ambient + diffuse * 1.75 + specular, 1.0); - - float intensity = dot(N,L); - float shade = 1.0; - shade = intensity < 0.5 ? 0.75 : shade; - shade = intensity < 0.35 ? 0.6 : shade; - shade = intensity < 0.25 ? 0.5 : shade; - shade = intensity < 0.1 ? 0.25 : shade; - - outFragColor.rgb = inColor * 3.0 * shade; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pipelines/toon.vert b/tests/glsl/sascha-willems/pipelines/toon.vert deleted file mode 100644 index 44fd2e692..000000000 --- a/tests/glsl/sascha-willems/pipelines/toon.vert +++ /dev/null @@ -1,42 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pipelines/wireframe.frag b/tests/glsl/sascha-willems/pipelines/wireframe.frag deleted file mode 100644 index 7158d7ac9..000000000 --- a/tests/glsl/sascha-willems/pipelines/wireframe.frag +++ /dev/null @@ -1,14 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor.rgb = inColor * 1.5; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pipelines/wireframe.vert b/tests/glsl/sascha-willems/pipelines/wireframe.vert deleted file mode 100644 index 6ec18a4bf..000000000 --- a/tests/glsl/sascha-willems/pipelines/wireframe.vert +++ /dev/null @@ -1,29 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - { - outColor = inColor; - } - gl_Position = ubo.projection * ubo.model * inPos; -} diff --git a/tests/glsl/sascha-willems/pushconstants/lights.frag b/tests/glsl/sascha-willems/pushconstants/lights.frag deleted file mode 100644 index 9624b51be..000000000 --- a/tests/glsl/sascha-willems/pushconstants/lights.frag +++ /dev/null @@ -1,41 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -#define lightCount 6 - -layout (location = 0) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (location = 3) in vec4 inLightVec[lightCount]; - -layout (location = 0) out vec4 outFragColor; - -#define MAX_LIGHT_DIST 9.0 * 9.0 - -void main() -{ - vec3 lightColor[lightCount]; - lightColor[0] = vec3(1.0, 0.0, 0.0); - lightColor[1] = vec3(0.0, 1.0, 0.0); - lightColor[2] = vec3(0.0, 0.0, 1.0); - lightColor[3] = vec3(1.0, 0.0, 1.0); - lightColor[4] = vec3(0.0, 1.0, 1.0); - lightColor[5] = vec3(1.0, 1.0, 0.0); - - vec3 diffuse = vec3(0.0); - // Just some very basic attenuation - for (int i = 0; i < lightCount; ++i) - { - float lRadius = MAX_LIGHT_DIST * inLightVec[i].w; - - float dist = min(dot(inLightVec[i], inLightVec[i]), lRadius) / lRadius; - float distFactor = 1.0 - dist; - - diffuse += lightColor[i] * distFactor; - } - - outFragColor.rgb = diffuse; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/pushconstants/lights.vert b/tests/glsl/sascha-willems/pushconstants/lights.vert deleted file mode 100644 index 693e69d5d..000000000 --- a/tests/glsl/sascha-willems/pushconstants/lights.vert +++ /dev/null @@ -1,48 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 3) in vec3 inColor; - -#define lightCount 6 - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightColor[lightCount]; -} ubo; - -layout(push_constant) uniform PushConsts { - vec4 lightPos[lightCount]; -} pushConsts; - -layout (location = 0) out vec3 outNormal; -layout (location = 2) out vec3 outColor; - -layout (location = 3) out vec4 outLightVec[lightCount]; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - for (int i = 0; i < lightCount; ++i) - { - vec4 worldPos = ubo.model * vec4(inPos.xyz, 1.0); - outLightVec[i].xyz = pushConsts.lightPos[i].xyz - inPos.xyz; - // Store light radius in w - outLightVec[i].w = pushConsts.lightPos[i].w; - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/radialblur/colorpass.frag b/tests/glsl/sascha-willems/radialblur/colorpass.frag deleted file mode 100644 index 5d56315fd..000000000 --- a/tests/glsl/sascha-willems/radialblur/colorpass.frag +++ /dev/null @@ -1,25 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerGradientRamp; - -layout (location = 0) in vec3 inColor; -layout (location = 1) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // Use max. color channel value to detect bright glow emitters - if ((inColor.r >= 0.9) || (inColor.g >= 0.9) || (inColor.b >= 0.9)) - { - outFragColor.rgb = texture(samplerGradientRamp, inUV).rgb; - } - else - { - outFragColor.rgb = inColor; - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/radialblur/colorpass.vert b/tests/glsl/sascha-willems/radialblur/colorpass.vert deleted file mode 100644 index 68d4f2e56..000000000 --- a/tests/glsl/sascha-willems/radialblur/colorpass.vert +++ /dev/null @@ -1,30 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 2) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - float gradientPos; -} ubo; - -layout (location = 0) out vec3 outColor; -layout (location = 1) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - outUV = vec2(ubo.gradientPos, 0.0f); - gl_Position = ubo.projection * ubo.model * vec4(inPos, 1.0); -} diff --git a/tests/glsl/sascha-willems/radialblur/phongpass.frag b/tests/glsl/sascha-willems/radialblur/phongpass.frag deleted file mode 100644 index 83e96fc58..000000000 --- a/tests/glsl/sascha-willems/radialblur/phongpass.frag +++ /dev/null @@ -1,37 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerGradientRamp; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inEyePos; -layout (location = 3) in vec3 inLightVec; -layout (location = 4) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - // No light calculations for glow color - // Use max. color channel value - // to detect bright glow emitters - if ((inColor.r >= 0.9) || (inColor.g >= 0.9) || (inColor.b >= 0.9)) - { - outFragColor.rgb = texture(samplerGradientRamp, inUV).rgb; - } - else - { - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec4 IAmbient = vec4(0.2, 0.2, 0.2, 1.0); - vec4 IDiffuse = vec4(0.5, 0.5, 0.5, 0.5) * max(dot(inNormal, inLightVec), 0.0); - float specular = 0.25; - vec4 ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 4.0) * specular; - outFragColor = vec4((IAmbient + IDiffuse) * vec4(inColor, 1.0) + ISpecular); - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/radialblur/phongpass.vert b/tests/glsl/sascha-willems/radialblur/phongpass.vert deleted file mode 100644 index a375c39cf..000000000 --- a/tests/glsl/sascha-willems/radialblur/phongpass.vert +++ /dev/null @@ -1,38 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 pos; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - float gradientPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outEyePos; -layout (location = 3) out vec3 outLightVec; -layout (location = 4) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = vec2(ubo.gradientPos, 0.0); - gl_Position = ubo.projection * ubo.model * pos; - outEyePos = vec3(ubo.model * pos); - vec4 lightPos = vec4(0.0, 0.0, -5.0, 1.0);// * ubo.model; - outLightVec = normalize(lightPos.xyz - pos.xyz); -} diff --git a/tests/glsl/sascha-willems/radialblur/radialblur.frag b/tests/glsl/sascha-willems/radialblur/radialblur.frag deleted file mode 100644 index bc1e884e9..000000000 --- a/tests/glsl/sascha-willems/radialblur/radialblur.frag +++ /dev/null @@ -1,39 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (binding = 0) uniform UBO -{ - float radialBlurScale; - float radialBlurStrength; - vec2 radialOrigin; -} ubo; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - ivec2 texDim = textureSize(samplerColor, 0); - vec2 radialSize = vec2(1.0 / texDim.s, 1.0 / texDim.t); - - vec2 UV = inUV; - - vec4 color = vec4(0.0, 0.0, 0.0, 0.0); - UV += radialSize * 0.5 - ubo.radialOrigin; - - #define samples 32 - - for (int i = 0; i < samples; i++) - { - float scale = 1.0 - ubo.radialBlurScale * (float(i) / float(samples-1)); - color += texture(samplerColor, UV * scale + ubo.radialOrigin); - } - - outFragColor = (color / samples) * ubo.radialBlurStrength; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/radialblur/radialblur.vert b/tests/glsl/sascha-willems/radialblur/radialblur.vert deleted file mode 100644 index 117eb02ec..000000000 --- a/tests/glsl/sascha-willems/radialblur/radialblur.vert +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/raytracing/raytracing.comp b/tests/glsl/sascha-willems/raytracing/raytracing.comp deleted file mode 100644 index 8ef6c19e8..000000000 --- a/tests/glsl/sascha-willems/raytracing/raytracing.comp +++ /dev/null @@ -1,258 +0,0 @@ -//TEST:COMPARE_GLSL: -// Shader is looseley based on the ray tracing coding session by Inigo Quilez (www.iquilezles.org) - -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (local_size_x = 16, local_size_y = 16) in; -layout (binding = 0, rgba8) uniform writeonly image2D resultImage; - -#define EPSILON 0.0001 -#define MAXLEN 1000.0 -#define SHADOW 0.5 -#define RAYBOUNCES 2 -#define REFLECTIONS true -#define REFLECTIONSTRENGTH 0.4 -#define REFLECTIONFALLOFF 0.5 - -struct Camera -{ - vec3 pos; - vec3 lookat; - float fov; -}; - -layout (binding = 1) uniform UBO -{ - vec3 lightPos; - float aspectRatio; - vec4 fogColor; - Camera camera; - mat4 rotMat; -} ubo; - -struct Sphere -{ - vec3 pos; - float radius; - vec3 diffuse; - float specular; - int id; -}; - -struct Plane -{ - vec3 normal; - float distance; - vec3 diffuse; - float specular; - int id; -}; - -layout (std140, binding = 2) buffer Spheres -{ - Sphere spheres[ ]; -}; - -layout (std140, binding = 3) buffer Planes -{ - Plane planes[ ]; -}; - -void reflectRay(inout vec3 rayD, in vec3 mormal) -{ - rayD = rayD + 2.0 * -dot(mormal, rayD) * mormal; -} - -// Lighting ========================================================= - -float lightDiffuse(vec3 normal, vec3 lightDir) -{ - return clamp(dot(normal, lightDir), 0.1, 1.0); -} - -float lightSpecular(vec3 normal, vec3 lightDir, float specularFactor) -{ - vec3 viewVec = normalize(ubo.camera.pos); - vec3 halfVec = normalize(lightDir + viewVec); - return pow(clamp(dot(normal, halfVec), 0.0, 1.0), specularFactor); -} - -// Sphere =========================================================== - -float sphereIntersect(in vec3 rayO, in vec3 rayD, in Sphere sphere) -{ - vec3 oc = rayO - sphere.pos; - float b = 2.0 * dot(oc, rayD); - float c = dot(oc, oc) - sphere.radius*sphere.radius; - float h = b*b - 4.0*c; - if (h < 0.0) - { - return -1.0; - } - float t = (-b - sqrt(h)) / 2.0; - - return t; -} - -vec3 sphereNormal(in vec3 pos, in Sphere sphere) -{ - return (pos - sphere.pos) / sphere.radius; -} - -// Plane =========================================================== - -float planeIntersect(vec3 rayO, vec3 rayD, Plane plane) -{ - float d = dot(rayD, plane.normal); - - if (d == 0.0) - return 0.0; - - float t = -(plane.distance + dot(rayO, plane.normal)) / d; - - if (t < 0.0) - return 0.0; - - return t; -} - - -int intersect(in vec3 rayO, in vec3 rayD, inout float resT) -{ - int id = -1; - - for (int i = 0; i < spheres.length(); i++) - { - float tSphere = sphereIntersect(rayO, rayD, spheres[i]); - if ((tSphere > EPSILON) && (tSphere < resT)) - { - id = spheres[i].id; - resT = tSphere; - } - } - - for (int i = 0; i < planes.length(); i++) - { - float tplane = planeIntersect(rayO, rayD, planes[i]); - if ((tplane > EPSILON) && (tplane < resT)) - { - id = planes[i].id; - resT = tplane; - } - } - - return id; -} - -float calcShadow(in vec3 rayO, in vec3 rayD, in int objectId, inout float t) -{ - for (int i = 0; i < spheres.length(); i++) - { - if (spheres[i].id == objectId) - continue; - float tSphere = sphereIntersect(rayO, rayD, spheres[i]); - if ((tSphere > EPSILON) && (tSphere < t)) - { - t = tSphere; - return SHADOW; - } - } - return 1.0; -} - -vec3 fog(in float t, in vec3 color) -{ - return mix(color, ubo.fogColor.rgb, clamp(sqrt(t*t)/20.0, 0.0, 1.0)); -} - -vec3 renderScene(inout vec3 rayO, inout vec3 rayD, inout int id) -{ - vec3 color = vec3(0.0); - float t = MAXLEN; - - // Get intersected object ID - int objectID = intersect(rayO, rayD, t); - - if (objectID == -1) - { - return color; - } - - vec3 pos = rayO + t * rayD; - vec3 lightVec = normalize(ubo.lightPos - pos); - vec3 normal; - - // Planes - - // Spheres - - for (int i = 0; i < planes.length(); i++) - { - if (objectID == planes[i].id) - { - normal = planes[i].normal; - float diffuse = lightDiffuse(normal, lightVec); - float specular = lightSpecular(normal, lightVec, planes[i].specular); - color = diffuse * planes[i].diffuse + specular; - } - } - - for (int i = 0; i < spheres.length(); i++) - { - if (objectID == spheres[i].id) - { - normal = sphereNormal(pos, spheres[i]); - float diffuse = lightDiffuse(normal, lightVec); - float specular = lightSpecular(normal, lightVec, spheres[i].specular); - color = diffuse * spheres[i].diffuse + specular; - } - } - - if (id == -1) - return color; - - id = objectID; - - // Shadows - t = length(ubo.lightPos - pos); - color *= calcShadow(pos, lightVec, id, t); - - // Fog - color = fog(t, color); - - // Reflect ray for next render pass - reflectRay(rayD, normal); - rayO = pos; - - return color; -} - -void main() -{ - ivec2 dim = imageSize(resultImage); - vec2 uv = vec2(gl_GlobalInvocationID.xy) / dim; - - vec3 rayO = ubo.camera.pos; - vec3 rayD = normalize(vec3((-1.0 + 2.0 * uv) * vec2(ubo.aspectRatio, 1.0), -1.0)); - - // Basic color path - int id = 0; - vec3 finalColor = renderScene(rayO, rayD, id); - - // Reflection - if (REFLECTIONS) - { - float reflectionStrength = REFLECTIONSTRENGTH; - for (int i = 0; i < RAYBOUNCES; i++) - { - vec3 reflectionColor = renderScene(rayO, rayD, id); - finalColor = (1.0 - reflectionStrength) * finalColor + reflectionStrength * mix(reflectionColor, finalColor, 1.0 - reflectionStrength); - reflectionStrength *= REFLECTIONFALLOFF; - } - } - - imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), vec4(finalColor, 0.0)); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/raytracing/texture.frag b/tests/glsl/sascha-willems/raytracing/texture.frag deleted file mode 100644 index 06635bf4b..000000000 --- a/tests/glsl/sascha-willems/raytracing/texture.frag +++ /dev/null @@ -1,16 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerColor, vec2(inUV.s, 1.0 - inUV.t)); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/raytracing/texture.vert b/tests/glsl/sascha-willems/raytracing/texture.vert deleted file mode 100644 index cbf5c0a0d..000000000 --- a/tests/glsl/sascha-willems/raytracing/texture.vert +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/scenerendering/scene.frag b/tests/glsl/sascha-willems/scenerendering/scene.frag deleted file mode 100644 index 032ce45a9..000000000 --- a/tests/glsl/sascha-willems/scenerendering/scene.frag +++ /dev/null @@ -1,35 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (set = 1, binding = 0) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout(push_constant) uniform Material -{ - vec4 ambient; - vec4 diffuse; - vec4 specular; - float opacity; -} material; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColorMap, inUV) * vec4(inColor, 1.0); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * material.diffuse.rgb; - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * material.specular.rgb; - outFragColor = vec4((material.ambient.rgb + diffuse) * color.rgb + specular, 1.0-material.opacity); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/scenerendering/scene.vert b/tests/glsl/sascha-willems/scenerendering/scene.vert deleted file mode 100644 index 50852f78c..000000000 --- a/tests/glsl/sascha-willems/scenerendering/scene.vert +++ /dev/null @@ -1,46 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (set = 0, binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - - mat4 modelView = ubo.view * ubo.model; - - gl_Position = ubo.projection * modelView * vec4(inPos.xyz, 1.0); - - vec4 pos = modelView * vec4(inPos, 0.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - (ubo.model * vec4(inPos, 1.0)).xyz; - outViewVec = -(ubo.model * vec4(inPos, 1.0)).xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/screenshot/mesh.frag b/tests/glsl/sascha-willems/screenshot/mesh.frag deleted file mode 100644 index 3504b70cf..000000000 --- a/tests/glsl/sascha-willems/screenshot/mesh.frag +++ /dev/null @@ -1,24 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 ambient = vec3(0.1); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outFragColor = vec4((ambient + diffuse) * inColor.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/screenshot/mesh.vert b/tests/glsl/sascha-willems/screenshot/mesh.vert deleted file mode 100644 index a0c75ab18..000000000 --- a/tests/glsl/sascha-willems/screenshot/mesh.vert +++ /dev/null @@ -1,40 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (set = 0, binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - gl_Position = ubo.projection * ubo.view * ubo.model * inPos; - - vec4 pos = ubo.view * ubo.model * vec4(inPos.xyz, 1.0); - outNormal = mat3(ubo.model) * inNormal; - - vec3 lightPos = vec3(1.0f, -1.0f, 1.0f); - outLightVec = lightPos.xyz - pos.xyz; - outViewVec = -pos.xyz; -} diff --git a/tests/glsl/sascha-willems/shadowmapomni/cubemapdisplay.frag b/tests/glsl/sascha-willems/shadowmapomni/cubemapdisplay.frag deleted file mode 100644 index 740cd09e1..000000000 --- a/tests/glsl/sascha-willems/shadowmapomni/cubemapdisplay.frag +++ /dev/null @@ -1,17 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube shadowCubeMap; - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - float dist = length(texture(shadowCubeMap, inUVW).rgb) * 0.005; - outFragColor = vec4(vec3(dist), 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapomni/cubemapdisplay.vert b/tests/glsl/sascha-willems/shadowmapomni/cubemapdisplay.vert deleted file mode 100644 index b5f889174..000000000 --- a/tests/glsl/sascha-willems/shadowmapomni/cubemapdisplay.vert +++ /dev/null @@ -1,28 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUVW; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUVW = inPos; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} - diff --git a/tests/glsl/sascha-willems/shadowmapomni/offscreen.frag b/tests/glsl/sascha-willems/shadowmapomni/offscreen.frag deleted file mode 100644 index 6426c4118..000000000 --- a/tests/glsl/sascha-willems/shadowmapomni/offscreen.frag +++ /dev/null @@ -1,17 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out float outFragColor; - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inLightPos; - -void main() -{ - // Store distance to light as 32 bit float value - vec3 lightVec = inPos.xyz - inLightPos; - outFragColor = length(lightVec); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapomni/offscreen.vert b/tests/glsl/sascha-willems/shadowmapomni/offscreen.vert deleted file mode 100644 index 7513070dc..000000000 --- a/tests/glsl/sascha-willems/shadowmapomni/offscreen.vert +++ /dev/null @@ -1,36 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (location = 0) out vec4 outPos; -layout (location = 1) out vec3 outLightPos; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - vec4 lightPos; -} ubo; - -layout(push_constant) uniform PushConsts -{ - mat4 view; -} pushConsts; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - gl_Position = ubo.projection * pushConsts.view * ubo.model * vec4(inPos, 1.0); - - outPos = vec4(inPos, 1.0); - outLightPos = ubo.lightPos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapomni/scene.frag b/tests/glsl/sascha-willems/shadowmapomni/scene.frag deleted file mode 100644 index 1bdc44bdb..000000000 --- a/tests/glsl/sascha-willems/shadowmapomni/scene.frag +++ /dev/null @@ -1,44 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube shadowCubeMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inEyePos; -layout (location = 3) in vec3 inLightVec; -layout (location = 4) in vec3 inWorldPos; -layout (location = 5) in vec3 inLightPos; - -layout (location = 0) out vec4 outFragColor; - -#define EPSILON 0.15 -#define SHADOW_OPACITY 0.5 - -void main() -{ - // Lighting - vec3 N = normalize(inNormal); - vec3 L = normalize(vec3(1.0)); - - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec4 IAmbient = vec4(vec3(0.05), 1.0); - vec4 IDiffuse = vec4(1.0) * max(dot(inNormal, inLightVec), 0.0); - - outFragColor = vec4(IAmbient + IDiffuse * vec4(inColor, 1.0)); - - // Shadow - vec3 lightVec = inWorldPos - inLightPos; - float sampledDist = texture(shadowCubeMap, lightVec).r; - float dist = length(lightVec); - - // Check if fragment is in shadow - float shadow = (dist <= sampledDist + EPSILON) ? 1.0 : SHADOW_OPACITY; - - outFragColor.rgb *= shadow; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapomni/scene.vert b/tests/glsl/sascha-willems/shadowmapomni/scene.vert deleted file mode 100644 index aed2c97ae..000000000 --- a/tests/glsl/sascha-willems/shadowmapomni/scene.vert +++ /dev/null @@ -1,43 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outEyePos; -layout (location = 3) out vec3 outLightVec; -layout (location = 4) out vec3 outWorldPos; -layout (location = 5) out vec3 outLightPos; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - outNormal = inNormal; - - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0); - outEyePos = vec3(ubo.model * vec4(inPos, 1.0f)); - outLightVec = normalize(ubo.lightPos.xyz - inPos.xyz); - outWorldPos = inPos; - - outLightPos = ubo.lightPos.xyz; -} - diff --git a/tests/glsl/sascha-willems/shadowmapping/offscreen.frag b/tests/glsl/sascha-willems/shadowmapping/offscreen.frag deleted file mode 100644 index 81c8f55a3..000000000 --- a/tests/glsl/sascha-willems/shadowmapping/offscreen.frag +++ /dev/null @@ -1,14 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout(location = 0) out vec4 color; -//layout(location = 0) out float fragmentdepth; - -void main() -{ -// fragmentdepth = gl_FragCoord.z; - color = vec4(1.0, 0.0, 0.0, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapping/offscreen.vert b/tests/glsl/sascha-willems/shadowmapping/offscreen.vert deleted file mode 100644 index e5d18fc88..000000000 --- a/tests/glsl/sascha-willems/shadowmapping/offscreen.vert +++ /dev/null @@ -1,23 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (binding = 0) uniform UBO -{ - mat4 depthMVP; -} ubo; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - - -void main() -{ - gl_Position = ubo.depthMVP * vec4(inPos, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapping/quad.frag b/tests/glsl/sascha-willems/shadowmapping/quad.frag deleted file mode 100644 index 3074bd5ee..000000000 --- a/tests/glsl/sascha-willems/shadowmapping/quad.frag +++ /dev/null @@ -1,25 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -float LinearizeDepth(float depth) -{ - float n = 1.0; // camera z near - float f = 128.0; // camera z far - float z = depth; - return (2.0 * n) / (f + n - z * (f - n)); -} - -void main() -{ - float depth = texture(samplerColor, inUV).r; - outFragColor = vec4(vec3(1.0-LinearizeDepth(depth)), 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapping/quad.vert b/tests/glsl/sascha-willems/shadowmapping/quad.vert deleted file mode 100644 index 7c1286a4c..000000000 --- a/tests/glsl/sascha-willems/shadowmapping/quad.vert +++ /dev/null @@ -1,28 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - - -void main() -{ - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/shadowmapping/scene.frag b/tests/glsl/sascha-willems/shadowmapping/scene.frag deleted file mode 100644 index 58e2986ce..000000000 --- a/tests/glsl/sascha-willems/shadowmapping/scene.frag +++ /dev/null @@ -1,72 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D shadowMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; -layout (location = 4) in vec4 inShadowCoord; - -layout (constant_id = 0) const int enablePCF = 0; - -layout (location = 0) out vec4 outFragColor; - -#define ambient 0.1 - -float textureProj(vec4 P, vec2 off) -{ - float shadow = 1.0; - vec4 shadowCoord = P / P.w; - if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) - { - float dist = texture( shadowMap, shadowCoord.st + off ).r; - if ( shadowCoord.w > 0.0 && dist < shadowCoord.z ) - { - shadow = ambient; - } - } - return shadow; -} - -float filterPCF(vec4 sc) -{ - ivec2 texDim = textureSize(shadowMap, 0); - float scale = 1.5; - float dx = scale * 1.0 / float(texDim.x); - float dy = scale * 1.0 / float(texDim.y); - - float shadowFactor = 0.0; - int count = 0; - int range = 1; - - for (int x = -range; x <= range; x++) - { - for (int y = -range; y <= range; y++) - { - shadowFactor += textureProj(sc, vec2(dx*x, dy*y)); - count++; - } - - } - return shadowFactor / count; -} - -void main() -{ - float shadow = (enablePCF == 1) ? filterPCF(inShadowCoord / inShadowCoord.w) : textureProj(inShadowCoord / inShadowCoord.w, vec2(0.0)); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = normalize(-reflect(L, N)); - vec3 diffuse = max(dot(N, L), ambient) * inColor; -// vec3 specular = pow(max(dot(R, V), 0.0), 50.0) * vec3(0.75); - - outFragColor = vec4(diffuse * shadow, 1.0); - -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/shadowmapping/scene.vert b/tests/glsl/sascha-willems/shadowmapping/scene.vert deleted file mode 100644 index 6fda339c3..000000000 --- a/tests/glsl/sascha-willems/shadowmapping/scene.vert +++ /dev/null @@ -1,52 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - mat4 lightSpace; - vec3 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; -layout (location = 4) out vec4 outShadowCoord; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -const mat4 biasMat = mat4( - 0.5, 0.0, 0.0, 0.0, - 0.0, 0.5, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.5, 0.5, 0.0, 1.0 ); - -void main() -{ - outColor = inColor; - outNormal = inNormal; - - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - outLightVec = normalize(ubo.lightPos - inPos); - outViewVec = -pos.xyz; - - outShadowCoord = ( biasMat * ubo.lightSpace * ubo.model ) * vec4(inPos, 1.0); -} - diff --git a/tests/glsl/sascha-willems/skeletalanimation/mesh.frag b/tests/glsl/sascha-willems/skeletalanimation/mesh.frag deleted file mode 100644 index c25560d09..000000000 --- a/tests/glsl/sascha-willems/skeletalanimation/mesh.frag +++ /dev/null @@ -1,28 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColorMap, inUV) * vec4(inColor, 1.0); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0);// * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 32.0) * vec3(0.5); - outFragColor = vec4(diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/skeletalanimation/mesh.vert b/tests/glsl/sascha-willems/skeletalanimation/mesh.vert deleted file mode 100644 index ca11e0b42..000000000 --- a/tests/glsl/sascha-willems/skeletalanimation/mesh.vert +++ /dev/null @@ -1,53 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; -layout (location = 4) in vec4 inBoneWeights; -layout (location = 5) in ivec4 inBoneIDs; - -#define MAX_BONES 64 - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - mat4 bones[MAX_BONES]; - vec4 lightPos; - vec4 viewPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - mat4 boneTransform = ubo.bones[inBoneIDs[0]] * inBoneWeights[0]; - boneTransform += ubo.bones[inBoneIDs[1]] * inBoneWeights[1]; - boneTransform += ubo.bones[inBoneIDs[2]] * inBoneWeights[2]; - boneTransform += ubo.bones[inBoneIDs[3]] * inBoneWeights[3]; - - outColor = inColor; - outUV = inUV; - - gl_Position = ubo.projection * ubo.view * ubo.model * boneTransform * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(inverse(transpose(ubo.model * boneTransform))) * inNormal; - outLightVec = ubo.lightPos.xyz - pos.xyz; - outViewVec = ubo.viewPos.xyz - pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/skeletalanimation/texture.frag b/tests/glsl/sascha-willems/skeletalanimation/texture.frag deleted file mode 100644 index 1adb226bb..000000000 --- a/tests/glsl/sascha-willems/skeletalanimation/texture.frag +++ /dev/null @@ -1,32 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColorMap, inUV); - - float distSqr = dot(inLightVec, inLightVec); - vec3 lVec = inLightVec * inversesqrt(distSqr); - - const float attInvRadius = 1.0/5000.0; - float atten = max(clamp(1.0 - attInvRadius * sqrt(distSqr), 0.0, 1.0), 0.0); - - // Fake drop shadow - const float shadowInvRadius = 1.0/2500.0; - float dropshadow = max(clamp(1.0 - shadowInvRadius * sqrt(distSqr), 0.0, 1.0), 0.0); - - outFragColor = vec4(color.rgba * (1.0 - dropshadow)); - outFragColor.rgb *= atten; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/skeletalanimation/texture.vert b/tests/glsl/sascha-willems/skeletalanimation/texture.vert deleted file mode 100644 index 67b3f2334..000000000 --- a/tests/glsl/sascha-willems/skeletalanimation/texture.vert +++ /dev/null @@ -1,40 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec4 lightPos; - vec4 viewPos; - vec2 uvOffset; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV + ubo.uvOffset; - vec4 pos = vec4(inPos, 1.0); - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(pos); - - outNormal = mat3(ubo.model) * inNormal; - outLightVec = ubo.lightPos.xyz - pos.xyz; - outViewVec = ubo.viewPos.xyz - pos.xyz; -} diff --git a/tests/glsl/sascha-willems/specializationconstants/uber.frag b/tests/glsl/sascha-willems/specializationconstants/uber.frag deleted file mode 100644 index 9661dff03..000000000 --- a/tests/glsl/sascha-willems/specializationconstants/uber.frag +++ /dev/null @@ -1,75 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColormap; -layout (binding = 2) uniform sampler2D samplerDiscard; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -// We use this constant to control the flow of the shader depending on the -// lighting model selected at pipeline creation time -layout (constant_id = 0) const int LIGHTING_MODEL = 0; -// Parameter for the toon shading part of the shader -layout (constant_id = 1) const float PARAM_TOON_DESATURATION = 0.0f; - -void main() -{ - switch (LIGHTING_MODEL) { - case 0: // Phong - { - vec3 ambient = inColor * vec3(0.25); - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * inColor; - vec3 specular = pow(max(dot(R, V), 0.0), 32.0) * vec3(0.75); - outFragColor = vec4(ambient + diffuse * 1.75 + specular, 1.0); - break; - } - case 1: // Toon - { - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - float intensity = dot(N,L); - vec3 color; - if (intensity > 0.98) - color = inColor * 1.5; - else if (intensity > 0.9) - color = inColor * 1.0; - else if (intensity > 0.5) - color = inColor * 0.6; - else if (intensity > 0.25) - color = inColor * 0.4; - else - color = inColor * 0.2; - // Desaturate a bit - color = vec3(mix(color, vec3(dot(vec3(0.2126,0.7152,0.0722), color)), PARAM_TOON_DESATURATION)); - outFragColor.rgb = color; - break; - } - case 2: // Textured - { - vec4 color = texture(samplerColormap, inUV).rrra; - vec3 ambient = color.rgb * vec3(0.25) * inColor; - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * color.rgb; - float specular = pow(max(dot(R, V), 0.0), 32.0) * color.a; - outFragColor = vec4(ambient + diffuse + vec3(specular), 1.0); - break; - } - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/specializationconstants/uber.vert b/tests/glsl/sascha-willems/specializationconstants/uber.vert deleted file mode 100644 index 44fd2e692..000000000 --- a/tests/glsl/sascha-willems/specializationconstants/uber.vert +++ /dev/null @@ -1,42 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec2 outUV; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outColor = inColor; - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(ubo.model) * inNormal; - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/sphericalenvmapping/sem.frag b/tests/glsl/sascha-willems/sphericalenvmapping/sem.frag deleted file mode 100644 index 6735ee03c..000000000 --- a/tests/glsl/sascha-willems/sphericalenvmapping/sem.frag +++ /dev/null @@ -1,23 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2DArray matCap; - -layout (location = 0) in vec3 inColor; -layout (location = 1) in vec3 inEyePos; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in flat int inTexIndex; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 r = reflect( inEyePos, inNormal ); - vec3 r2 = vec3( r.x, r.y, r.z + 1.0 ); - float m = 2.0 * length( r2 ); - vec2 vN = r.xy / m + .5; - outFragColor = vec4( texture( matCap, vec3(vN, inTexIndex)).rgb * (clamp(inColor.r * 2, 0.0, 1.0)), 1.0 ); -} diff --git a/tests/glsl/sascha-willems/sphericalenvmapping/sem.vert b/tests/glsl/sascha-willems/sphericalenvmapping/sem.vert deleted file mode 100644 index bb94e3f0e..000000000 --- a/tests/glsl/sascha-willems/sphericalenvmapping/sem.vert +++ /dev/null @@ -1,35 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 normal; - mat4 view; - int texIndex; -} ubo; - -layout (location = 0) out vec3 outColor; -layout (location = 1) out vec3 outEyePos; -layout (location = 2) out vec3 outNormal; -layout (location = 3) out flat int outTexIndex; - -void main() -{ - outColor = inColor; - mat4 modelView = ubo.view * ubo.model; - outEyePos = normalize( vec3( modelView * inPos ) ); - outTexIndex = ubo.texIndex; - outNormal = normalize( mat3(ubo.normal) * inNormal ); - vec3 r = reflect( outEyePos, outNormal ); - float m = 2.0 * sqrt( pow(r.x, 2.0) + pow(r.y, 2.0) + pow(r.z + 1.0, 2.0)); - gl_Position = ubo.projection * modelView * inPos; -} diff --git a/tests/glsl/sascha-willems/ssao/blur.frag b/tests/glsl/sascha-willems/ssao/blur.frag deleted file mode 100644 index 23b808d9b..000000000 --- a/tests/glsl/sascha-willems/ssao/blur.frag +++ /dev/null @@ -1,29 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerSSAO; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out float outFragColor; - -void main() -{ - const int blurRange = 2; - int n = 0; - vec2 texelSize = 1.0 / vec2(textureSize(samplerSSAO, 0)); - float result = 0.0; - for (int x = -blurRange; x < blurRange; x++) - { - for (int y = -blurRange; y < blurRange; y++) - { - vec2 offset = vec2(float(x), float(y)) * texelSize; - result += texture(samplerSSAO, inUV + offset).r; - n++; - } - } - outFragColor = result / (float(n)); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/ssao/composition.frag b/tests/glsl/sascha-willems/ssao/composition.frag deleted file mode 100644 index edf49b5d3..000000000 --- a/tests/glsl/sascha-willems/ssao/composition.frag +++ /dev/null @@ -1,56 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 0) uniform sampler2D samplerposition; -layout (binding = 1) uniform sampler2D samplerNormal; -layout (binding = 2) uniform sampler2D samplerAlbedo; -layout (binding = 3) uniform sampler2D samplerSSAO; -layout (binding = 4) uniform sampler2D samplerSSAOBlur; -layout (binding = 5) uniform UBO -{ - mat4 _dummy; - uint ssao; - uint ssaoOnly; - uint ssaoBlur; -} uboParams; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 fragPos = texture(samplerposition, inUV).rgb; - vec3 normal = normalize(texture(samplerNormal, inUV).rgb * 2.0 - 1.0); - vec4 albedo = texture(samplerAlbedo, inUV); - - float ssao = (uboParams.ssaoBlur == 1) ? texture(samplerSSAOBlur, inUV).r : texture(samplerSSAO, inUV).r; - - vec3 lightPos = vec3(0.0); - vec3 L = normalize(lightPos - fragPos); - float NdotL = max(0.5, dot(normal, L)); - - if (uboParams.ssaoOnly == 1) - { - outFragColor.rgb = ssao.rrr; - } - else - { - vec3 baseColor = albedo.rgb * NdotL; - - if (uboParams.ssao == 1) - { - outFragColor.rgb = ssao.rrr; - - if (uboParams.ssaoOnly != 1) - outFragColor.rgb *= baseColor; - } - else - { - outFragColor.rgb = baseColor; - } - } -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/ssao/fullscreen.vert b/tests/glsl/sascha-willems/ssao/fullscreen.vert deleted file mode 100644 index 117eb02ec..000000000 --- a/tests/glsl/sascha-willems/ssao/fullscreen.vert +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -} diff --git a/tests/glsl/sascha-willems/ssao/gbuffer.frag b/tests/glsl/sascha-willems/ssao/gbuffer.frag deleted file mode 100644 index 9e81b9231..000000000 --- a/tests/glsl/sascha-willems/ssao/gbuffer.frag +++ /dev/null @@ -1,30 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inPos; - -layout (location = 0) out vec4 outPosition; -layout (location = 1) out vec4 outNormal; -layout (location = 2) out vec4 outAlbedo; - -const float NEAR_PLANE = 0.1f; //todo: specialization const -const float FAR_PLANE = 64.0f; //todo: specialization const - -float linearDepth(float depth) -{ - float z = depth * 2.0f - 1.0f; - return (2.0f * NEAR_PLANE * FAR_PLANE) / (FAR_PLANE + NEAR_PLANE - z * (FAR_PLANE - NEAR_PLANE)); -} - -void main() -{ - outPosition = vec4(inPos, linearDepth(gl_FragCoord.z)); - outNormal = vec4(normalize(inNormal) * 0.5 + 0.5, 1.0); - outAlbedo = vec4(inColor * 2.0, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/ssao/gbuffer.vert b/tests/glsl/sascha-willems/ssao/gbuffer.vert deleted file mode 100644 index 3160cf949..000000000 --- a/tests/glsl/sascha-willems/ssao/gbuffer.vert +++ /dev/null @@ -1,43 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outColor; -layout (location = 3) out vec3 outPos; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - gl_Position = ubo.projection * ubo.view * ubo.model * inPos; - - outUV = inUV; - - // Vertex position in view space - outPos = vec3(ubo.view * ubo.model * inPos); - - // Normal in view space - mat3 normalMatrix = transpose(inverse(mat3(ubo.view * ubo.model))); - outNormal = normalMatrix * inNormal; - - outColor = inColor; -} diff --git a/tests/glsl/sascha-willems/ssao/ssao.frag b/tests/glsl/sascha-willems/ssao/ssao.frag deleted file mode 100644 index ef0035013..000000000 --- a/tests/glsl/sascha-willems/ssao/ssao.frag +++ /dev/null @@ -1,80 +0,0 @@ -#version 450 -//TEST:COMPARE_GLSL: -//TEST:COMPARE_GLSL:-DBINDING - -#if defined(__SLANG__) && defined(BINDING) -#define LAYOUT(X) /* empty */ -#else -#define LAYOUT(X) layout(X) -#endif - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -LAYOUT(binding = 0) uniform sampler2D samplerPositionDepth; -LAYOUT(binding = 1) uniform sampler2D samplerNormal; -LAYOUT(binding = 2) uniform sampler2D ssaoNoise; - -layout (constant_id = 0) const int SSAO_KERNEL_SIZE = 64; -layout (constant_id = 1) const float SSAO_RADIUS = 0.5; - -LAYOUT(binding = 3) uniform UBOSSAOKernel -{ - vec4 samples[SSAO_KERNEL_SIZE]; -} uboSSAOKernel; - -LAYOUT(binding = 4) uniform UBO -{ - mat4 projection; -} ubo; - -LAYOUT(location = 0) in vec2 inUV; - -LAYOUT(location = 0) out float outFragColor; - -void main() -{ - // Get G-Buffer values - vec3 fragPos = texture(samplerPositionDepth, inUV).rgb; - vec3 normal = normalize(texture(samplerNormal, inUV).rgb * 2.0 - 1.0); - - // Get a random vector using a noise lookup - ivec2 texDim = textureSize(samplerPositionDepth, 0); - ivec2 noiseDim = textureSize(ssaoNoise, 0); - const vec2 noiseUV = vec2(float(texDim.x)/float(noiseDim.x), float(texDim.y)/(noiseDim.y)) * inUV; - vec3 randomVec = texture(ssaoNoise, noiseUV).xyz * 2.0 - 1.0; - - // Create TBN matrix - vec3 tangent = normalize(randomVec - normal * dot(randomVec, normal)); - vec3 bitangent = cross(tangent, normal); - mat3 TBN = mat3(tangent, bitangent, normal); - - // Calculate occlusion value - float occlusion = 0.0f; - for(int i = 0; i < SSAO_KERNEL_SIZE; i++) - { - vec3 samplePos = TBN * uboSSAOKernel.samples[i].xyz; - samplePos = fragPos + samplePos * SSAO_RADIUS; - - // project - vec4 offset = vec4(samplePos, 1.0f); - offset = ubo.projection * offset; - offset.xyz /= offset.w; - offset.xyz = offset.xyz * 0.5f + 0.5f; - - float sampleDepth = -texture(samplerPositionDepth, offset.xy).w; - -#define RANGE_CHECK 1 -#ifdef RANGE_CHECK - // Range check - float rangeCheck = smoothstep(0.0f, 1.0f, SSAO_RADIUS / abs(fragPos.z - sampleDepth)); - occlusion += (sampleDepth >= samplePos.z ? 1.0f : 0.0f) * rangeCheck; -#else - occlusion += (sampleDepth >= samplePos.z ? 1.0f : 0.0f); -#endif - } - occlusion = 1.0 - (occlusion / float(SSAO_KERNEL_SIZE)); - - outFragColor = occlusion; -} - diff --git a/tests/glsl/sascha-willems/subpasses/composition.frag b/tests/glsl/sascha-willems/subpasses/composition.frag deleted file mode 100644 index 0a538471a..000000000 --- a/tests/glsl/sascha-willems/subpasses/composition.frag +++ /dev/null @@ -1,82 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (input_attachment_index = 0, binding = 0) uniform subpassInput samplerposition; -layout (input_attachment_index = 1, binding = 1) uniform subpassInput samplerNormal; -layout (input_attachment_index = 2, binding = 2) uniform subpassInput samplerAlbedo; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragcolor; -layout (location = 1) out vec4 outPosition; -layout (location = 2) out vec4 outNormal; -layout (location = 3) out vec4 outAlbedo; - -layout (constant_id = 0) const int NUM_LIGHTS = 64; - -struct Light { - vec4 position; - vec3 color; - float radius; -}; - -layout (binding = 3) uniform UBO -{ - vec4 viewPos; - Light lights[NUM_LIGHTS]; -} ubo; - - -void main() -{ - // Read G-Buffer values from previous sub pass - vec3 fragPos = subpassLoad(samplerposition).rgb; - vec3 normal = subpassLoad(samplerNormal).rgb; - vec4 albedo = subpassLoad(samplerAlbedo); - - #define ambient 0.15 - - // Ambient part - vec3 fragcolor = albedo.rgb * ambient; - - for(int i = 0; i < NUM_LIGHTS; ++i) - { - // Vector to light - vec3 L = ubo.lights[i].position.xyz - fragPos; - // Distance from light to fragment position - float dist = length(L); - - // Viewer to fragment - vec3 V = ubo.viewPos.xyz - fragPos; - V = normalize(V); - - // Light to fragment - L = normalize(L); - - // Attenuation - float atten = ubo.lights[i].radius / (pow(dist, 2.0) + 1.0); - - // Diffuse part - vec3 N = normalize(normal); - float NdotL = max(0.0, dot(N, L)); - vec3 diff = ubo.lights[i].color * albedo.rgb * NdotL * atten; - - // Specular part - // Specular map values are stored in alpha of albedo mrt - vec3 R = reflect(-L, N); - float NdotR = max(0.0, dot(R, V)); - //vec3 spec = ubo.lights[i].color * albedo.a * pow(NdotR, 32.0) * atten; - - fragcolor += diff;// + spec; - } - - outFragcolor = vec4(fragcolor, 1.0); - - // Write G-Buffer attachments to avoid undefined behaviour (validation error) - outPosition = vec4(0.0); - outNormal = vec4(0.0); - outAlbedo = vec4(0.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/subpasses/composition.vert b/tests/glsl/sascha-willems/subpasses/composition.vert deleted file mode 100644 index f463f9182..000000000 --- a/tests/glsl/sascha-willems/subpasses/composition.vert +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/subpasses/gbuffer.frag b/tests/glsl/sascha-willems/subpasses/gbuffer.frag deleted file mode 100644 index 389d1aa80..000000000 --- a/tests/glsl/sascha-willems/subpasses/gbuffer.frag +++ /dev/null @@ -1,43 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; -layout (binding = 2) uniform sampler2D samplerNormalMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inWorldPos; - -layout (location = 0) out vec4 outColor; -layout (location = 1) out vec4 outPosition; -layout (location = 2) out vec4 outNormal; -layout (location = 3) out vec4 outAlbedo; - -layout (constant_id = 0) const float NEAR_PLANE = 0.1f; -layout (constant_id = 1) const float FAR_PLANE = 256.0f; - -float linearDepth(float depth) -{ - float z = depth * 2.0f - 1.0f; - return (2.0f * NEAR_PLANE * FAR_PLANE) / (FAR_PLANE + NEAR_PLANE - z * (FAR_PLANE - NEAR_PLANE)); -} - -void main() -{ - outPosition = vec4(inWorldPos, 1.0); - - vec3 N = normalize(inNormal); - N.y = -N.y; - outNormal = vec4(N, 1.0); - - outAlbedo.rgb = inColor; - - // Store linearized depth in alpha component - outPosition.a = linearDepth(gl_FragCoord.z); - - // Write color attachments to avoid undefined behaviour (validation error) - outColor = vec4(0.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/subpasses/gbuffer.vert b/tests/glsl/sascha-willems/subpasses/gbuffer.vert deleted file mode 100644 index c57d04e6d..000000000 --- a/tests/glsl/sascha-willems/subpasses/gbuffer.vert +++ /dev/null @@ -1,43 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outWorldPos; -layout (location = 3) out vec3 outTangent; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - gl_Position = ubo.projection * ubo.view * ubo.model * inPos; - - // Vertex position in world space - outWorldPos = vec3(ubo.model * inPos); - // GL to Vulkan coord space - outWorldPos.y = -outWorldPos.y; - - // Normal in world space - mat3 mNormal = transpose(inverse(mat3(ubo.model))); - outNormal = mNormal * normalize(inNormal); - - // Currently just vertex color - outColor = inColor; -} diff --git a/tests/glsl/sascha-willems/subpasses/transparent.frag b/tests/glsl/sascha-willems/subpasses/transparent.frag deleted file mode 100644 index f293f2b8c..000000000 --- a/tests/glsl/sascha-willems/subpasses/transparent.frag +++ /dev/null @@ -1,34 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (input_attachment_index = 0, binding = 1) uniform subpassInput samplerPositionDepth; -layout (binding = 2) uniform sampler2D samplerTexture; - -layout (location = 0) in vec3 inColor; -layout (location = 1) in vec2 inUV; - -layout (location = 0) out vec4 outColor; - -layout (constant_id = 0) const float NEAR_PLANE = 0.1f; -layout (constant_id = 1) const float FAR_PLANE = 256.0f; - -float linearDepth(float depth) -{ - float z = depth * 2.0f - 1.0f; - return (2.0f * NEAR_PLANE * FAR_PLANE) / (FAR_PLANE + NEAR_PLANE - z * (FAR_PLANE - NEAR_PLANE)); -} - -void main () -{ - // Sample depth from deferred depth buffer and discard if obscured - float depth = subpassLoad(samplerPositionDepth).a; - if ((depth != 0.0) && (linearDepth(gl_FragCoord.z) > depth)) - { - discard; - }; - - outColor = texture(samplerTexture, inUV); -} diff --git a/tests/glsl/sascha-willems/subpasses/transparent.vert b/tests/glsl/sascha-willems/subpasses/transparent.vert deleted file mode 100644 index 8d667b820..000000000 --- a/tests/glsl/sascha-willems/subpasses/transparent.vert +++ /dev/null @@ -1,28 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; -} ubo; - -layout (location = 0) out vec3 outColor; -layout (location = 1) out vec2 outUV; - -void main () -{ - outColor = inColor; - outUV = inUV; - - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/terraintessellation/skysphere.frag b/tests/glsl/sascha-willems/terraintessellation/skysphere.frag deleted file mode 100644 index 7d87b21cd..000000000 --- a/tests/glsl/sascha-willems/terraintessellation/skysphere.frag +++ /dev/null @@ -1,14 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 core - -layout (location = 0) in vec2 inUV; - -layout (set = 0, binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) out vec4 outFragColor; - -void main(void) -{ - vec4 color = texture(samplerColorMap, inUV); - outFragColor = vec4(color.rgb, 1.0); -} diff --git a/tests/glsl/sascha-willems/terraintessellation/skysphere.vert b/tests/glsl/sascha-willems/terraintessellation/skysphere.vert deleted file mode 100644 index 74dd7ad3b..000000000 --- a/tests/glsl/sascha-willems/terraintessellation/skysphere.vert +++ /dev/null @@ -1,24 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 core - -layout (location = 0) in vec3 inPos; -layout (location = 2) in vec2 inUV; - -layout (location = 0) out vec2 outUV; - -layout (set = 0, binding = 0) uniform UBO -{ - mat4 mvp; -} ubo; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main(void) -{ - gl_Position = ubo.mvp * vec4(inPos, 1.0); - outUV = inUV; - outUV.t = 1.0 - outUV.t; -} diff --git a/tests/glsl/sascha-willems/terraintessellation/terrain.frag b/tests/glsl/sascha-willems/terraintessellation/terrain.frag deleted file mode 100644 index fcd8612ae..000000000 --- a/tests/glsl/sascha-willems/terraintessellation/terrain.frag +++ /dev/null @@ -1,65 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (set = 0, binding = 1) uniform sampler2D samplerHeight; -layout (set = 0, binding = 2) uniform sampler2DArray samplerLayers; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; -layout (location = 4) in vec3 inEyePos; -layout (location = 5) in vec3 inWorldPos; - -layout (location = 0) out vec4 outFragColor; - -vec3 sampleTerrainLayer() -{ - // Define some layer ranges for sampling depending on terrain height - vec2 layers[6]; - layers[0] = vec2(-10.0, 10.0); - layers[1] = vec2(5.0, 45.0); - layers[2] = vec2(45.0, 80.0); - layers[3] = vec2(75.0, 100.0); - layers[4] = vec2(95.0, 140.0); - layers[5] = vec2(140.0, 190.0); - - vec3 color = vec3(0.0); - - // Get height from displacement map - float height = textureLod(samplerHeight, inUV, 0.0).r * 255.0; - - for (int i = 0; i < 6; i++) - { - float range = layers[i].y - layers[i].x; - float weight = (range - abs(height - layers[i].y)) / range; - weight = max(0.0, weight); - color += weight * texture(samplerLayers, vec3(inUV * 16.0, i)).rgb; - } - - return color; -} - -float fog(float density) -{ - const float LOG2 = -1.442695; - float dist = gl_FragCoord.z / gl_FragCoord.w * 0.1; - float d = density * dist; - return 1.0 - clamp(exp2(d * d * LOG2), 0.0, 1.0); -} - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 ambient = vec3(0.5); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - - vec4 color = vec4((ambient + diffuse) * sampleTerrainLayer(), 1.0); - - const vec4 fogColor = vec4(0.47, 0.5, 0.67, 0.0); - outFragColor = mix(color, fogColor, fog(0.25)); -} diff --git a/tests/glsl/sascha-willems/terraintessellation/terrain.tesc b/tests/glsl/sascha-willems/terraintessellation/terrain.tesc deleted file mode 100644 index 133e44ea7..000000000 --- a/tests/glsl/sascha-willems/terraintessellation/terrain.tesc +++ /dev/null @@ -1,120 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout(set = 0, binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; - vec4 frustumPlanes[6]; - float displacementFactor; - float tessellationFactor; - vec2 viewportDim; - float tessellatedEdgeSize; -} ubo; - -layout(set = 0, binding = 1) uniform sampler2D samplerHeight; - -layout (vertices = 4) out; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec2 inUV[]; - -layout (location = 0) out vec3 outNormal[4]; -layout (location = 1) out vec2 outUV[4]; - -// Calculate the tessellation factor based on screen space -// dimensions of the edge -float screenSpaceTessFactor(vec4 p0, vec4 p1) -{ - // Calculate edge mid point - vec4 midPoint = 0.5 * (p0 + p1); - // Sphere radius as distance between the control points - float radius = distance(p0, p1) / 2.0; - - // View space - vec4 v0 = ubo.modelview * midPoint; - - // Project into clip space - vec4 clip0 = (ubo.projection * (v0 - vec4(radius, vec3(0.0)))); - vec4 clip1 = (ubo.projection * (v0 + vec4(radius, vec3(0.0)))); - - // Get normalized device coordinates - clip0 /= clip0.w; - clip1 /= clip1.w; - - // Convert to viewport coordinates - clip0.xy *= ubo.viewportDim; - clip1.xy *= ubo.viewportDim; - - // Return the tessellation factor based on the screen size - // given by the distance of the two edge control points in screen space - // and a reference (min.) tessellation size for the edge set by the application - return clamp(distance(clip0, clip1) / ubo.tessellatedEdgeSize * ubo.tessellationFactor, 1.0, 64.0); -} - -// Checks the current's patch visibility against the frustum using a sphere check -// Sphere radius is given by the patch size -bool frustumCheck() -{ - // Fixed radius (increase if patch size is increased in example) - const float radius = 8.0f; - vec4 pos = gl_in[gl_InvocationID].gl_Position; - pos.y -= textureLod(samplerHeight, inUV[0], 0.0).r * ubo.displacementFactor; - - // Check sphere against frustum planes - for (int i = 0; i < 6; i++) { - if (dot(pos, ubo.frustumPlanes[i]) + radius < 0.0) - { - return false; - } - } - return true; -} - -void main() -{ - if (gl_InvocationID == 0) - { - if (!frustumCheck()) - { - gl_TessLevelInner[0] = 0.0; - gl_TessLevelInner[1] = 0.0; - gl_TessLevelOuter[0] = 0.0; - gl_TessLevelOuter[1] = 0.0; - gl_TessLevelOuter[2] = 0.0; - gl_TessLevelOuter[3] = 0.0; - } - else - { - if (ubo.tessellationFactor > 0.0) - { - gl_TessLevelOuter[0] = screenSpaceTessFactor(gl_in[3].gl_Position, gl_in[0].gl_Position); - gl_TessLevelOuter[1] = screenSpaceTessFactor(gl_in[0].gl_Position, gl_in[1].gl_Position); - gl_TessLevelOuter[2] = screenSpaceTessFactor(gl_in[1].gl_Position, gl_in[2].gl_Position); - gl_TessLevelOuter[3] = screenSpaceTessFactor(gl_in[2].gl_Position, gl_in[3].gl_Position); - gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5); - gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5); - } - else - { - // Tessellation factor can be set to zero by example - // to demonstrate a simple passthrough - gl_TessLevelInner[0] = 1.0; - gl_TessLevelInner[1] = 1.0; - gl_TessLevelOuter[0] = 1.0; - gl_TessLevelOuter[1] = 1.0; - gl_TessLevelOuter[2] = 1.0; - gl_TessLevelOuter[3] = 1.0; - } - } - - } - - gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; - outNormal[gl_InvocationID] = inNormal[gl_InvocationID]; - outUV[gl_InvocationID] = inUV[gl_InvocationID]; -} diff --git a/tests/glsl/sascha-willems/terraintessellation/terrain.tese b/tests/glsl/sascha-willems/terraintessellation/terrain.tese deleted file mode 100644 index 1a74ac377..000000000 --- a/tests/glsl/sascha-willems/terraintessellation/terrain.tese +++ /dev/null @@ -1,58 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (set = 0, binding = 0) uniform UBO -{ - mat4 projection; - mat4 modelview; - vec4 lightPos; - vec4 frustumPlanes[6]; - float displacementFactor; - float tessellationFactor; - vec2 viewportDim; - float tessellatedEdgeSize; -} ubo; - -layout (set = 0, binding = 1) uniform sampler2D displacementMap; - -layout(quads, equal_spacing, cw) in; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec2 inUV[]; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; -layout (location = 4) out vec3 outEyePos; -layout (location = 5) out vec3 outWorldPos; - -void main() -{ - // Interpolate UV coordinates - vec2 uv1 = mix(inUV[0], inUV[1], gl_TessCoord.x); - vec2 uv2 = mix(inUV[3], inUV[2], gl_TessCoord.x); - outUV = mix(uv1, uv2, gl_TessCoord.y); - - vec3 n1 = mix(inNormal[0], inNormal[1], gl_TessCoord.x); - vec3 n2 = mix(inNormal[3], inNormal[2], gl_TessCoord.x); - outNormal = mix(n1, n2, gl_TessCoord.y); - - // Interpolate positions - vec4 pos1 = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x); - vec4 pos2 = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x); - vec4 pos = mix(pos1, pos2, gl_TessCoord.y); - // Displace - pos.y -= textureLod(displacementMap, outUV, 0.0).r * ubo.displacementFactor; - // Perspective projection - gl_Position = ubo.projection * ubo.modelview * pos; - - // Calculate vectors for lighting based on tessellated position - outViewVec = -pos.xyz; - outLightVec = normalize(ubo.lightPos.xyz + outViewVec); - outWorldPos = pos.xyz; - outEyePos = vec3(ubo.modelview * pos); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/terraintessellation/terrain.vert b/tests/glsl/sascha-willems/terraintessellation/terrain.vert deleted file mode 100644 index 4a7c6ec66..000000000 --- a/tests/glsl/sascha-willems/terraintessellation/terrain.vert +++ /dev/null @@ -1,24 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main(void) -{ - gl_Position = vec4(inPos.xyz, 1.0); - outUV = inUV; - outNormal = inNormal; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/tessellation/base.frag b/tests/glsl/sascha-willems/tessellation/base.frag deleted file mode 100644 index 3bdd8b954..000000000 --- a/tests/glsl/sascha-willems/tessellation/base.frag +++ /dev/null @@ -1,22 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 2) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(vec3(0.0, -4.0, 4.0)); - - vec4 color = texture(samplerColorMap, inUV); - - outFragColor.rgb = vec3(clamp(max(dot(N,L), 0.0), 0.2, 1.0)) * color.rgb * 1.5; -} diff --git a/tests/glsl/sascha-willems/tessellation/base.vert b/tests/glsl/sascha-willems/tessellation/base.vert deleted file mode 100644 index 0bce97d99..000000000 --- a/tests/glsl/sascha-willems/tessellation/base.vert +++ /dev/null @@ -1,24 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main(void) -{ - gl_Position = vec4(inPos.xyz, 1.0); - outNormal = inNormal; - outUV = inUV; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/tessellation/passthrough.tesc b/tests/glsl/sascha-willems/tessellation/passthrough.tesc deleted file mode 100644 index 348bb43d7..000000000 --- a/tests/glsl/sascha-willems/tessellation/passthrough.tesc +++ /dev/null @@ -1,28 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (vertices = 3) out; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec2 inUV[]; - -layout (location = 0) out vec3 outNormal[3]; -layout (location = 1) out vec2 outUV[3]; - -void main(void) -{ - if (gl_InvocationID == 0) - { - gl_TessLevelInner[0] = 1.0; - gl_TessLevelOuter[0] = 1.0; - gl_TessLevelOuter[1] = 1.0; - gl_TessLevelOuter[2] = 1.0; - } - - gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; - outNormal[gl_InvocationID] = inNormal[gl_InvocationID]; - outUV[gl_InvocationID] = inUV[gl_InvocationID]; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/tessellation/passthrough.tese b/tests/glsl/sascha-willems/tessellation/passthrough.tese deleted file mode 100644 index 42dc5c562..000000000 --- a/tests/glsl/sascha-willems/tessellation/passthrough.tese +++ /dev/null @@ -1,31 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (triangles) in; - -layout (binding = 1) uniform UBO -{ - mat4 projection; - mat4 model; - float tessAlpha; -} ubo; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec2 inUV[]; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; - -void main(void) -{ - gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + - (gl_TessCoord.y * gl_in[1].gl_Position) + - (gl_TessCoord.z * gl_in[2].gl_Position); - gl_Position = ubo.projection * ubo.model * gl_Position; - - outNormal = gl_TessCoord.x*inNormal[0] + gl_TessCoord.y*inNormal[1] + gl_TessCoord.z*inNormal[2]; - outUV = gl_TessCoord.x*inUV[0] + gl_TessCoord.y*inUV[1] + gl_TessCoord.z*inUV[2]; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/tessellation/pntriangles.tesc b/tests/glsl/sascha-willems/tessellation/pntriangles.tesc deleted file mode 100644 index 90755153c..000000000 --- a/tests/glsl/sascha-willems/tessellation/pntriangles.tesc +++ /dev/null @@ -1,87 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// PN patch data -struct PnPatch -{ - float b210; - float b120; - float b021; - float b012; - float b102; - float b201; - float b111; - float n110; - float n011; - float n101; -}; - -// tessellation levels -layout (binding = 0) uniform UBO -{ - float tessLevel; -} ubo; - -layout(vertices=3) out; - -layout(location = 0) in vec3 inNormal[]; -layout(location = 1) in vec2 inUV[]; - -layout(location = 0) out vec3 outNormal[3]; -layout(location = 3) out vec2 outUV[3]; -layout(location = 6) out PnPatch outPatch[3]; - -float wij(int i, int j) -{ - return dot(gl_in[j].gl_Position.xyz - gl_in[i].gl_Position.xyz, inNormal[i]); -} - -float vij(int i, int j) -{ - vec3 Pj_minus_Pi = gl_in[j].gl_Position.xyz - - gl_in[i].gl_Position.xyz; - vec3 Ni_plus_Nj = inNormal[i]+inNormal[j]; - return 2.0*dot(Pj_minus_Pi, Ni_plus_Nj)/dot(Pj_minus_Pi, Pj_minus_Pi); -} - -void main() -{ - // get data - gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; - outNormal[gl_InvocationID] = inNormal[gl_InvocationID]; - outUV[gl_InvocationID] = inUV[gl_InvocationID]; - - // set base - float P0 = gl_in[0].gl_Position[gl_InvocationID]; - float P1 = gl_in[1].gl_Position[gl_InvocationID]; - float P2 = gl_in[2].gl_Position[gl_InvocationID]; - float N0 = inNormal[0][gl_InvocationID]; - float N1 = inNormal[1][gl_InvocationID]; - float N2 = inNormal[2][gl_InvocationID]; - - // compute control points - outPatch[gl_InvocationID].b210 = (2.0*P0 + P1 - wij(0,1)*N0)/3.0; - outPatch[gl_InvocationID].b120 = (2.0*P1 + P0 - wij(1,0)*N1)/3.0; - outPatch[gl_InvocationID].b021 = (2.0*P1 + P2 - wij(1,2)*N1)/3.0; - outPatch[gl_InvocationID].b012 = (2.0*P2 + P1 - wij(2,1)*N2)/3.0; - outPatch[gl_InvocationID].b102 = (2.0*P2 + P0 - wij(2,0)*N2)/3.0; - outPatch[gl_InvocationID].b201 = (2.0*P0 + P2 - wij(0,2)*N0)/3.0; - float E = ( outPatch[gl_InvocationID].b210 - + outPatch[gl_InvocationID].b120 - + outPatch[gl_InvocationID].b021 - + outPatch[gl_InvocationID].b012 - + outPatch[gl_InvocationID].b102 - + outPatch[gl_InvocationID].b201 ) / 6.0; - float V = (P0 + P1 + P2)/3.0; - outPatch[gl_InvocationID].b111 = E + (E - V)*0.5; - outPatch[gl_InvocationID].n110 = N0+N1-vij(0,1)*(P1-P0); - outPatch[gl_InvocationID].n011 = N1+N2-vij(1,2)*(P2-P1); - outPatch[gl_InvocationID].n101 = N2+N0-vij(2,0)*(P0-P2); - - // set tess levels - gl_TessLevelOuter[gl_InvocationID] = ubo.tessLevel; - gl_TessLevelInner[0] = ubo.tessLevel; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/tessellation/pntriangles.tese b/tests/glsl/sascha-willems/tessellation/pntriangles.tese deleted file mode 100644 index 5faf27f9d..000000000 --- a/tests/glsl/sascha-willems/tessellation/pntriangles.tese +++ /dev/null @@ -1,92 +0,0 @@ -//TEST(smoke):COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -// PN patch data -struct PnPatch -{ - float b210; - float b120; - float b021; - float b012; - float b102; - float b201; - float b111; - float n110; - float n011; - float n101; -}; - -layout (binding = 1) uniform UBO -{ - mat4 projection; - mat4 model; - float tessAlpha; -} ubo; - -layout(triangles, fractional_odd_spacing, ccw) in; - -layout(location = 0) in vec3 iNormal[]; -layout(location = 3) in vec2 iTexCoord[]; -layout(location = 6) in PnPatch iPnPatch[]; - -layout(location = 0) out vec3 oNormal; -layout(location = 1) out vec2 oTexCoord; - -#define uvw gl_TessCoord - -void main() -{ - vec3 uvwSquared = uvw * uvw; - vec3 uvwCubed = uvwSquared * uvw; - - // extract control points - vec3 b210 = vec3(iPnPatch[0].b210, iPnPatch[1].b210, iPnPatch[2].b210); - vec3 b120 = vec3(iPnPatch[0].b120, iPnPatch[1].b120, iPnPatch[2].b120); - vec3 b021 = vec3(iPnPatch[0].b021, iPnPatch[1].b021, iPnPatch[2].b021); - vec3 b012 = vec3(iPnPatch[0].b012, iPnPatch[1].b012, iPnPatch[2].b012); - vec3 b102 = vec3(iPnPatch[0].b102, iPnPatch[1].b102, iPnPatch[2].b102); - vec3 b201 = vec3(iPnPatch[0].b201, iPnPatch[1].b201, iPnPatch[2].b201); - vec3 b111 = vec3(iPnPatch[0].b111, iPnPatch[1].b111, iPnPatch[2].b111); - - // extract control normals - vec3 n110 = normalize(vec3(iPnPatch[0].n110, iPnPatch[1].n110, iPnPatch[2].n110)); - vec3 n011 = normalize(vec3(iPnPatch[0].n011, iPnPatch[1].n011, iPnPatch[2].n011)); - vec3 n101 = normalize(vec3(iPnPatch[0].n101, iPnPatch[1].n101, iPnPatch[2].n101)); - - // compute texcoords - oTexCoord = gl_TessCoord[2]*iTexCoord[0] + gl_TessCoord[0]*iTexCoord[1] + gl_TessCoord[1]*iTexCoord[2]; - - // normal - // Barycentric normal - vec3 barNormal = gl_TessCoord[2]*iNormal[0] + gl_TessCoord[0]*iNormal[1] + gl_TessCoord[1]*iNormal[2]; - vec3 pnNormal = iNormal[0]*uvwSquared[2] + iNormal[1]*uvwSquared[0] + iNormal[2]*uvwSquared[1] - + n110*uvw[2]*uvw[0] + n011*uvw[0]*uvw[1]+ n101*uvw[2]*uvw[1]; - oNormal = ubo.tessAlpha*pnNormal + (1.0-ubo.tessAlpha) * barNormal; - - // compute interpolated pos - vec3 barPos = gl_TessCoord[2]*gl_in[0].gl_Position.xyz - + gl_TessCoord[0]*gl_in[1].gl_Position.xyz - + gl_TessCoord[1]*gl_in[2].gl_Position.xyz; - - // save some computations - uvwSquared *= 3.0; - - // compute PN position - vec3 pnPos = gl_in[0].gl_Position.xyz*uvwCubed[2] - + gl_in[1].gl_Position.xyz*uvwCubed[0] - + gl_in[2].gl_Position.xyz*uvwCubed[1] - + b210*uvwSquared[2]*uvw[0] - + b120*uvwSquared[0]*uvw[2] - + b201*uvwSquared[2]*uvw[1] - + b021*uvwSquared[0]*uvw[1] - + b102*uvwSquared[1]*uvw[2] - + b012*uvwSquared[1]*uvw[0] - + b111*6.0*uvw[0]*uvw[1]*uvw[2]; - - // final position and normal - vec3 finalPos = (1.0-ubo.tessAlpha)*barPos + ubo.tessAlpha*pnPos; - gl_Position = ubo.projection * ubo.model * vec4(finalPos,1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/textoverlay/background.frag b/tests/glsl/sascha-willems/textoverlay/background.frag deleted file mode 100644 index 00ac6416b..000000000 --- a/tests/glsl/sascha-willems/textoverlay/background.frag +++ /dev/null @@ -1,16 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec2 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerColorMap, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/textoverlay/background.vert b/tests/glsl/sascha-willems/textoverlay/background.vert deleted file mode 100644 index 476834f38..000000000 --- a/tests/glsl/sascha-willems/textoverlay/background.vert +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); - gl_Position = vec4(outUV * vec2(2.0f, 2.0f) + vec2(-1.0f, -1.0f), 0.0f, 1.0f); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/textoverlay/mesh.frag b/tests/glsl/sascha-willems/textoverlay/mesh.frag deleted file mode 100644 index 696914ded..000000000 --- a/tests/glsl/sascha-willems/textoverlay/mesh.frag +++ /dev/null @@ -1,27 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColorMap; - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColorMap, inUV); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * color.rgb; - vec3 specular = pow(max(dot(R, V), 0.0), 1.0) * vec3(color.a); - outFragColor = vec4(diffuse + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/textoverlay/mesh.vert b/tests/glsl/sascha-willems/textoverlay/mesh.vert deleted file mode 100644 index dde3bf92d..000000000 --- a/tests/glsl/sascha-willems/textoverlay/mesh.vert +++ /dev/null @@ -1,39 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 lightPos; -} ubo; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec2 outUV; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outNormal = inNormal; - outUV = inUV; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(transpose(inverse(ubo.model))) * normalize(inNormal); - vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = -pos.xyz; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/textoverlay/text.frag b/tests/glsl/sascha-willems/textoverlay/text.frag deleted file mode 100644 index 42414689f..000000000 --- a/tests/glsl/sascha-willems/textoverlay/text.frag +++ /dev/null @@ -1,14 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 core - -layout (location = 0) in vec2 inUV; - -layout (binding = 0) uniform sampler2D samplerFont; - -layout (location = 0) out vec4 outFragColor; - -void main(void) -{ - float color = texture(samplerFont, inUV).r; - outFragColor = vec4(vec3(color), 1.0); -} diff --git a/tests/glsl/sascha-willems/textoverlay/text.vert b/tests/glsl/sascha-willems/textoverlay/text.vert deleted file mode 100644 index a9877dd0e..000000000 --- a/tests/glsl/sascha-willems/textoverlay/text.vert +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 core - -layout (location = 0) in vec2 inPos; -layout (location = 1) in vec2 inUV; - -layout (location = 0) out vec2 outUV; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main(void) -{ - gl_Position = vec4(inPos, 0.0, 1.0); - outUV = inUV; -} diff --git a/tests/glsl/sascha-willems/texture/texture.frag b/tests/glsl/sascha-willems/texture/texture.frag deleted file mode 100644 index 508f7f69c..000000000 --- a/tests/glsl/sascha-willems/texture/texture.frag +++ /dev/null @@ -1,29 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in float inLodBias; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColor, inUV, inLodBias); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - float specular = pow(max(dot(R, V), 0.0), 16.0) * color.a; - - outFragColor = vec4(diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/texture/texture.vert b/tests/glsl/sascha-willems/texture/texture.vert deleted file mode 100644 index 9cd64b831..000000000 --- a/tests/glsl/sascha-willems/texture/texture.vert +++ /dev/null @@ -1,45 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 viewPos; - float lodBias; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out float outLodBias; -layout (location = 2) out vec3 outNormal; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - outLodBias = ubo.lodBias; - - vec3 worldPos = vec3(ubo.model * vec4(inPos, 1.0)); - - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(inverse(transpose(ubo.model))) * inNormal; - vec3 lightPos = vec3(0.0); - vec3 lPos = mat3(ubo.model) * lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = ubo.viewPos.xyz - pos.xyz; -} diff --git a/tests/glsl/sascha-willems/texture3d/texture3d.frag b/tests/glsl/sascha-willems/texture3d/texture3d.frag deleted file mode 100644 index d9464a233..000000000 --- a/tests/glsl/sascha-willems/texture3d/texture3d.frag +++ /dev/null @@ -1,29 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler3D samplerColor; - -layout (location = 0) in vec3 inUV; -layout (location = 1) in float inLodBias; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(samplerColor, inUV); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - float specular = pow(max(dot(R, V), 0.0), 16.0) * color.r; - - outFragColor = vec4(diffuse * color.r + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/texture3d/texture3d.vert b/tests/glsl/sascha-willems/texture3d/texture3d.vert deleted file mode 100644 index 1aca0195b..000000000 --- a/tests/glsl/sascha-willems/texture3d/texture3d.vert +++ /dev/null @@ -1,44 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 viewPos; - float depth; -} ubo; - -layout (location = 0) out vec3 outUV; -layout (location = 1) out float outLodBias; -layout (location = 2) out vec3 outNormal; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = vec3(inUV, ubo.depth); - - vec3 worldPos = vec3(ubo.model * vec4(inPos, 1.0)); - - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec4 pos = ubo.model * vec4(inPos, 1.0); - outNormal = mat3(inverse(transpose(ubo.model))) * inNormal; - vec3 lightPos = vec3(0.0); - vec3 lPos = mat3(ubo.model) * lightPos.xyz; - outLightVec = lPos - pos.xyz; - outViewVec = ubo.viewPos.xyz - pos.xyz; -} diff --git a/tests/glsl/sascha-willems/texturearray/instancing.frag b/tests/glsl/sascha-willems/texturearray/instancing.frag deleted file mode 100644 index b0e293e34..000000000 --- a/tests/glsl/sascha-willems/texturearray/instancing.frag +++ /dev/null @@ -1,16 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform sampler2DArray samplerArray; - -layout (location = 0) in vec3 inUV; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerArray, inUV); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/texturearray/instancing.vert b/tests/glsl/sascha-willems/texturearray/instancing.vert deleted file mode 100644 index ad738a59b..000000000 --- a/tests/glsl/sascha-willems/texturearray/instancing.vert +++ /dev/null @@ -1,30 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec2 inUV; - -struct Instance -{ - mat4 model; - vec4 arrayIndex; -}; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - Instance instance[8]; -} ubo; - -layout (location = 0) out vec3 outUV; - -void main() -{ - outUV = vec3(inUV, ubo.instance[gl_InstanceIndex].arrayIndex.x); - mat4 modelView = ubo.view * ubo.instance[gl_InstanceIndex].model; - gl_Position = ubo.projection * modelView * inPos; -} diff --git a/tests/glsl/sascha-willems/texturemipmapgen/texture.frag b/tests/glsl/sascha-willems/texturemipmapgen/texture.frag deleted file mode 100644 index 037ed4e30..000000000 --- a/tests/glsl/sascha-willems/texturemipmapgen/texture.frag +++ /dev/null @@ -1,30 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (set = 0, binding = 1) uniform texture2D textureColor; -layout (set = 0, binding = 2) uniform sampler samplers[3]; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in float inLodBias; -layout (location = 2) flat in int inSamplerIndex; -layout (location = 3) in vec3 inNormal; -layout (location = 4) in vec3 inViewVec; -layout (location = 5) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = texture(sampler2D(textureColor, samplers[inSamplerIndex]), inUV, inLodBias); - - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(L, N); - vec3 diffuse = max(dot(N, L), 0.65) * vec3(1.0); - float specular = pow(max(dot(R, V), 0.0), 16.0) * color.a; - outFragColor = vec4(diffuse * color.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/texturemipmapgen/texture.vert b/tests/glsl/sascha-willems/texturemipmapgen/texture.vert deleted file mode 100644 index ed98fc24e..000000000 --- a/tests/glsl/sascha-willems/texturemipmapgen/texture.vert +++ /dev/null @@ -1,47 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec2 inUV; -layout (location = 2) in vec3 inNormal; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 view; - mat4 model; - vec4 viewPos; - float lodBias; - int samplerIndex; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out float outLodBias; -layout (location = 2) flat out int outSamplerIndex; -layout (location = 3) out vec3 outNormal; -layout (location = 4) out vec3 outViewVec; -layout (location = 5) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV * vec2(2.0, 1.0); - outLodBias = ubo.lodBias; - outSamplerIndex = ubo.samplerIndex; - - vec3 worldPos = vec3(ubo.model * vec4(inPos, 1.0)); - - gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0); - - outNormal = mat3(inverse(transpose(ubo.model))) * inNormal; - vec3 lightPos = vec3(-30.0, 0.0, 0.0); - outLightVec = worldPos - lightPos; - outViewVec = ubo.viewPos.xyz - worldPos; -} diff --git a/tests/glsl/sascha-willems/texturesparseresidency/sparseresidency.frag b/tests/glsl/sascha-willems/texturesparseresidency/sparseresidency.frag deleted file mode 100644 index c82b621e4..000000000 --- a/tests/glsl/sascha-willems/texturesparseresidency/sparseresidency.frag +++ /dev/null @@ -1,48 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_sparse_texture2 : enable -#extension GL_ARB_sparse_texture_clamp : enable - -layout (binding = 1) uniform sampler2D samplerColor; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in float inLodBias; -layout (location = 2) in vec3 inNormal; -layout (location = 3) in vec3 inViewVec; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec4 color = vec4(0.0); - - // Get residency code for current texel - int residencyCode = sparseTextureARB(samplerColor, inUV, color, inLodBias); - - // Fetch sparse until we get a valid texel - float minLod = 1.0; - while (!sparseTexelsResidentARB(residencyCode)) - { - residencyCode = sparseTextureClampARB(samplerColor, inUV, minLod, color); - minLod += 1.0f; - } - - // Check if texel is resident - bool texelResident = sparseTexelsResidentARB(residencyCode); - - if (!texelResident) - { - color = vec4(1.0, 0.0, 0.0, 0.0); - } - - vec3 N = normalize(inNormal); - - N = normalize((inNormal - 0.5) * 2.0); - - vec3 L = normalize(inLightVec); - vec3 R = reflect(-L, N); - vec3 diffuse = max(dot(N, L), 0.25) * color.rgb; - outFragColor = vec4(diffuse, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/texturesparseresidency/sparseresidency.vert b/tests/glsl/sascha-willems/texturesparseresidency/sparseresidency.vert deleted file mode 100644 index f29db5b5b..000000000 --- a/tests/glsl/sascha-willems/texturesparseresidency/sparseresidency.vert +++ /dev/null @@ -1,43 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - vec4 viewPos; - float lodBias; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out float outLodBias; -layout (location = 2) out vec3 outNormal; -layout (location = 3) out vec3 outViewVec; -layout (location = 4) out vec3 outLightVec; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outUV = inUV; - outLodBias = ubo.lodBias; - outNormal = inNormal; - - vec3 worldPos = vec3(ubo.model * vec4(inPos, 1.0)); - - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); - - vec3 lightPos = vec3(0.0, 50.0f, 0.0f); - outLightVec = lightPos - inPos.xyz; - outViewVec = ubo.viewPos.xyz - worldPos.xyz; -} diff --git a/tests/glsl/sascha-willems/triangle/triangle.frag b/tests/glsl/sascha-willems/triangle/triangle.frag deleted file mode 100644 index 70ee9fc53..000000000 --- a/tests/glsl/sascha-willems/triangle/triangle.frag +++ /dev/null @@ -1,14 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inColor; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = vec4(inColor, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/triangle/triangle.vert b/tests/glsl/sascha-willems/triangle/triangle.vert deleted file mode 100644 index b14410d80..000000000 --- a/tests/glsl/sascha-willems/triangle/triangle.vert +++ /dev/null @@ -1,29 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projectionMatrix; - mat4 modelMatrix; - mat4 viewMatrix; -} ubo; - -layout (location = 0) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - - -void main() -{ - outColor = inColor; - gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/viewportarray/multiview.geom b/tests/glsl/sascha-willems/viewportarray/multiview.geom deleted file mode 100644 index 39303fb33..000000000 --- a/tests/glsl/sascha-willems/viewportarray/multiview.geom +++ /dev/null @@ -1,46 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_viewport_array : enable - -layout (triangles, invocations = 2) in; -layout (triangle_strip, max_vertices = 3) out; - -layout (binding = 0) uniform UBO -{ - mat4 projection[2]; - mat4 modelview[2]; - vec4 lightPos; -} ubo; - -layout (location = 0) in vec3 inNormal[]; -layout (location = 1) in vec3 inColor[]; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; -layout (location = 2) out vec3 outViewVec; -layout (location = 3) out vec3 outLightVec; - -void main(void) -{ - for(int i = 0; i < gl_in.length(); i++) - { - outNormal = mat3(ubo.modelview[gl_InvocationID]) * inNormal[i]; - outColor = inColor[i]; - - vec4 pos = gl_in[i].gl_Position; - vec4 worldPos = (ubo.modelview[gl_InvocationID] * pos); - - vec3 lPos = vec3(ubo.modelview[gl_InvocationID] * ubo.lightPos); - outLightVec = lPos - worldPos.xyz; - outViewVec = -worldPos.xyz; - - gl_Position = ubo.projection[gl_InvocationID] * worldPos; - - // Set the viewport index that the vertex will be emitted to - gl_ViewportIndex = gl_InvocationID; - - EmitVertex(); - } - EndPrimitive(); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/viewportarray/scene.frag b/tests/glsl/sascha-willems/viewportarray/scene.frag deleted file mode 100644 index 1ecd7fdb3..000000000 --- a/tests/glsl/sascha-willems/viewportarray/scene.frag +++ /dev/null @@ -1,21 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) in vec3 inNormal; -layout (location = 1) in vec3 inColor; -layout (location = 2) in vec3 inViewVec; -layout (location = 3) in vec3 inLightVec; - -layout (location = 0) out vec4 outColor; - -void main() -{ - vec3 N = normalize(inNormal); - vec3 L = normalize(inLightVec); - vec3 V = normalize(inViewVec); - vec3 R = reflect(-L, N); - vec3 ambient = vec3(0.1); - vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0); - vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75); - outColor = vec4((ambient + diffuse) * inColor.rgb + specular, 1.0); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/viewportarray/scene.vert b/tests/glsl/sascha-willems/viewportarray/scene.vert deleted file mode 100644 index 28e1c3d8b..000000000 --- a/tests/glsl/sascha-willems/viewportarray/scene.vert +++ /dev/null @@ -1,21 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; - -layout (location = 0) out vec3 outNormal; -layout (location = 1) out vec3 outColor; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - outColor = inColor; - outNormal = inNormal; - gl_Position = vec4(inPos.xyz, 1.0); -} diff --git a/tests/glsl/sascha-willems/vulkanscene/logo.frag b/tests/glsl/sascha-willems/vulkanscene/logo.frag deleted file mode 100644 index aa42773b4..000000000 --- a/tests/glsl/sascha-willems/vulkanscene/logo.frag +++ /dev/null @@ -1,23 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inEyePos; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec4 diff = vec4(inColor, 1.0) * max(dot(inNormal, inLightVec), 0.0); - float shininess = 0.0; - vec4 spec = vec4(1.0, 1.0, 1.0, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 2.5) * shininess; - - outFragColor = diff + spec; - outFragColor.a = 1.0; -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/vulkanscene/logo.vert b/tests/glsl/sascha-willems/vulkanscene/logo.vert deleted file mode 100644 index 2887245a7..000000000 --- a/tests/glsl/sascha-willems/vulkanscene/logo.vert +++ /dev/null @@ -1,38 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inTexCoord; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 normal; - mat4 view; - vec3 lightpos; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec3 outColor; -layout (location = 3) out vec3 outEyePos; -layout (location = 4) out vec3 outLightVec; - -void main() -{ - mat4 modelView = ubo.view * ubo.model; - vec4 pos = modelView * inPos; - outUV = inTexCoord.st; - outNormal = normalize(mat3(ubo.normal) * inNormal); - outColor = inColor; - gl_Position = ubo.projection * pos; - outEyePos = vec3(modelView * pos); - vec4 lightPos = vec4(1.0, 2.0, 0.0, 1.0) * modelView; - outLightVec = normalize(lightPos.xyz - outEyePos); -} diff --git a/tests/glsl/sascha-willems/vulkanscene/mesh.frag b/tests/glsl/sascha-willems/vulkanscene/mesh.frag deleted file mode 100644 index 5afa294ed..000000000 --- a/tests/glsl/sascha-willems/vulkanscene/mesh.frag +++ /dev/null @@ -1,45 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -layout (binding = 1) uniform sampler2D tex; - -layout (location = 0) in vec2 inUV; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec3 inColor; -layout (location = 3) in vec3 inEyePos; -layout (location = 4) in vec3 inLightVec; - -layout (location = 0) out vec4 outFragColor; - -float specpart(vec3 L, vec3 N, vec3 H) -{ - if (dot(N, L) > 0.0) - { - return pow(clamp(dot(H, N), 0.0, 1.0), 64.0); - } - return 0.0; -} - -void main() -{ - vec3 Eye = normalize(-inEyePos); - vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); - - vec3 halfVec = normalize(inLightVec + inEyePos); - float diff = clamp(dot(inLightVec, inNormal), 0.0, 1.0); - float spec = specpart(inLightVec, inNormal, halfVec); - float intensity = 0.1 + diff + spec; - - vec4 IAmbient = vec4(0.2, 0.2, 0.2, 1.0); - vec4 IDiffuse = vec4(0.5, 0.5, 0.5, 0.5) * max(dot(inNormal, inLightVec), 0.0); - float shininess = 0.75; - vec4 ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 2.0) * shininess; - - outFragColor = vec4((IAmbient + IDiffuse) * vec4(inColor, 1.0) + ISpecular); - - // Some manual saturation - if (intensity > 0.95) - outFragColor *= 2.25; - if (intensity < 0.15) - outFragColor = vec4(0.1); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/vulkanscene/mesh.vert b/tests/glsl/sascha-willems/vulkanscene/mesh.vert deleted file mode 100644 index ca7e5b06d..000000000 --- a/tests/glsl/sascha-willems/vulkanscene/mesh.vert +++ /dev/null @@ -1,38 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec4 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inTexCoord; -layout (location = 3) in vec3 inColor; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 normal; - mat4 view; - vec3 lightpos; -} ubo; - -layout (location = 0) out vec2 outUV; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec3 outColor; -layout (location = 3) out vec3 outEyePos; -layout (location = 4) out vec3 outLightVec; - -void main() -{ - outUV = inTexCoord.st; - outNormal = normalize(mat3(ubo.normal) * inNormal); - outColor = inColor; - mat4 modelView = ubo.view * ubo.model; - vec4 pos = modelView * inPos; - gl_Position = ubo.projection * pos; - outEyePos = vec3(modelView * pos); - vec4 lightPos = vec4(ubo.lightpos, 1.0) * modelView; - outLightVec = normalize(lightPos.xyz - outEyePos); -} diff --git a/tests/glsl/sascha-willems/vulkanscene/skybox.frag b/tests/glsl/sascha-willems/vulkanscene/skybox.frag deleted file mode 100644 index 8cf1d0b8b..000000000 --- a/tests/glsl/sascha-willems/vulkanscene/skybox.frag +++ /dev/null @@ -1,16 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (binding = 1) uniform samplerCube samplerCubeMap; - -layout (location = 0) in vec3 inUVW; - -layout (location = 0) out vec4 outFragColor; - -void main() -{ - outFragColor = texture(samplerCubeMap, inUVW); -}
\ No newline at end of file diff --git a/tests/glsl/sascha-willems/vulkanscene/skybox.vert b/tests/glsl/sascha-willems/vulkanscene/skybox.vert deleted file mode 100644 index 81c2941dc..000000000 --- a/tests/glsl/sascha-willems/vulkanscene/skybox.vert +++ /dev/null @@ -1,21 +0,0 @@ -//TEST:COMPARE_GLSL: -#version 450 - -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable - -layout (location = 0) in vec3 inPos; - -layout (binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; -} ubo; - -layout (location = 0) out vec3 outUVW; - -void main() -{ - outUVW = inPos; - gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0); -} diff --git a/tests/reflection/sample-rate-input.glsl b/tests/reflection/sample-rate-input.glsl deleted file mode 100644 index b8151aee1..000000000 --- a/tests/reflection/sample-rate-input.glsl +++ /dev/null @@ -1,15 +0,0 @@ -//TEST(smoke):REFLECTION:-profile ps_4_0 -no-checking - -// Check that we report sample-rate entry point input correctly - -uniform texture2D t; -uniform sampler s; - -sample in vec2 uv; - -out vec4 c; - -void main() -{ - c = texture(sampler2D(t,s), uv); -} diff --git a/tests/reflection/sample-rate-input.glsl.expected b/tests/reflection/sample-rate-input.glsl.expected deleted file mode 100644 index 53e0b6e17..000000000 --- a/tests/reflection/sample-rate-input.glsl.expected +++ /dev/null @@ -1,57 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -{ - "parameters": [ - { - "name": "t", - "binding": {"kind": "descriptorTableSlot", "index": 0}, - "type": { - "kind": "resource", - "baseShape": "texture2D" - } - }, - { - "name": "s", - "binding": {"kind": "descriptorTableSlot", "index": 1}, - "type": { - "kind": "samplerState" - } - }, - { - "name": "uv", - "stage": "fragment", - "binding": {"kind": "varyingInput", "index": 0}, - "type": { - "kind": "vector", - "elementCount": 2, - "elementType": { - "kind": "scalar", - "scalarType": "float32" - } - } - }, - { - "name": "c", - "stage": "fragment", - "binding": {"kind": "varyingOutput", "index": 0}, - "type": { - "kind": "vector", - "elementCount": 4, - "elementType": { - "kind": "scalar", - "scalarType": "float32" - } - } - } - ], - "entryPoints": [ - { - "name": "main", - "stage:": "fragment", - "usesAnySampleRateInput": true - } - ] -} -} diff --git a/tests/reflection/thread-group-size.comp b/tests/reflection/thread-group-size.comp deleted file mode 100644 index ff29490a5..000000000 --- a/tests/reflection/thread-group-size.comp +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:REFLECTION:-no-checking -target glsl - -// Confirm that we provide reflection data for the `local_size_*` attributes - -layout(local_size_x = 3) in; - -layout(local_size_y = 5, local_size_z = 7) in; - -buffer B -{ - float b[]; -}; - -void main() -{ - uint tid = gl_GlobalInvocationID.x; - b[tid] = b[tid + 1] + 1.0f; -}
\ No newline at end of file diff --git a/tests/reflection/thread-group-size.comp.expected b/tests/reflection/thread-group-size.comp.expected deleted file mode 100644 index facd52cc0..000000000 --- a/tests/reflection/thread-group-size.comp.expected +++ /dev/null @@ -1,39 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -{ - "parameters": [ - { - "name": "B", - "binding": {"kind": "descriptorTableSlot", "index": 0}, - "type": { - "kind": "shaderStorageBuffer", - "elementType": { - "kind": "struct", - "fields": [ - { - "name": "b", - "type": { - "kind": "array", - "elementCount": 0, - "elementType": { - "kind": "scalar", - "scalarType": "float32" - } - } - } - ] - } - } - } - ], - "entryPoints": [ - { - "name": "main", - "stage:": "compute", - "threadGroupSize": [3, 5, 7] - } - ] -} -} diff --git a/tests/render/cross-compile0.hlsl b/tests/render/cross-compile0.hlsl index 861336b1c..889d3ec15 100644 --- a/tests/render/cross-compile0.hlsl +++ b/tests/render/cross-compile0.hlsl @@ -6,12 +6,11 @@ // but the two will share a dependency on a file of // pure Spire code that provides the actual shading logic. +#if defined(__HLSL__) // Pull in Spire code depdendency using extended syntax: __import cross_compile0; -#if defined(__HLSL__) - cbuffer Uniforms { float4x4 modelViewProjection; @@ -89,6 +88,24 @@ FragmentStageOutput fragmentMain(FragmentStageInput input) #version 420 +float saturate(float x) +{ + return clamp(x, float(0), float(1)); +} + +vec3 transformColor(vec3 color) +{ + vec3 result; + + result.x = sin(20.0 * (color.x + color.y)); + result.y = saturate(cos(color.z * 30.0)); + result.z = sin(color.x * color.y * color.z * 100.0); + + result = 0.5 * (result + 1); + + return result; +} + uniform Uniforms { mat4x4 modelViewProjection; diff --git a/tests/render/imported-parameters.hlsl b/tests/render/imported-parameters.hlsl index 99216728e..faffeaf24 100644 --- a/tests/render/imported-parameters.hlsl +++ b/tests/render/imported-parameters.hlsl @@ -4,11 +4,11 @@ // correctly handle cases where top-level shader // parameters are declared in an `import`ed file. +#if defined(__HLSL__) + // Pull in Spire code depdendency using extended syntax: __import imported_parameters; -#if defined(__HLSL__) - struct AssembledVertex { float3 position; @@ -81,6 +81,30 @@ FragmentStageOutput fragmentMain(FragmentStageInput input) #version 420 +layout(binding = 0) +uniform Uniforms +{ + mat4x4 modelViewProjection; +}; + +float saturate(float x) +{ + return clamp(x, float(0), float(1)); +} + +vec3 transformColor(vec3 color) +{ + vec3 result; + + result.x = sin(20.0 * (color.x + color.y)); + result.y = saturate(cos(color.z * 30.0)); + result.z = sin(color.x * color.y * color.z * 100.0); + + result = 0.5 * (result + 1); + + return result; +} + #define ASSEMBLED_VERTEX(QUAL) \ /* */ diff --git a/tests/render/unused-discard.hlsl b/tests/render/unused-discard.hlsl index dad2f78e3..a47405f56 100644 --- a/tests/render/unused-discard.hlsl +++ b/tests/render/unused-discard.hlsl @@ -7,11 +7,11 @@ // pure Spire code that provides the actual shading logic. +#if defined(__HLSL__) + // Pull in Spire code depdendency using extended syntax: __import unused_discard; -#if defined(__HLSL__) - cbuffer Uniforms { float4x4 modelViewProjection; @@ -91,6 +91,24 @@ FragmentStageOutput fragmentMain(FragmentStageInput input) #version 420 +float saturate(float x) +{ + return clamp(x, float(0), float(1)); +} + +vec3 transformColor(vec3 color) +{ + vec3 result; + + result.x = sin(20.0 * (color.x + color.y)); + result.y = saturate(cos(color.z * 30.0)); + result.z = sin(color.x * color.y * color.z * 100.0); + + result = 0.5 * (result + 1); + + return result; +} + uniform Uniforms { mat4x4 modelViewProjection; @@ -129,6 +147,12 @@ void main() #ifdef __GLSL_FRAGMENT__ +void doConditionalDiscard(vec3 color) +{ + if(color.x < 0.5) + discard; +} + V2F(in) layout(location = 0) diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp index a75e35bd4..2a6401d5b 100644 --- a/tools/render-test/slang-support.cpp +++ b/tools/render-test/slang-support.cpp @@ -34,13 +34,13 @@ struct SlangShaderCompilerWrapper : public ShaderCompiler } spAddPreprocessorDefine(slangRequest, langDefine, "1"); - // If we aren't dealing with true Slang input, then don't enable checking. - // - // Note: do this before using command-line arguments to set flags, so - // that we don't accidentally clobber other flags. - if (sourceLanguage != SLANG_SOURCE_LANGUAGE_SLANG) + // If we are dealing with GLSL input, then we need to set up + // Slang to pass through to glslang instead of actually running + // the compiler (this is a workaround to make direct comparisons + // possible) + if (sourceLanguage == SLANG_SOURCE_LANGUAGE_GLSL) { - spSetCompileFlags(slangRequest, SLANG_COMPILE_FLAG_NO_CHECKING); + spSetPassThrough(slangRequest, SLANG_PASS_THROUGH_GLSLANG); } // Preocess any additional command-line options specified for Slang using diff --git a/tools/slang-test/main.cpp b/tools/slang-test/main.cpp index 267f62bfe..4edd8272d 100644 --- a/tools/slang-test/main.cpp +++ b/tools/slang-test/main.cpp @@ -30,6 +30,10 @@ enum OutputMode // need to output test results in a way that the AppVeyor // environment can pick up and display. kOutputMode_AppVeyor, + + // We currently don't specialize for Travis, but maybe + // we should. + kOutputMode_Travis, }; struct TestCategory; @@ -153,6 +157,7 @@ void parseOptions(int* argc, char** argv) } else if( strcmp(arg, "-travis") == 0 ) { + options.outputMode = kOutputMode_Travis; options.dumpOutputOnFailure = true; } else if( strcmp(arg, "-category") == 0 ) @@ -839,13 +844,14 @@ TestResult runCrossCompilerTest(TestInput& input) actualSpawner.pushArgument(filePath); expectedSpawner.pushArgument(filePath + ".glsl"); + expectedSpawner.pushArgument("-pass-through"); + expectedSpawner.pushArgument("glslang"); for( auto arg : input.testOptions->args ) { actualSpawner.pushArgument(arg); expectedSpawner.pushArgument(arg); } - expectedSpawner.pushArgument("-no-checking"); if (spawnAndWait(outputStem, expectedSpawner) != kOSError_None) { @@ -1052,8 +1058,6 @@ TestResult doGLSLComparisonTestRun( spawner.pushArgument(passThrough); } - spawner.pushArgument("-no-checking"); - spawner.pushArgument("-target"); spawner.pushArgument("spirv-assembly"); @@ -1476,6 +1480,8 @@ void handleTestResult( String const& testName, TestResult testResult) { + context->totalTestCount++; + switch( testResult ) { case kTestResult_Fail: @@ -1499,7 +1505,7 @@ void handleTestResult( // printf("OUTPUT_MODE: %d\n", options.outputMode); switch( options.outputMode ) { - case kOutputMode_Default: + default : { char const* resultString = "UNEXPECTED"; switch( testResult ) @@ -1511,7 +1517,6 @@ void handleTestResult( assert(!"unexpected"); break; } - printf("%s test: '%S'\n", resultString, testName.ToWString().begin()); } break; @@ -1557,10 +1562,6 @@ void handleTestResult( } } break; - - default: - assert(!"unexpected"); - break; } } @@ -1645,9 +1646,6 @@ void runTestsOnFile( continue; } - context->totalTestCount++; - - String outputStem = filePath; if(subTestIndex != 0) { |
