ソースを参照

Fixes for macos.

Mark Sibly 8 年 前
コミット
cc403891a2

+ 4 - 4
modules/gles20/gles20.monkey2

@@ -82,9 +82,9 @@ typedef khronos_ssize_t  GLsizeiptr;
 
 'Not quite right, but less annoying...
 Alias GLvoid:Void
-Alias GLenum:Int
+Alias GLenum:UInt
 Alias GLboolean:Bool
-Alias GLbitfield:Int
+Alias GLbitfield:UInt
 Alias GLshort:Short
 Alias GLint:Int
 Alias GLsizei:Int
@@ -94,8 +94,8 @@ Alias GLuint:UInt
 Alias GLfloat:Float
 Alias GLfixed:Int
 Alias GLclampf:Float
-Alias GLintptr:Int
-Alias GLsizeiptr:Int
+Alias GLintptr:Long
+Alias GLsizeiptr:Long
 
 Extern
 

+ 21 - 4
modules/mojo/graphics/glexts/glexts.monkey2

@@ -38,9 +38,26 @@ Const GL_texture_float:Bool="bbGLexts::GL_texture_float"
 Const GL_texture_half_float:bool="bbGLexts::GL_texture_half_float"
 Const GL_depth_texture:bool="bbGLexts::GL_depth_texture"
 
-Function InitGLexts()="bbGLexts::init"
 Function glDrawBuffers( n:Int,bufs:GLenum Ptr )="bbGLexts::glDrawBuffers"
 
+Function InitGLexts()="bbGLexts::init"
+
+#Elseif __TARGET__="macos"
+
+Const GL_draw_buffers:Bool=True
+Const GL_texture_float:Bool=True
+Const GL_texture_half_float:bool=True
+Const GL_depth_texture:bool=True
+
+Extern
+
+Function glDrawBuffers( n:Int,bufs:GLenum Ptr )
+	
+Public
+
+Function InitGLexts()
+End
+
 #Else
 
 Const GL_draw_buffers:Bool=False
@@ -48,11 +65,11 @@ Const GL_texture_float:Bool=False
 Const GL_texture_half_float:bool=False
 Const GL_depth_texture:bool=False
 
-Function InitGLexts()
-End
-
 Function glDrawBuffers( n:Int,bufs:GLenum Ptr )
 	RuntimeError( "glDrawBuffers unsupported" )
 End
 
+Function InitGLexts()
+End
+
 #Endif

+ 10 - 3
modules/mojo/graphics/glutil.monkey2

@@ -97,8 +97,9 @@ End
 #rem monkeydoc @hidden
 #end
 Function glCompile:Int( type:Int,source:String )
-
-	source="
+	
+	#If __TARGET__="windows" Or __TARGET__="emscripten"
+	Const prefix:="
 	#extension GL_EXT_draw_buffers : require	
 	#ifdef GL_ES
 	#ifdef GL_FRAGMENT_PRECISION_HIGH
@@ -107,7 +108,13 @@ Function glCompile:Int( type:Int,source:String )
 	precision mediump float;
 	#endif
 	#endif
-	"+source
+	"
+	#Else
+	Const prefix:="
+	"
+	#Endif
+
+	source=prefix+source
 	
 	Local shader:=glCreateShader( type )
 	glShaderSourceEx( shader,source )

+ 19 - 3
modules/mojo/graphics/graphicsdevice.monkey2

@@ -425,12 +425,16 @@ Class GraphicsDevice
 	
 	Method Validate()
 
+		glCheck()
+				
 		If _glSeq<>glGraphicsSeq
 			_glSeq=glGraphicsSeq
 			_current=Null
 			InitGL()
 		Endif
 		
+		glCheck()
+				
 		If _current<>Self
 			If _current _current.FlushTarget()
 			_current=Self
@@ -440,19 +444,25 @@ Class GraphicsDevice
 			If Not _dirty Return
 		Endif
 		
+		glCheck()
+				
 		If _dirty & Dirty.RenderTarget
 			
 			If _rtarget
 				_rtarget.Bind()
 			Else
 				glBindFramebuffer( GL_FRAMEBUFFER,_defaultFbo )
-				Local bufs:GLenum=GL_BACK
-				glDrawBuffers( 1,Varptr bufs )
-'				glReadBuffer( GL_BACK )
+
+'				upsets macos...				
+'				Local bufs:GLenum=GL_BACK
+'				glDrawBuffers( 1,Varptr bufs )
+
 			Endif
 
 		Endif
 	
+		glCheck()
+				
 		If _dirty & Dirty.Viewport
 			
 			If _rtarget
@@ -463,6 +473,8 @@ Class GraphicsDevice
 			
 		Endif
 		
+		glCheck()
+				
 		If _dirty & Dirty.Scissor
 		
 			Local scissor:=_scissor & _viewport
@@ -479,6 +491,8 @@ Class GraphicsDevice
 		
 		Endif
 		
+		glCheck()
+				
 		If _dirty & Dirty.ColorMask
 			
 			Local r:=Bool( _colorMask & ColorMask.Red )
@@ -490,6 +504,8 @@ Class GraphicsDevice
 		
 		Endif
 		
+		glCheck()
+				
 		If _dirty & Dirty.DepthMask
 			
 			glDepthMask( _depthMask )