2
0
Эх сурвалжийг харах

Fixed UniformBlock.GetDataPtr so int uniforms work.

Mark Sibly 7 жил өмнө
parent
commit
e29c747e23

+ 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" )