Răsfoiți Sursa

Merge branch 'master' of github.com:HaxeFoundation/hl

Nicolas Cannasse 7 ani în urmă
părinte
comite
dbe277795b
5 a modificat fișierele cu 25 adăugiri și 6 ștergeri
  1. 1 1
      libs/directx/directx.cpp
  2. 8 2
      libs/mesa/haxe/System.hx
  3. 11 0
      src/alloc.c
  4. 1 1
      src/hl.h
  5. 4 2
      src/module.c

+ 1 - 1
libs/directx/directx.cpp

@@ -152,7 +152,7 @@ HL_PRIM void HL_NAME(clear_color)( dx_pointer *rt, double r, double g, double b,
 
 HL_PRIM void HL_NAME(present)( int interval, int flags ) {
 	HRESULT ret = driver->swapchain->Present(interval, flags);
-	if (ret != S_OK) ReportDxError(ret, __LINE__);
+	if (ret != S_OK && ret != DXGI_STATUS_OCCLUDED) ReportDxError(ret, __LINE__);
 }
 
 HL_PRIM const uchar *HL_NAME(get_device_name)() {

+ 8 - 2
libs/mesa/haxe/System.hx

@@ -36,10 +36,16 @@ class System {
 			throw "Failed to init GL API";
 		return true;
 	}
-	
+
+	public static dynamic function reportError(e:Dynamic) {
+		var stack = haxe.CallStack.toString(haxe.CallStack.exceptionStack());
+		var err = try Std.string(e) catch( _ : Dynamic ) "????";
+		Sys.println(err + stack);
+	}
+
 	@:extern public static inline function beginFrame() {
 	}
-	
+
 	public static function emitEvents(_) {
 		return true;
 	}

+ 11 - 0
src/alloc.c

@@ -69,7 +69,18 @@ static inline unsigned int TRAILING_ZEROES( unsigned int x ) {
 // we should instead have some special handling for them
 // in x86-64 user space grows up to 0x8000-00000000 (16 bits base + 31 bits page id)
 
+#ifdef HL_WIN
 #	define gc_hash(ptr)			((int_val)(ptr)&0x0000000FFFFFFFFF)
+#else
+// Linux gives addresses using the following patterns (X=any,Y=small value - can be 0): 
+//		0x0000000YXXX0000
+//		0x0007FY0YXXX0000
+static int_val gc_hash( void *ptr ) {
+	int_val v = (int_val)ptr;
+	return (v ^ ((v >> 33) << 28)) & 0x0000000FFFFFFFFF;
+}
+#endif
+
 #endif
 
 #define GC_MASK_BITS		16

+ 1 - 1
src/hl.h

@@ -243,7 +243,7 @@ C_FUNCTION_END
 
 #if defined(HL_VCC)
 #	define hl_debug_break()	if( IsDebuggerPresent() ) __debugbreak()
-#elif defined(HL_PS)
+#elif defined(HL_PS) && defined(_DEBUG)
 #	define hl_debug_break()	__debugbreak()
 #elif defined(HL_NX)
 C_FUNCTION_BEGIN

+ 4 - 2
src/module.c

@@ -220,6 +220,8 @@ static void append_type( char **p, hl_type *t ) {
 	}
 }
 
+#define DISABLED_LIB_PTR ((void*)(int_val)2)
+
 static void *resolve_library( const char *lib ) {
 	char tmp[256];	
 	void *h;
@@ -234,7 +236,7 @@ static void *resolve_library( const char *lib ) {
 	if( disPart ) {
 		disPart += strlen(lib);
 		if( *disPart == 0 || *disPart == ',' )
-			return NULL;
+			return DISABLED_LIB_PTR;
 	}
 #	endif
 
@@ -298,7 +300,7 @@ int hl_module_init( hl_module *m, void *stack_top_val ) {
 				curlib = n->lib;
 				libHandler = resolve_library(n->lib);
 			}
-			if( libHandler == NULL ) {
+			if( libHandler == DISABLED_LIB_PTR ) {
 				m->functions_ptrs[n->findex] = disabled_primitive;
 				continue;
 			}