Add clear pass for metal

This commit is contained in:
Lubos Lenco 2020-05-04 23:08:47 +02:00
parent 61ff96786f
commit 66e9572554
4 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1,9 @@
#version 450
in vec2 texCoord;
out vec4 fragColor;
void main() {
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
gl_FragDepth = 1.0;
}

View file

@ -0,0 +1,14 @@
{
"contexts": [
{
"name": "clear_pass",
"depth_write": true,
"compare_mode": "always",
"cull_mode": "none",
"links": [],
"texture_params": [],
"vertex_shader": "../include/pass.vert.glsl",
"fragment_shader": "clear_pass.frag.glsl"
}
]
}

View file

@ -62,6 +62,13 @@ class RenderPathForward {
path = _path;
#if kha_metal
{
path.loadShader("shader_datas/clear_pass/clear_pass");
path.clearShader = "shader_datas/clear_pass/clear_pass";
}
#end
#if (rp_background == "World")
{
path.loadShader("shader_datas/world_pass/world_pass");

View file

@ -127,6 +127,10 @@ def build():
assets.add_khafile_def('rp_shadowmap_cascade={0}'.format(arm.utils.get_cascade_size(rpdat)))
assets.add_khafile_def('rp_shadowmap_cube={0}'.format(rpdat.rp_shadowmap_cube))
gapi = state.export_gapi
if gapi == 'metal':
assets.add_shader_pass('clear_pass')
assets.add_khafile_def('rp_background={0}'.format(rpdat.rp_background))
if rpdat.rp_background == 'World':
assets.add_shader_pass('world_pass')
@ -221,7 +225,7 @@ def build():
if rpdat.rp_antialiasing == 'TAA':
assets.add_khafile_def('arm_taa')
assets.add_khafile_def('rp_supersampling={0}'.format(rpdat.rp_supersampling))
assets.add_khafile_def('rp_supersampling={0}'.format(rpdat.rp_supersampling))
if rpdat.rp_supersampling == '4':
assets.add_shader_pass('supersample_resolve')
@ -276,7 +280,7 @@ def build():
else: # mobile, solid
assets.add_shader_pass('deferred_light_' + rpdat.arm_material_model.lower())
assets.add_khafile_def('rp_material_' + rpdat.arm_material_model.lower())
if len(bpy.data.lightprobes) > 0:
wrd.world_defs += '_Probes'
assets.add_khafile_def('rp_probes')