Branimir Karadžić 11 سال پیش
والد
کامیت
29b7249fc1

+ 7 - 7
3rdparty/glsl-optimizer/include/c99_compat.h

@@ -134,7 +134,13 @@
  * C99 __func__ macro
  * C99 __func__ macro
  */
  */
 #ifndef __func__
 #ifndef __func__
-#  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#  if defined(_MSC_VER)
+#    if _MSC_VER >= 1300
+#      define __func__ __FUNCTION__
+#    else
+#      define __func__ "<unknown>"
+#    endif
+#  elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
      /* C99 */
      /* C99 */
 #  elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
 #  elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
      /* C99 */
      /* C99 */
@@ -144,12 +150,6 @@
 #    else
 #    else
 #      define __func__ "<unknown>"
 #      define __func__ "<unknown>"
 #    endif
 #    endif
-#  elif defined(_MSC_VER)
-#    if _MSC_VER >= 1300
-#      define __func__ __FUNCTION__
-#    else
-#      define __func__ "<unknown>"
-#    endif
 #  else
 #  else
 #    define __func__ "<unknown>"
 #    define __func__ "<unknown>"
 #  endif
 #  endif

+ 1 - 0
3rdparty/glsl-optimizer/src/glsl/builtin_functions.cpp

@@ -53,6 +53,7 @@
  *    name and parameters.
  *    name and parameters.
  */
  */
 
 
+#define _USE_MATH_DEFINES
 #include <stdarg.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdio.h>
 #include "main/core.h" /* for struct gl_shader */
 #include "main/core.h" /* for struct gl_shader */

+ 1 - 1
3rdparty/glsl-optimizer/src/glsl/glsl_types.cpp

@@ -642,7 +642,7 @@ glsl_type::field_type(const char *name) const
    return error_type;
    return error_type;
 }
 }
 
 
-const glsl_precision
+glsl_precision
 glsl_type::field_precision(const char *name) const
 glsl_type::field_precision(const char *name) const
 {
 {
    if (this->base_type != GLSL_TYPE_STRUCT)
    if (this->base_type != GLSL_TYPE_STRUCT)

+ 1 - 1
3rdparty/glsl-optimizer/src/glsl/glsl_types.h

@@ -578,7 +578,7 @@ struct glsl_type {
     */
     */
    const glsl_type *field_type(const char *name) const;
    const glsl_type *field_type(const char *name) const;
 
 
-   const glsl_precision field_precision(const char *name) const;
+   glsl_precision field_precision(const char *name) const;
 
 
 
 
    /**
    /**

+ 1 - 1
3rdparty/glsl-optimizer/src/glsl/linker.cpp

@@ -2531,7 +2531,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       }
       }
 
 
       prog->ARB_fragment_coord_conventions_enable |=
       prog->ARB_fragment_coord_conventions_enable |=
-         prog->Shaders[i]->ARB_fragment_coord_conventions_enable;
+         GLboolean(prog->Shaders[i]->ARB_fragment_coord_conventions_enable);
 
 
       gl_shader_stage shader_type = prog->Shaders[i]->Stage;
       gl_shader_stage shader_type = prog->Shaders[i]->Stage;
       shader_list[shader_type][num_shaders[shader_type]] = prog->Shaders[i];
       shader_list[shader_type][num_shaders[shader_type]] = prog->Shaders[i];

+ 2 - 2
3rdparty/glsl-optimizer/src/glsl/opt_algebraic.cpp

@@ -129,7 +129,7 @@ is_less_than_one(ir_constant *ir)
       return false;
       return false;
 
 
    unsigned component = 0;
    unsigned component = 0;
-   for (int c = 0; c < ir->type->vector_elements; c++) {
+   for (unsigned c = 0; c < ir->type->vector_elements; c++) {
       if (ir->get_float_component(c) < 1.0f)
       if (ir->get_float_component(c) < 1.0f)
          component++;
          component++;
    }
    }
@@ -144,7 +144,7 @@ is_greater_than_zero(ir_constant *ir)
       return false;
       return false;
 
 
    unsigned component = 0;
    unsigned component = 0;
-   for (int c = 0; c < ir->type->vector_elements; c++) {
+   for (unsigned c = 0; c < ir->type->vector_elements; c++) {
       if (ir->get_float_component(c) > 0.0f)
       if (ir->get_float_component(c) > 0.0f)
          component++;
          component++;
    }
    }

+ 1 - 1
3rdparty/glsl-optimizer/src/mesa/main/errors.h

@@ -35,7 +35,7 @@
 #ifndef ERRORS_H
 #ifndef ERRORS_H
 #define ERRORS_H
 #define ERRORS_H
 
 
-
+#include "c99_compat.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 13 - 13
makefile

@@ -21,7 +21,7 @@ all:
 	$(GENIE) --with-tools --with-shared-lib vs2010
 	$(GENIE) --with-tools --with-shared-lib vs2010
 	$(GENIE) --with-tools --with-shared-lib vs2012
 	$(GENIE) --with-tools --with-shared-lib vs2012
 	$(GENIE) --with-tools --with-shared-lib vs2013
 	$(GENIE) --with-tools --with-shared-lib vs2013
-	$(GENIE) --with-tools --with-shared-lib --gcc=mingw gmake
+	$(GENIE) --with-tools --with-shared-lib --gcc=mingw-gcc gmake
 	$(GENIE) --with-tools --with-shared-lib --gcc=linux-gcc gmake
 	$(GENIE) --with-tools --with-shared-lib --gcc=linux-gcc gmake
 	$(GENIE) --with-tools --with-shared-lib --gcc=osx gmake
 	$(GENIE) --with-tools --with-shared-lib --gcc=osx gmake
 	$(GENIE) --with-tools --with-shared-lib xcode4
 	$(GENIE) --with-tools --with-shared-lib xcode4
@@ -81,16 +81,16 @@ linux-release64: .build/projects/gmake-linux
 	make -R -C .build/projects/gmake-linux config=release64
 	make -R -C .build/projects/gmake-linux config=release64
 linux: linux-debug32 linux-release32 linux-debug64 linux-release64
 linux: linux-debug32 linux-release32 linux-debug64 linux-release64
 
 
-.build/projects/gmake-mingw:
-	$(GENIE) --with-tools --with-shared-lib --gcc=mingw gmake
-mingw-debug32: .build/projects/gmake-mingw
-	make -R -C .build/projects/gmake-mingw config=debug32
-mingw-release32: .build/projects/gmake-mingw
-	make -R -C .build/projects/gmake-mingw config=release32
-mingw-debug64: .build/projects/gmake-mingw
-	make -R -C .build/projects/gmake-mingw config=debug64
-mingw-release64: .build/projects/gmake-mingw
-	make -R -C .build/projects/gmake-mingw config=release64
+.build/projects/gmake-mingw-gcc:
+	$(GENIE) --with-tools --with-shared-lib --gcc=mingw-gcc gmake
+mingw-debug32: .build/projects/gmake-mingw-gcc
+	make -R -C .build/projects/gmake-mingw-gcc config=debug32
+mingw-release32: .build/projects/gmake-mingw-gcc
+	make -R -C .build/projects/gmake-mingw-gcc config=release32
+mingw-debug64: .build/projects/gmake-mingw-gcc
+	make -R -C .build/projects/gmake-mingw-gcc config=debug64
+mingw-release64: .build/projects/gmake-mingw-gcc
+	make -R -C .build/projects/gmake-mingw-gcc config=release64
 mingw: mingw-debug32 mingw-release32 mingw-debug64 mingw-release64
 mingw: mingw-debug32 mingw-release32 mingw-debug64 mingw-release64
 
 
 .build/projects/vs2008:
 .build/projects/vs2008:
@@ -214,8 +214,8 @@ EXE=
 endif
 endif
 else
 else
 OS=windows
 OS=windows
-BUILD_PROJECT_DIR=gmake-mingw
-BUILD_OUTPUT_DIR=win32_mingw
+BUILD_PROJECT_DIR=gmake-mingw-gcc
+BUILD_OUTPUT_DIR=win32_mingw-gcc
 BUILD_TOOLS_CONFIG=release32
 BUILD_TOOLS_CONFIG=release32
 EXE=.exe
 EXE=.exe
 endif
 endif

+ 1 - 1
scripts/bgfx.lua

@@ -56,7 +56,7 @@ function bgfxProject(_name, _kind, _defines)
 				BGFX_DIR .. "3rdparty/khronos",
 				BGFX_DIR .. "3rdparty/khronos",
 			}
 			}
 
 
-		configuration { "x64", "vs* or mingw" }
+		configuration { "x64", "vs* or mingw*" }
 			defines {
 			defines {
 				"_WIN32_WINNT=0x601",
 				"_WIN32_WINNT=0x601",
 			}
 			}

+ 6 - 1
scripts/genie.lua

@@ -111,12 +111,17 @@ function exampleProject(_name)
 			"/DELAYLOAD:\"libGLESv2.dll\"",
 			"/DELAYLOAD:\"libGLESv2.dll\"",
 		}
 		}
 
 
-	configuration { "windows" }
+	configuration { "vs20* or mingw*" }
 		links {
 		links {
 			"gdi32",
 			"gdi32",
 			"psapi",
 			"psapi",
 		}
 		}
 
 
+	configuration { "mingw*" }
+		links {
+			"dxguid",
+		}
+
 	configuration { "mingw-clang" }
 	configuration { "mingw-clang" }
 		kind "ConsoleApp"
 		kind "ConsoleApp"
 
 

+ 1 - 1
scripts/shaderc.lua

@@ -31,7 +31,7 @@ project "shaderc"
 			"/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
 			"/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
 		}
 		}
 
 
-	configuration { "mingw or linux or osx" }
+	configuration { "mingw* or linux or osx" }
 		buildoptions {
 		buildoptions {
 			"-fno-strict-aliasing" -- glsl-optimizer has bugs if strict aliasing is used.
 			"-fno-strict-aliasing" -- glsl-optimizer has bugs if strict aliasing is used.
 		}
 		}

+ 4 - 7
src/renderer_d3d11.cpp

@@ -332,10 +332,9 @@ namespace bgfx
 		ID3D11SamplerState* m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
 		ID3D11SamplerState* m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
 	};
 	};
 
 
-#if BX_COMPILER_CLANG
-#	pragma GCC diagnostic push
-#	pragma GCC diagnostic ignored "-Wunused-const-variable"
-#endif // BX_COMPILER_CLANG
+	BX_PRAGMA_DIAGNOSTIC_PUSH();
+	BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunused-const-variable");
+	BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration");
 
 
 	static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } };
 	static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } };
 
 
@@ -355,9 +354,7 @@ namespace bgfx
 		}
 		}
 	}
 	}
 
 
-#if BX_COMPILER_CLANG
-#	pragma GCC diagnostic pop
-#endif // BX_COMPILER_CLANG
+	BX_PRAGMA_DIAGNOSTIC_POP();
 
 
 	static BX_NO_INLINE bool getIntelExtensions(ID3D11Device* _device)
 	static BX_NO_INLINE bool getIntelExtensions(ID3D11Device* _device)
 	{
 	{

+ 6 - 9
src/renderer_d3d11.h

@@ -13,16 +13,13 @@
 #	define BGFX_CONFIG_DEBUG_PIX 0
 #	define BGFX_CONFIG_DEBUG_PIX 0
 #endif // !USE_D3D11_DYNAMIC_LIB
 #endif // !USE_D3D11_DYNAMIC_LIB
 
 
+BX_PRAGMA_DIAGNOSTIC_PUSH();
+BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunknown-pragmas" );
+BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wpragmas");
+BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4005) // warning C4005: '' : macro redefinition
 #define D3D11_NO_HELPERS
 #define D3D11_NO_HELPERS
-#if BX_COMPILER_MSVC
-#	pragma warning(push)
-//  winerror.h and dxgitypes.h both define DXGI_ERRORs.
-#	pragma warning(disable:4005) // warning C4005: '' : macro redefinition
-#	include <d3d11.h>
-#	pragma warning(pop)
-#else
-#	include <d3d11.h>
-#endif // BX_COMPILER_MSVC
+#include <d3d11.h>
+BX_PRAGMA_DIAGNOSTIC_POP()
 
 
 #include "renderer_d3d.h"
 #include "renderer_d3d.h"
 
 

+ 3 - 0
tools/shaderc/shaderc.cpp

@@ -72,8 +72,11 @@ extern "C"
 #if BX_PLATFORM_WINDOWS
 #if BX_PLATFORM_WINDOWS
 #	include <sal.h>
 #	include <sal.h>
 #	define __D3DX9MATH_INL__ // not used and MinGW complains about type-punning
 #	define __D3DX9MATH_INL__ // not used and MinGW complains about type-punning
+	BX_PRAGMA_DIAGNOSTIC_PUSH();
+	BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wundef");
 #	include <d3dx9.h>
 #	include <d3dx9.h>
 #	include <d3dcompiler.h>
 #	include <d3dcompiler.h>
+	BX_PRAGMA_DIAGNOSTIC_POP();
 #endif // BX_PLATFORM_WINDOWS
 #endif // BX_PLATFORM_WINDOWS
 
 
 long int fsize(FILE* _file)
 long int fsize(FILE* _file)