@@ -2816,18 +2816,6 @@ struct SPIRVEmitContext
2816
2816
case kIROp_EntryPointDecoration :
2817
2817
{
2818
2818
auto section = getSection (SpvLogicalSectionID::EntryPoints);
2819
-
2820
- // TODO: The `OpEntryPoint` is required to list an varying
2821
- // input or output parameters (by `<id>`) used by the entry point,
2822
- // although these are encoded as global variables in the IR.
2823
- //
2824
- // Currently we have a pass that moves entry-point varying
2825
- // parameters to global scope for the benefit of GLSL output,
2826
- // but we do not maintain a connection between those parameters
2827
- // and the original entry point. That pass should be updated
2828
- // to attach a decoration linking the original entry point
2829
- // to the new globals, which would be used in the SPIR-V emit case.
2830
-
2831
2819
auto entryPointDecor = cast<IREntryPointDecoration>(decoration);
2832
2820
auto entryPoint = as<IRFunc>(decoration->getParent ());
2833
2821
auto spvStage = mapStageToExecutionModel (entryPointDecor->getProfile ().getStage ());
@@ -2842,6 +2830,7 @@ struct SPIRVEmitContext
2842
2830
{
2843
2831
case kIROp_GlobalVar :
2844
2832
case kIROp_GlobalParam :
2833
+ case kIROp_SPIRVAsmOperandBuiltinVar :
2845
2834
{
2846
2835
SpvInst* spvGlobalInst;
2847
2836
if (m_mapIRInstToSpvInst.tryGetValue (globalInst, spvGlobalInst))
@@ -2861,13 +2850,6 @@ struct SPIRVEmitContext
2861
2850
break ;
2862
2851
}
2863
2852
}
2864
- // Add remaining builtin variables that does not have a corresponding IR global var/param.
2865
- // These variables could be added from SPIRV ASM blocks.
2866
- for (auto builtinVar : m_builtinGlobalVars)
2867
- {
2868
- if (paramsSet.add (builtinVar.second ))
2869
- params.add (builtinVar.second );
2870
- }
2871
2853
emitOpEntryPoint (
2872
2854
section,
2873
2855
decoration,
@@ -3283,6 +3265,7 @@ struct SPIRVEmitContext
3283
3265
}
3284
3266
3285
3267
Dictionary<SpvBuiltIn, SpvInst*> m_builtinGlobalVars;
3268
+
3286
3269
SpvInst* getBuiltinGlobalVar (IRType* type, SpvBuiltIn builtinVal)
3287
3270
{
3288
3271
SpvInst* result = nullptr ;
@@ -5273,9 +5256,19 @@ SlangResult emitSPIRVFromIR(
5273
5256
}
5274
5257
5275
5258
// Emit source language info.
5259
+ // By default we will use SpvSourceLanguageSlang.
5260
+ // However this will cause problems when using swiftshader.
5261
+ // To workaround this problem, we allow overriding this behavior with an
5262
+ // environment variable that will be set in the software testing environment.
5263
+ auto sourceLanguage = SpvSourceLanguageSlang;
5264
+ StringBuilder noSlangEnv;
5265
+ PlatformUtil::getEnvironmentVariable (toSlice (" SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN" ), noSlangEnv);
5266
+ if (noSlangEnv.produceString () == " 1" )
5267
+ {
5268
+ sourceLanguage = SpvSourceLanguageUnknown;
5269
+ }
5276
5270
context.emitInst (context.getSection (SpvLogicalSectionID::DebugStringsAndSource), nullptr , SpvOpSource,
5277
- // TODO: update this to SpvSourceLanguageSlang when a new release of spirv-tools is available.
5278
- SpvLiteralInteger::from32 (0 ), // language identifier, should be SpvSourceLanguageSlang.
5271
+ SpvLiteralInteger::from32 (sourceLanguage), // language identifier, should be SpvSourceLanguageSlang.
5279
5272
SpvLiteralInteger::from32 (1 )); // language version.
5280
5273
5281
5274
for (auto irEntryPoint : irEntryPoints)
0 commit comments