diff options
| author | Yong He <yonghe@outlook.com> | 2018-01-18 12:49:59 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-18 12:49:59 -0800 |
| commit | 2079b941bc5849b6ab33774fb90cefe9c2d624cb (patch) | |
| tree | 6bba14a93d90a251c4e2f75381ddf71ea9a3bbca /source/slang/emit.cpp | |
| parent | 68f529af8d0eb8ec45a2d73e82c4ee372015ce01 (diff) | |
| parent | 9eb8b4e187e8b4fc5394668d476ada0512ae4ccc (diff) | |
Merge pull request #371 from csyonghe/master
All compiler fixes to get ir branch work with falcor feature demo.
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 33328fbb1..53f02cc56 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2315,7 +2315,7 @@ struct EmitVisitor CASE(kIRPseudoOp_Pos, +); CASE(kIROp_Neg, -); CASE(kIROp_Not, !); - CASE(kIRPseudoOp_BitNot, ~); + CASE(kIROp_BitNot, ~); #undef CASE #define CASE(NAME, OP) case kIRPseudoOp_##NAME: EmitUnaryAssignExpr(outerPrec, kEOp_Prefix, #OP, "", callExpr); return @@ -2554,6 +2554,11 @@ struct EmitVisitor emitName(expr->lookupResult2.getName()); } + void visitOverloadedExpr2(OverloadedExpr2* expr, ExprEmitArg const& arg) + { + ExprVisitorWithArg<Slang::EmitVisitor, Slang::ExprEmitArg>::dispatch(expr->candidiateExprs[0].Ptr(), arg); + } + void setSampleRateFlag() { context->shared->entryPointLayout->flags |= EntryPointLayout::Flag::usesAnySampleRateInput; @@ -4928,6 +4933,10 @@ emitDeclImpl(decl, nullptr); // types. return true; } + else if (type->As<HLSLStreamOutputType>()) + { + return true; + } else if(type->As<TextureTypeBase>()) { // GLSL doesn't allow texture/resource types to @@ -5512,7 +5521,12 @@ emitDeclImpl(decl, nullptr); emitIROperand(ctx, inst->getArg(0)); } break; - + case kIROp_BitNot: + { + emit("~"); + emitIROperand(ctx, inst->getArg(0)); + } + break; case kIROp_Sample: emitIROperand(ctx, inst->getArg(0)); emit(".Sample("); @@ -6266,7 +6280,22 @@ emitDeclImpl(decl, nullptr); emit(")]\n"); } break; - + case Stage::Geometry: + { + if (auto attrib = entryPointLayout->entryPoint->FindModifier<HLSLMaxVertexCountAttribute>()) + { + emit("[maxvertexcount("); + Emit(attrib->value); + emit(")]\n"); + } + if (auto attrib = entryPointLayout->entryPoint->FindModifier<HLSLInstanceAttribute>()) + { + emit("[instance("); + Emit(attrib->value); + emit(")]\n"); + } + } + break; // TODO: There are other stages that will need this kind of handling. default: break; @@ -6286,6 +6315,23 @@ emitDeclImpl(decl, nullptr); auto paramName = getIRName(pp); auto paramType = pp->getType(); + if (auto decor = pp->findDecoration<IRHighLevelDeclDecoration>()) + { + if (decor->decl) + { + auto primType = decor->decl->FindModifier<HLSLGeometryShaderInputPrimitiveTypeModifier>(); + if (dynamic_cast<HLSLTriangleModifier*>(primType)) + emit("triangle "); + else if (dynamic_cast<HLSLPointModifier*>(primType)) + emit("point "); + else if (dynamic_cast<HLSLLineModifier*>(primType)) + emit("line "); + else if (dynamic_cast<HLSLLineAdjModifier*>(primType)) + emit("lineadj "); + else if (dynamic_cast<HLSLTriangleAdjModifier*>(primType)) + emit("triangleadj "); + } + } emitIRParamType(ctx, paramType, paramName); emitIRSemantics(ctx, pp); |
