Improve multi pass layer draw
This commit is contained in:
@@ -19,7 +19,7 @@ class MakeMesh {
|
||||
name: context_id,
|
||||
depth_write: layerPass == 0 ? true : false,
|
||||
compare_mode: layerPass == 0 ? "less" : "equal",
|
||||
cull_mode: Context.cullBackfaces ? "clockwise" : "none",
|
||||
cull_mode: (Context.cullBackfaces || layerPass > 0) ? "clockwise" : "none",
|
||||
vertex_elements: [{name: "pos", data: "short4norm"},{name: "nor", data: "short2norm"},{name: "tex", data: "short2norm"}],
|
||||
color_attachments: ["RGBA64", "RGBA64", "RGBA64"],
|
||||
depth_attachment: "DEPTH32"
|
||||
|
||||
@@ -551,8 +551,10 @@ class RenderPathDeferred {
|
||||
#else
|
||||
path.clearTarget(null, 1.0);
|
||||
#end
|
||||
path.setTarget("gbuffer2");
|
||||
path.clearTarget(0xff000000);
|
||||
if (MakeMesh.layerPassCount == 1) {
|
||||
path.setTarget("gbuffer2");
|
||||
path.clearTarget(0xff000000);
|
||||
}
|
||||
path.setTarget("gbuffer0", ["gbuffer1", "gbuffer2"]);
|
||||
var currentG = path.currentG;
|
||||
RenderPathPaint.bindLayers();
|
||||
@@ -563,6 +565,10 @@ class RenderPathDeferred {
|
||||
for (i in 1...MakeMesh.layerPassCount) {
|
||||
var ping = i % 2 == 1 ? "_copy" : "";
|
||||
var pong = i % 2 == 1 ? "" : "_copy";
|
||||
if (i == MakeMesh.layerPassCount - 1) {
|
||||
path.setTarget("gbuffer2" + ping);
|
||||
path.clearTarget(0xff000000);
|
||||
}
|
||||
path.setTarget("gbuffer0" + ping, ["gbuffer1" + ping, "gbuffer2" + ping]);
|
||||
path.bindTarget("gbuffer0" + pong, "gbuffer0");
|
||||
path.bindTarget("gbuffer1" + pong, "gbuffer1");
|
||||
|
||||
Reference in New Issue
Block a user