Browse Source

Cleanups.

Mark Sibly 8 years ago
parent
commit
01bace0b18

+ 5 - 2
modules/mojo3d/graphics/bloomeffect.monkey2

@@ -45,9 +45,12 @@ Class BloomEffect Extends PostEffect
 		Local rtexture:=rtarget.GetColorTexture( 0 )
 		
 		If Not _target0 Or rsize.x>_target0.Size.x Or rsize.y>_target0.Size.y
+		
+			_texture0?.Discard()
+			_texture1?.Discard()
 			
-			SafeDiscard( _target0 ) ; SafeDiscard( _texture0 )
-			SafeDiscard( _target1 ) ; SafeDiscard( _texture1 )
+			_target0?.Discard()
+			_target1?.Discard()
 			
 			_texture0=New Texture( rsize.x,rsize.y,rtexture.Format,Null )
 			_texture1=New Texture( rsize.x,rsize.y,rtexture.Format,Null )

+ 6 - 6
modules/mojo3d/graphics/deferredrenderer.monkey2

@@ -33,12 +33,12 @@ Class DeferredRenderer Extends Renderer
 		
 		If Not _hdrTexture Or size.x>_hdrTexture.Size.x Or size.y>_hdrTexture.Size.y
 		
-			SafeDiscard( _hdrTexture )
-			SafeDiscard( _colorTexture )
-			SafeDiscard( _normalTexture )
-			SafeDiscard( _depthTexture )
-			SafeDiscard( _rpass0Target )
-			SafeDiscard( _rpass2Target )
+			_hdrTexture?.Discard()
+			_colorTexture?.Discard()
+			_normalTexture?.Discard()
+			_depthTexture?.Discard()
+			_rpass0Target?.Discard()
+			_rpass2Target?.Discard()
 		
 			'look at this again later - surely we can rgba32f on some mobile targets, eg: nvidia shield?
 			#If Not __MOBILE_TARGET__

+ 4 - 4
modules/mojo3d/graphics/forwardrenderer.monkey2

@@ -39,10 +39,10 @@ Class ForwardRenderer Extends Renderer
 
 		If Not _colorBuffer Or size.x>_colorBuffer.Size.x Or size.y>_colorBuffer.Size.y
 			
-			SafeDiscard( _colorBuffer )
-			SafeDiscard( _depthBuffer )
-			SafeDiscard( _colorTarget0 )
-			SafeDiscard( _colorTarget1 )
+			_colorBuffer?.Discard()
+			_depthBuffer?.Discard() 
+			_colorTarget0?.Discard()
+			_colorTarget1?.Discard()
 
 			'look again at this - surely we can rgb32f on some mobile target?
 			#If Not __MOBILE_TARGET__

+ 2 - 2
modules/mojo3d/graphics/monochromeeffect.monkey2

@@ -42,10 +42,10 @@ Class MonochromeEffect Extends PostEffect
 		
 		If Not _target Or rsize.x>_target.Size.x Or rsize.y>_target.Size.y
 			
-			SafeDiscard( _target ) ; SafeDiscard( _texture )
+			_target?.Discard()
+			_texture?.Discard()
 			
 			_texture=New Texture( rsize.x,rsize.y,rtexture.Format,Null )
-			
 			_target=New RenderTarget( New Texture[]( _texture ),Null )
 		End
 					

+ 6 - 6
modules/mojo3d/graphics/renderer.monkey2

@@ -502,9 +502,9 @@ Class Renderer
 		
 		If Not _csmTexture Or _csmSize<>_csmTexture.Size.x
 			
-			SafeDiscard( _csmTarget )
-			SafeDiscard( _csmTexture )
-			SafeDiscard( _csmDepth )
+			_csmTarget?.Discard()
+			_csmTexture?.Discard()
+			_csmDepth?.Discard()
 
 			const color_format:=PixelFormat.RGBA8
 			const depth_format:=PixelFormat.Depth32
@@ -523,10 +523,10 @@ Class Renderer
 		
 		If Not _psmTexture Or _psmSize*2>_psmTexture.Size.x
 			
-			SafeDiscard( _psmTexture )
-			SafeDiscard( _psmDepth )
+			_psmTexture?.Discard()
+			_psmDepth?.Discard()
 			For Local i:=0 Until 6
-				SafeDiscard( _psmTargets[i] )
+				_psmTargets[i]?.Discard()
 			Next
 			
 			Local size:=_psmSize*2