Procházet zdrojové kódy

shaderc: Pass interpolator qualifiers into all stages.

Бранимир Караџић před 3 týdny
rodič
revize
39dc313347

+ 11 - 14
tools/shaderc/shaderc.cpp

@@ -367,6 +367,7 @@ namespace bgfx
 
 
 		va_end(argList);
 		va_end(argList);
 	}
 	}
+
 	Options::Options()
 	Options::Options()
 		: shaderType(' ')
 		: shaderType(' ')
 		, disasm(false)
 		, disasm(false)
@@ -1220,6 +1221,7 @@ namespace bgfx
 		else if (0 == bx::strCmpI(platform, "linux") )
 		else if (0 == bx::strCmpI(platform, "linux") )
 		{
 		{
 			preprocessor.setDefine("BX_PLATFORM_LINUX=1");
 			preprocessor.setDefine("BX_PLATFORM_LINUX=1");
+
 			if (profile->lang == ShadingLang::SpirV)
 			if (profile->lang == ShadingLang::SpirV)
 			{
 			{
 				preprocessor.setDefine("BGFX_SHADER_LANGUAGE_SPIRV=1");
 				preprocessor.setDefine("BGFX_SHADER_LANGUAGE_SPIRV=1");
@@ -1229,17 +1231,17 @@ namespace bgfx
 				preprocessor.setDefine(glslDefine);
 				preprocessor.setDefine(glslDefine);
 			}
 			}
 		}
 		}
-		else if (
-			0 == bx::strCmpI(platform, "ios") ||
-			0 == bx::strCmpI(platform, "osx") ||
-			0 == bx::strCmpI(platform, "visionos")
-		)
+		else if (0 == bx::strCmpI(platform, "ios")
+			 ||  0 == bx::strCmpI(platform, "osx")
+			 ||  0 == bx::strCmpI(platform, "visionos")
+			    )
 		{
 		{
 			if (0 == bx::strCmpI(platform, "osx"))
 			if (0 == bx::strCmpI(platform, "osx"))
 			{
 			{
 				preprocessor.setDefine("BX_PLATFORM_OSX=1");
 				preprocessor.setDefine("BX_PLATFORM_OSX=1");
 			}
 			}
-			else if (0 == bx::strCmpI(platform, "visionos")) {
+			else if (0 == bx::strCmpI(platform, "visionos"))
+			{
 				preprocessor.setDefine("BX_PLATFORM_VISIONOS=1");
 				preprocessor.setDefine("BX_PLATFORM_VISIONOS=1");
 			}
 			}
 			else
 			else
@@ -1257,7 +1259,7 @@ namespace bgfx
 				, sizeof(temp)
 				, sizeof(temp)
 				, "BGFX_SHADER_LANGUAGE_METAL=%d"
 				, "BGFX_SHADER_LANGUAGE_METAL=%d"
 				, (profile->lang == ShadingLang::Metal) ? profile->id : 0
 				, (profile->lang == ShadingLang::Metal) ? profile->id : 0
-			);
+				);
 			preprocessor.setDefine(temp);
 			preprocessor.setDefine(temp);
 		}
 		}
 		else if (0 == bx::strCmpI(platform, "windows") )
 		else if (0 == bx::strCmpI(platform, "windows") )
@@ -1359,13 +1361,8 @@ namespace bgfx
 				||  0 == bx::strCmp(typen, "noperspective", 13)
 				||  0 == bx::strCmp(typen, "noperspective", 13)
 				||  0 == bx::strCmp(typen, "centroid", 8) )
 				||  0 == bx::strCmp(typen, "centroid", 8) )
 				{
 				{
-					if ('f' == _options.shaderType
-					||   profile->lang == ShadingLang::GLSL
-					||   profile->lang == ShadingLang::ESSL)
-					{
-						interpolation = typen;
-						usesInterpolationQualifiers = true;
-					}
+					interpolation = typen;
+					usesInterpolationQualifiers = true;
 
 
 					typen = nextWord(parse);
 					typen = nextWord(parse);
 				}
 				}

+ 1 - 1
tools/shaderc/shaderc_metal.cpp

@@ -603,8 +603,8 @@ namespace bgfx { namespace metal
 				};
 				};
 
 
 				opt.SetMessageConsumer(print_msg_to_stderr);
 				opt.SetMessageConsumer(print_msg_to_stderr);
-
 				opt.RegisterLegalizationPasses();
 				opt.RegisterLegalizationPasses();
+				opt.RegisterPerformancePasses();
 
 
 				spvtools::ValidatorOptions validatorOptions;
 				spvtools::ValidatorOptions validatorOptions;
 				validatorOptions.SetBeforeHlslLegalization(true);
 				validatorOptions.SetBeforeHlslLegalization(true);

+ 1 - 1
tools/shaderc/shaderc_spirv.cpp

@@ -732,8 +732,8 @@ namespace bgfx { namespace spirv
 				};
 				};
 
 
 				opt.SetMessageConsumer(print_msg_to_stderr);
 				opt.SetMessageConsumer(print_msg_to_stderr);
-
 				opt.RegisterLegalizationPasses();
 				opt.RegisterLegalizationPasses();
+				opt.RegisterPerformancePasses();
 
 
 				spvtools::ValidatorOptions validatorOptions;
 				spvtools::ValidatorOptions validatorOptions;
 				validatorOptions.SetBeforeHlslLegalization(true);
 				validatorOptions.SetBeforeHlslLegalization(true);