Browse Source

shaderc: GLSL autodetect use of profile 130.

Branimir Karadžić 10 years ago
parent
commit
86839f6e2e
1 changed files with 16 additions and 1 deletions
  1. 16 1
      tools/shaderc/shaderc.cpp

+ 16 - 1
tools/shaderc/shaderc.cpp

@@ -67,6 +67,17 @@ static const char* s_OES_texture_3D[] =
 	NULL
 };
 
+static const char* s_130[] =
+{
+	"uint",
+	"uint2",
+	"uint3",
+	"uint4",
+	"isampler3D",
+	"usampler3D",
+	NULL
+};
+
 const char* s_uniformTypeName[UniformType::Count] =
 {
 	"int",
@@ -1666,13 +1677,17 @@ int main(int _argc, const char* _argv[])
 
 							if (0 == essl)
 							{
+								const bool need130 = 120 == glsl
+									&& bx::findIdentifierMatch(input, s_130)
+									;
+
 								if (0 != metal)
 								{
 									bx::stringPrintf(code, "#version 120\n");
 								}
 								else
 								{
-									bx::stringPrintf(code, "#version %s\n", profile);
+									bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile);
 								}
 
 								bx::stringPrintf(code