Clean up pipelines

This commit is contained in:
luboslenco
2020-01-17 00:38:22 +01:00
parent 62c9bca66e
commit e25043bbec
5 changed files with 22 additions and 2 deletions
+3
View File
@@ -238,6 +238,7 @@ class Layers {
imga.g2.begin(false); // Copy to temp
imga.g2.pipeline = pipeCopy;
imga.g2.drawImage(l0.texpaint, 0, 0);
imga.g2.pipeline = null;
imga.g2.end();
l0.texpaint.g4.begin();
@@ -257,6 +258,7 @@ class Layers {
imga.g2.begin(false);
imga.g2.pipeline = pipeCopy;
imga.g2.drawImage(l0.texpaint_nor, 0, 0);
imga.g2.pipeline = null;
imga.g2.end();
l0.texpaint_nor.g4.begin();
@@ -275,6 +277,7 @@ class Layers {
imga.g2.begin(false);
imga.g2.pipeline = pipeCopy;
imga.g2.drawImage(l0.texpaint_pack, 0, 0);
imga.g2.pipeline = null;
imga.g2.end();
l0.texpaint_pack.g4.begin();
+5
View File
@@ -192,6 +192,7 @@ class LayerSlot {
Layers.imga.g2.begin(false);
Layers.imga.g2.pipeline = Layers.pipeCopy;
Layers.imga.g2.drawImage(texpaint, 0, 0);
Layers.imga.g2.pipeline = null;
Layers.imga.g2.end();
// Merge mask
@@ -221,14 +222,17 @@ class LayerSlot {
l.texpaint.g2.begin(false);
l.texpaint.g2.pipeline = Layers.pipeCopy;
l.texpaint.g2.drawImage(texpaint, 0, 0);
l.texpaint.g2.pipeline = null;
l.texpaint.g2.end();
l.texpaint_nor.g2.begin(false);
l.texpaint_nor.g2.pipeline = Layers.pipeCopy;
l.texpaint_nor.g2.drawImage(texpaint_nor, 0, 0);
l.texpaint_nor.g2.pipeline = null;
l.texpaint_nor.g2.end();
l.texpaint_pack.g2.begin(false);
l.texpaint_pack.g2.pipeline = Layers.pipeCopy;
l.texpaint_pack.g2.drawImage(texpaint_pack, 0, 0);
l.texpaint_pack.g2.pipeline = null;
l.texpaint_pack.g2.end();
l.texpaint_preview.g2.begin(true, 0xff000000);
@@ -240,6 +244,7 @@ class LayerSlot {
l.texpaint_mask.g2.begin(false);
l.texpaint_mask.g2.pipeline = Layers.pipeCopy;
l.texpaint_mask.g2.drawImage(texpaint_mask, 0, 0);
l.texpaint_mask.g2.pipeline = null;
l.texpaint_mask.g2.end();
l.texpaint_mask_preview.g2.begin(true, 0xff000000);
+6
View File
@@ -71,14 +71,17 @@ class ExportTexture {
Layers.expa.g2.begin(false);
Layers.expa.g2.pipeline = Layers.pipeCopy;
Layers.expa.g2.drawImage(layers[0].texpaint, 0, 0);
Layers.expa.g2.pipeline = null;
Layers.expa.g2.end();
Layers.expb.g2.begin(false);
Layers.expb.g2.pipeline = Layers.pipeCopy;
Layers.expb.g2.drawImage(layers[0].texpaint_nor, 0, 0);
Layers.expb.g2.pipeline = null;
Layers.expb.g2.end();
Layers.expc.g2.begin(false);
Layers.expc.g2.pipeline = Layers.pipeCopy;
Layers.expc.g2.drawImage(layers[0].texpaint_pack, 0, 0);
Layers.expc.g2.pipeline = null;
Layers.expc.g2.end();
}
else {
@@ -105,6 +108,7 @@ class ExportTexture {
Layers.imga.g2.begin(false); // Copy to temp
Layers.imga.g2.pipeline = Layers.pipeCopy;
Layers.imga.g2.drawImage(Layers.expa, 0, 0);
Layers.imga.g2.pipeline = null;
Layers.imga.g2.end();
Layers.expa.g4.begin();
Layers.expa.g4.setPipeline(Layers.pipeMerge);
@@ -124,6 +128,7 @@ class ExportTexture {
Layers.imga.g2.begin(false);
Layers.imga.g2.pipeline = Layers.pipeCopy;
Layers.imga.g2.drawImage(Layers.expb, 0, 0);
Layers.imga.g2.pipeline = null;
Layers.imga.g2.end();
Layers.expb.g4.begin();
Layers.expb.g4.setPipeline(Layers.pipeMerge);
@@ -141,6 +146,7 @@ class ExportTexture {
Layers.imga.g2.begin(false);
Layers.imga.g2.pipeline = Layers.pipeCopy;
Layers.imga.g2.drawImage(Layers.expc, 0, 0);
Layers.imga.g2.pipeline = null;
Layers.imga.g2.end();
Layers.expc.g4.begin();
Layers.expc.g4.setPipeline(Layers.pipeMerge);
+3
View File
@@ -135,6 +135,9 @@ class TabLayers {
ui._y += 3;
ui.g.pipeline = UIView2D.inst.pipe;
#if kha_opengl
ui.currentWindow.texture.g4.setPipeline(UIView2D.inst.pipe);
#end
ui.currentWindow.texture.g4.setInt(UIView2D.inst.channelLocation, 1);
var state = ui.image(l.texpaint_mask_preview, 0xffffffff, (ui.ELEMENT_H() - 3) * 2);
ui.g.pipeline = null;
+5 -2
View File
@@ -119,8 +119,6 @@ class UIView2D {
tex = UITrait.inst.getImage(Context.texture);
}
ui.currentWindow.texture.g4.setInt(channelLocation, channel);
var th = tw;
if (tex != null) {
th = tw * (tex.height / tex.width);
@@ -128,6 +126,11 @@ class UIView2D {
ui.g.imageScaleQuality = kha.graphics2.ImageScaleQuality.Low;
}
#if kha_opengl
ui.currentWindow.texture.g4.setPipeline(pipe);
#end
ui.currentWindow.texture.g4.setInt(channelLocation, channel);
ui.g.drawScaledImage(tex, tx, ty, tw, th);
if (!UITrait.inst.textureFilter) {