diff options
| author | Yong He <yonghe@outlook.com> | 2019-01-28 10:47:48 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-28 10:47:48 -0800 |
| commit | 016f38981a52dd31aa4d3d35272c37f992a07862 (patch) | |
| tree | d11ff742f08a25469fa1a86c8b4d0061853fb63d /source/slang/emit.cpp | |
| parent | df9dc5710725d00630831b77ca7005e390383aa6 (diff) | |
| parent | 962f265df9e1b8549202a9b9543e1bead190638d (diff) | |
Merge pull request #805 from csyonghe/yong-fix
More fixes to empty-struct parameters
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 71b961616..dd6feb50d 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -3585,6 +3585,9 @@ struct EmitVisitor UInt argCount = inst->getOperandCount(); for( UInt aa = 1; aa < argCount; ++aa ) { + auto operand = inst->getOperand(aa); + if (as<IRVoidType>(operand->getDataType())) + continue; if(aa != 1) emit(", "); emitIROperand(ctx, inst->getOperand(aa), mode, kEOp_General); } @@ -6100,6 +6103,8 @@ struct EmitVisitor { varType = outType->getValueType(); } + if (as<IRVoidType>(varType)) + return; // When a global shader parameter represents a "parameter group" // (either a constant buffer or a parameter block with non-resource @@ -6653,36 +6658,6 @@ String emitEntryPoint( // un-specialized IR. dumpIRIfEnabled(compileRequest, irModule); - - - // For GLSL only, we will need to perform "legalization" of - // the entry point and any entry-point parameters. - // - // TODO: We should consider moving this legalization work - // as late as possible, so that it doesn't affect how other - // optimization passes need to work. - // - switch (target) - { - case CodeGenTarget::GLSL: - { - legalizeEntryPointForGLSL( - session, - irModule, - irEntryPoint, - &compileRequest->mSink, - &sharedContext.extensionUsageTracker); - } - break; - - default: - break; - } -#if 0 - dumpIRIfEnabled(compileRequest, irModule, "GLSL LEGALIZED"); -#endif - validateIRModuleIfEnabled(compileRequest, irModule); - // Desguar any union types, since these will be illegal on // various targets. // @@ -6778,6 +6753,34 @@ String emitEntryPoint( #endif validateIRModuleIfEnabled(compileRequest, irModule); + // For GLSL only, we will need to perform "legalization" of + // the entry point and any entry-point parameters. + // + // TODO: We should consider moving this legalization work + // as late as possible, so that it doesn't affect how other + // optimization passes need to work. + // + switch (target) + { + case CodeGenTarget::GLSL: + { + legalizeEntryPointForGLSL( + session, + irModule, + irEntryPoint, + &compileRequest->mSink, + &sharedContext.extensionUsageTracker); + } + break; + + default: + break; + } +#if 0 + dumpIRIfEnabled(compileRequest, irModule, "GLSL LEGALIZED"); +#endif + validateIRModuleIfEnabled(compileRequest, irModule); + // The resource-based specialization pass above // may create specialized versions of functions, but // it does not try to completely eliminate the original |
