Przeglądaj źródła

added MRT detection

Nicolas Cannasse 10 lat temu
rodzic
commit
9edbfa5817
3 zmienionych plików z 8 dodań i 1 usunięć
  1. 4 0
      h3d/impl/Driver.hx
  2. 3 1
      h3d/impl/GlDriver.hx
  3. 1 0
      h3d/impl/Stage3dDriver.hx

+ 4 - 0
h3d/impl/Driver.hx

@@ -47,6 +47,10 @@ enum Feature {
 		Is it required to perform a full clear each frame on render target textures.
 		Is it required to perform a full clear each frame on render target textures.
 	*/
 	*/
 	FullClearRequired;
 	FullClearRequired;
+	/*
+		Allows to render on several render targets with a single draw.
+	*/
+	MultipleRenderTargets;
 }
 }
 
 
 class Driver {
 class Driver {

+ 3 - 1
h3d/impl/GlDriver.hx

@@ -648,13 +648,15 @@ class GlDriver extends Driver {
 	override function hasFeature( f : Feature ) : Bool {
 	override function hasFeature( f : Feature ) : Bool {
 		return switch( f ) {
 		return switch( f ) {
 		#if hxsdl
 		#if hxsdl
-		case StandardDerivatives, FloatTextures:
+		case StandardDerivatives, FloatTextures, MultipleRenderTargets:
 			true; // runtime extension detect required ?
 			true; // runtime extension detect required ?
 		#else
 		#else
 		case StandardDerivatives:
 		case StandardDerivatives:
 			gl.getExtension('OES_standard_derivatives') != null;
 			gl.getExtension('OES_standard_derivatives') != null;
 		case FloatTextures:
 		case FloatTextures:
 			gl.getExtension('OES_texture_float') != null && gl.getExtension('OES_texture_float_linear') != null;
 			gl.getExtension('OES_texture_float') != null && gl.getExtension('OES_texture_float_linear') != null;
+		case MultipleRenderTargets:
+			gl.getExtension('WEBGL_draw_buffers') != null;
 		#end
 		#end
 		case PerTargetDepthBuffer:
 		case PerTargetDepthBuffer:
 			true;
 			true;

+ 1 - 0
h3d/impl/Stage3dDriver.hx

@@ -150,6 +150,7 @@ class Stage3dDriver extends Driver {
 		case PerTargetDepthBuffer: false;
 		case PerTargetDepthBuffer: false;
 		case TargetUseDefaultDepthBuffer: true;
 		case TargetUseDefaultDepthBuffer: true;
 		case FullClearRequired: flashVersion < 15;
 		case FullClearRequired: flashVersion < 15;
+		case MultipleRenderTargets: (PROFILE == cast "standard") || (PROFILE == cast "standardExtended");
 		}
 		}
 	}
 	}