Frontface culling support for Metal

This commit is contained in:
Jack Andersen 2017-03-10 11:08:51 -10:00
parent ce723d5505
commit c407e75943
12 changed files with 106 additions and 93 deletions

View File

@ -118,7 +118,8 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CCameraBlurFilterMetalDataBindingFactory;
}

View File

@ -93,11 +93,14 @@ CColoredQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CColoredQuadFilterMetalDataBindingFactory;
}

View File

@ -143,19 +143,19 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
m_texAlpha = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_texVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_texAdditive = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_texVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_noTexAlpha = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_noTexVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_noTexAdditive = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_noTexVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
return new struct MetalLineDataBindingFactory;
}

View File

@ -84,7 +84,8 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CSpaceWarpFilterMetalDataBindingFactory;
}

View File

@ -139,9 +139,9 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_TextVtxFmt = ctx.newVertexFormat(11, TextVtxVmt);
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false, false);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false, false);
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::VertexElementDescriptor ImageVtxVmt[] =
{
@ -157,9 +157,9 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_ImageVtxFmt = ctx.newVertexFormat(9, ImageVtxVmt);
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false, false);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false, false);
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
return nullptr;
}

View File

@ -149,11 +149,14 @@ CTexturedQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CTexturedQuadFilterMetalDataBindingFactory;
}
@ -183,11 +186,14 @@ CTexturedQuadFilterAlpha::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CTexturedQuadFilterAlphaMetalDataBindingFactory;
}

View File

@ -112,7 +112,8 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CThermalColdFilterMetalDataBindingFactory;
}

View File

@ -86,7 +86,7 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::DstAlpha, boo::BlendFactor::InvDstAlpha,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
return new CThermalHotFilterMetalDataBindingFactory;
}

View File

@ -100,7 +100,8 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
return new CXRayBlurFilterMetalDataBindingFactory;
}

View File

@ -293,89 +293,89 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::Met
m_texZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false);
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
m_texNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_texZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false);
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_texAdditiveZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, false);
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false);
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_indTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_indTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_indTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_cindTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_cindTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_cindTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_noTexZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false);
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false);
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false);
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, false);
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false);
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
return new struct MetalElementDataBindingFactory;
}

2
hecl

@ -1 +1 @@
Subproject commit 325a91981f12d5b633c3a47238aa451523831d97
Subproject commit 98513a38f2a3a84c14b158339fdb7f061c4ffec1

@ -1 +1 @@
Subproject commit 3dc1c3bae0cb3f8549ea696db389ee04e1352020
Subproject commit 0a24fe47034b2e64ca6d8239d439d142cab0fb71