Make metal work
This commit is contained in:
@@ -22,6 +22,16 @@ class RenderPathDeferred {
|
||||
public static function init(_path: RenderPath) {
|
||||
|
||||
path = _path;
|
||||
|
||||
#if kha_metal
|
||||
{
|
||||
path.loadShader("clear_color_depth_pass/clear_color_depth_pass/clear_color_depth8_pass");
|
||||
path.loadShader("clear_color_depth_pass/clear_color_depth_pass/clear_color_depth32_pass");
|
||||
path.loadShader("clear_color_depth_pass/clear_color_depth_pass/clear_color_depth64_pass");
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth32_pass";
|
||||
}
|
||||
#end
|
||||
|
||||
path.createDepthBuffer("main", "DEPTH24");
|
||||
|
||||
{
|
||||
@@ -530,6 +540,9 @@ class RenderPathDeferred {
|
||||
var current = taaFrame % 2 == 0 ? "bufa" : "taa2";
|
||||
var last = taaFrame % 2 == 0 ? "taa2" : "bufa";
|
||||
|
||||
#if kha_metal
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth32_pass";
|
||||
#end
|
||||
path.setTarget(current);
|
||||
path.clearTarget(0x00000000);
|
||||
path.bindTarget("buf", "colorTex");
|
||||
@@ -579,6 +592,9 @@ class RenderPathDeferred {
|
||||
}
|
||||
|
||||
public static function drawGbuffer() {
|
||||
#if kha_metal
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth64_pass";
|
||||
#end
|
||||
path.setTarget("gbuffer0"); // Only clear gbuffer0
|
||||
path.clearTarget(null, 1.0);
|
||||
path.setTarget("gbuffer2");
|
||||
|
||||
@@ -60,6 +60,9 @@ class RenderPathForward {
|
||||
}
|
||||
|
||||
static function drawGbuffer() {
|
||||
#if kha_metal
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth64_pass";
|
||||
#end
|
||||
path.setTarget("gbuffer0");
|
||||
path.clearTarget(null, 1.0);
|
||||
path.setTarget("gbuffer2");
|
||||
@@ -95,6 +98,10 @@ class RenderPathForward {
|
||||
var current = taaFrame % 2 == 0 ? "bufa" : "taa2";
|
||||
var last = taaFrame % 2 == 0 ? "taa2" : "bufa";
|
||||
|
||||
#if kha_metal
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth32_pass";
|
||||
#end
|
||||
|
||||
path.setTarget(current);
|
||||
path.clearTarget(0x00000000);
|
||||
path.bindTarget("buf", "colorTex");
|
||||
|
||||
@@ -623,8 +623,16 @@ class RenderPathPaint {
|
||||
|
||||
if (Context.brushBlendDirty) {
|
||||
Context.brushBlendDirty = false;
|
||||
#if kha_metal
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth8_pass";
|
||||
path.setTarget("texpaint_blend0");
|
||||
path.clearTarget(0x00000000);
|
||||
path.setTarget("texpaint_blend1");
|
||||
path.clearTarget(0x00000000);
|
||||
#else
|
||||
path.setTarget("texpaint_blend0", ["texpaint_blend1"]);
|
||||
path.clearTarget(0x00000000);
|
||||
#end
|
||||
}
|
||||
|
||||
if (Context.paint2d) {
|
||||
|
||||
@@ -83,14 +83,21 @@ class RenderPathPreview {
|
||||
}
|
||||
|
||||
public static function commandsPreview() {
|
||||
#if kha_metal
|
||||
path.clearShader = "clear_color_depth_pass/clear_color_depth_pass/clear_color_depth64_pass";
|
||||
#end
|
||||
path.setTarget("mgbuffer2");
|
||||
path.clearTarget(0xff000000);
|
||||
path.setTarget("mgbuffer0", ["mgbuffer1", "mgbuffer2"]);
|
||||
|
||||
#if arm_world
|
||||
path.clearTarget(0xffffffff, 1.0);
|
||||
var clearColor = 0xffffffff;
|
||||
#else
|
||||
path.clearTarget(null, 1.0);
|
||||
var clearColor: Null<Int> = null;
|
||||
#end
|
||||
|
||||
path.setTarget("mgbuffer0");
|
||||
path.clearTarget(clearColor, 1.0);
|
||||
path.setTarget("mgbuffer0", ["mgbuffer1", "mgbuffer2"]);
|
||||
path.drawMeshes("mesh");
|
||||
|
||||
// ---
|
||||
|
||||
Reference in New Issue
Block a user