Changes to support MSAA rendering

This commit is contained in:
Jack Andersen 2018-01-06 19:19:23 -10:00
parent 8869646bae
commit 78dee431dc
4 changed files with 11 additions and 9 deletions

View File

@ -16,7 +16,7 @@ RootView::RootView(IViewManager& viewMan, ViewResources& res, boo::IWindow* wind
{
buildResources(ctx, res);
m_splitMenuSystem.emplace(*this, ctx);
m_renderTex = ctx.newRenderTexture(rect.size[0], rect.size[1], boo::TextureClampMode::Repeat, 3, 3);
m_renderTex = ctx.newRenderTexture(rect.size[0], rect.size[1], boo::TextureClampMode::ClampToEdge, 3, 3);
return true;
});
resized(rect, rect);

View File

@ -224,14 +224,15 @@ void TextView::Resources::init(boo::MetalDataFactory::Context& ctx, FontCache* f
static const char* FSReg =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat);\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float3 uv;\n"
" float4 color;\n"
"};\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]], texture2d_array<float> fontTex [[ texture(0) ]])\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
" sampler samp [[ sampler(0) ]],\n"
" texture2d_array<float> fontTex [[ texture(0) ]])\n"
"{\n"
" float4 colorOut = vtf.color;\n"
" colorOut.a *= fontTex.sample(samp, vtf.uv.xy, vtf.uv.z).r;\n"
@ -257,7 +258,7 @@ void TextView::Resources::init(boo::MetalDataFactory::Context& ctx, FontCache* f
m_vtxFmt = ctx.newVertexFormat(13, vdescs);
m_regular =
ctx.newShaderPipeline(VS, FSReg, nullptr, nullptr, m_vtxFmt, 1,
ctx.newShaderPipeline(VS, FSReg, nullptr, nullptr, m_vtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
}

View File

@ -253,14 +253,15 @@ void View::Resources::init(boo::MetalDataFactory::Context& ctx, const IThemeData
static const char* TexFS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat);\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
" float2 uv;\n"
"};\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]], texture2d<float> tex [[ texture(0) ]])\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
" sampler samp [[ sampler(0) ]],\n"
" texture2d<float> tex [[ texture(0) ]])\n"
"{\n"
" return tex.sample(samp, vtf.uv) * vtf.color;\n"
"}\n";
@ -272,7 +273,7 @@ void View::Resources::init(boo::MetalDataFactory::Context& ctx, const IThemeData
};
m_solidVtxFmt = ctx.newVertexFormat(2, solidvdescs);
m_solidShader = ctx.newShaderPipeline(SolidVS, SolidFS, nullptr, nullptr, m_solidVtxFmt, 1,
m_solidShader = ctx.newShaderPipeline(SolidVS, SolidFS, nullptr, nullptr, m_solidVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
@ -283,7 +284,7 @@ void View::Resources::init(boo::MetalDataFactory::Context& ctx, const IThemeData
};
m_texVtxFmt = ctx.newVertexFormat(2, texvdescs);
m_texShader = ctx.newShaderPipeline(TexVS, TexFS, nullptr, nullptr, m_texVtxFmt, 1,
m_texShader = ctx.newShaderPipeline(TexVS, TexFS, nullptr, nullptr, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
}

@ -1 +1 @@
Subproject commit c466fd21d1cbca1371ee92e062cbb43770e50657
Subproject commit f82efe058341810dec71954bf11eb21222059403