瀏覽代碼

Fixed UniformBlock.GetDataPtr so int uniforms work.

Mark Sibly 7 年之前
父節點
當前提交
e29c747e23
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      modules/mojo/graphics/uniformblock.monkey2

+ 6 - 4
modules/mojo/graphics/uniformblock.monkey2

@@ -359,14 +359,16 @@ Class UniformBlock Extends Resource
 		Return Cast<T Ptr>( Varptr _uniforms[id].floatData )[0]
 	End
 
-	Method GetDataPtr<T>:T Ptr( name:String,type:Type )
-		Local id:=GetUniformId( name,type )
-'		DebugAssert( _uniforms[id].type=type,"Invalid uniform type" )
+	Method GetDataPtr<T>:T Ptr( id:Int,type:Type )
+#If __DEBUG__
+		Assert( id,"Uniform '"+GetUniformName( id )+"' not found" )
+		Assert( _uniforms[id].type,"Uniform '"+GetUniformName( id )+"' not found in UniformBlock" )
+		Assert( _uniforms[id].type=type,"Uniform '"+GetUniformName( id )+"' has incorrect type '"+_typenames[_uniforms[id].type]="', expecting type '"+_typenames[type]+"'" )
+#endif
 		Return Cast<T Ptr>( Varptr _uniforms[id].floatData )
 	End
 	
 	Method GetFloatPtr:Float Ptr( id:Int,type:Type )
-		
 #If __DEBUG__
 		Assert( id,"Uniform '"+GetUniformName( id )+"' not found" )
 		Assert( _uniforms[id].type,"Uniform '"+GetUniformName( id )+"' not found in UniformBlock" )