|
@@ -3,6 +3,7 @@ import h3d.mat.Data;
|
|
|
|
|
|
private class TargetTmp {
|
|
private class TargetTmp {
|
|
public var t : h3d.mat.Texture;
|
|
public var t : h3d.mat.Texture;
|
|
|
|
+ public var textures : Array<h3d.mat.Texture>;
|
|
public var next : TargetTmp;
|
|
public var next : TargetTmp;
|
|
public var layer : Int;
|
|
public var layer : Int;
|
|
public var mipLevel : Int;
|
|
public var mipLevel : Int;
|
|
@@ -51,7 +52,7 @@ class Engine {
|
|
var textureColorCache = new Map<Int,h3d.mat.Texture>();
|
|
var textureColorCache = new Map<Int,h3d.mat.Texture>();
|
|
public var ready(default,null) = false;
|
|
public var ready(default,null) = false;
|
|
@:allow(hxd.res) var resCache = new Map<{},Dynamic>();
|
|
@:allow(hxd.res) var resCache = new Map<{},Dynamic>();
|
|
-
|
|
|
|
|
|
+
|
|
public static var SOFTWARE_DRIVER = false;
|
|
public static var SOFTWARE_DRIVER = false;
|
|
public static var ANTIALIASING = 0;
|
|
public static var ANTIALIASING = 0;
|
|
|
|
|
|
@@ -233,6 +234,7 @@ class Engine {
|
|
} else {
|
|
} else {
|
|
mem = new h3d.impl.MemoryManager(driver);
|
|
mem = new h3d.impl.MemoryManager(driver);
|
|
mem.init();
|
|
mem.init();
|
|
|
|
+ nullTexture = new h3d.mat.Texture(0, 0, [NoAlloc]);
|
|
}
|
|
}
|
|
hardware = driver.hasFeature(HardwareAccelerated);
|
|
hardware = driver.hasFeature(HardwareAccelerated);
|
|
set_debug(debug);
|
|
set_debug(debug);
|
|
@@ -329,15 +331,13 @@ class Engine {
|
|
if( t == null )
|
|
if( t == null )
|
|
needFlushTarget = currentTargetTex != null;
|
|
needFlushTarget = currentTargetTex != null;
|
|
else
|
|
else
|
|
- needFlushTarget = currentTargetTex != t.t || currentTargetLayer != t.layer || currentTargetMip != t.mipLevel;
|
|
|
|
|
|
+ needFlushTarget = currentTargetTex != t.t || currentTargetLayer != t.layer || currentTargetMip != t.mipLevel || t.textures != null;
|
|
}
|
|
}
|
|
|
|
|
|
public function pushTargets( textures : Array<h3d.mat.Texture> ) {
|
|
public function pushTargets( textures : Array<h3d.mat.Texture> ) {
|
|
- if( nullTexture == null ) nullTexture = new h3d.mat.Texture(0, 0, [NoAlloc]);
|
|
|
|
pushTarget(nullTexture);
|
|
pushTarget(nullTexture);
|
|
- driver.setRenderTargets(textures);
|
|
|
|
- currentTargetTex = nullTexture;
|
|
|
|
- needFlushTarget = false;
|
|
|
|
|
|
+ targetStack.textures = textures;
|
|
|
|
+ needFlushTarget = true;
|
|
}
|
|
}
|
|
|
|
|
|
public function popTarget() {
|
|
public function popTarget() {
|
|
@@ -348,6 +348,7 @@ class Engine {
|
|
updateNeedFlush();
|
|
updateNeedFlush();
|
|
// recycle
|
|
// recycle
|
|
c.t = null;
|
|
c.t = null;
|
|
|
|
+ c.textures = null;
|
|
c.next = targetTmp;
|
|
c.next = targetTmp;
|
|
targetTmp = c;
|
|
targetTmp = c;
|
|
}
|
|
}
|
|
@@ -362,7 +363,10 @@ class Engine {
|
|
driver.setRenderTarget(null);
|
|
driver.setRenderTarget(null);
|
|
currentTargetTex = null;
|
|
currentTargetTex = null;
|
|
} else {
|
|
} else {
|
|
- driver.setRenderTarget(t.t, t.layer, t.mipLevel);
|
|
|
|
|
|
+ if( t.textures != null )
|
|
|
|
+ driver.setRenderTargets(t.textures);
|
|
|
|
+ else
|
|
|
|
+ driver.setRenderTarget(t.t, t.layer, t.mipLevel);
|
|
currentTargetTex = t.t;
|
|
currentTargetTex = t.t;
|
|
currentTargetLayer = t.layer;
|
|
currentTargetLayer = t.layer;
|
|
currentTargetMip = t.mipLevel;
|
|
currentTargetMip = t.mipLevel;
|