Browse Source

Fixed UniformBlock.GetDataPtr so int uniforms work.

Mark Sibly 7 years ago
parent
commit
e29c747e23
1 changed files with 6 additions and 4 deletions
  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" )