فهرست منبع

Added IOS/OSX defines to shaderc.

bkaradzic 13 سال پیش
والد
کامیت
2a918ab4e0
2فایلهای تغییر یافته به همراه30 افزوده شده و 3 حذف شده
  1. 13 0
      src/renderer_gl.h
  2. 17 3
      tools/shaderc.cpp

+ 13 - 0
src/renderer_gl.h

@@ -16,6 +16,19 @@
 #		include <GL/gl.h>
 #		include <GL/glx.h>
 #		undef GL_PROTOTYPES
+#	elif BX_PLATFORM_OSX
+#		define GL_PROTOTYPES
+#		define GL_GLEXT_LEGACY
+#		define GL_VERSION_1_2
+#		define GL_VERSION_1_3
+#		define GL_VERSION_1_5
+#		define GL_VERSION_2_0
+#		include <OpenGL/gl.h>
+#		undef GL_VERSION_2_0
+#		undef GL_VERSION_1_5
+#		undef GL_VERSION_1_3
+#		undef GL_VERSION_1_2
+#		undef GL_PROTOTYPES
 #	else
 #		include <GL/gl.h>
 #	endif // BX_PLATFORM_

+ 17 - 3
tools/shaderc.cpp

@@ -678,10 +678,12 @@ int main(int _argc, const char* _argv[])
 	Preprocessor preprocessor(filePath);
 
 	preprocessor.setDefaultDefine("BX_PLATFORM_ANDROID");
+	preprocessor.setDefaultDefine("BX_PLATFORM_IOS");
+	preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
 	preprocessor.setDefaultDefine("BX_PLATFORM_NACL");
+	preprocessor.setDefaultDefine("BX_PLATFORM_OSX");
 	preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS");
 	preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360");
-	preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
 	preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL");
 	preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL");
 	preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT");
@@ -695,15 +697,27 @@ int main(int _argc, const char* _argv[])
 		preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
 		glsl = true;
 	}
+	else if (0 == _stricmp(platform, "ios") )
+	{
+		preprocessor.setDefine("BX_PLATFORM_IOS=1");
+		preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
+		glsl = true;
+	}
+	else if (0 == _stricmp(platform, "linux") )
+	{
+		preprocessor.setDefine("BX_PLATFORM_IOS=1");
+		preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
+		glsl = true;
+	}
 	else if (0 == _stricmp(platform, "nacl") )
 	{
 		preprocessor.setDefine("BX_PLATFORM_NACL=1");
 		preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
 		glsl = true;
 	}
-	else if (0 == _stricmp(platform, "linux"))
+	else if (0 == _stricmp(platform, "osx") )
 	{
-		preprocessor.setDefine("BX_PLATFORM_LINUX=1");
+		preprocessor.setDefine("BX_PLATFORM_OSX=1");
 		preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
 		glsl = true;
 	}