Metal setup merge (#1616)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Alex Cristici <alex.cristici@gmail.com>
Co-authored-by: mwilsnd <mwilsnd@gmail.com>
Co-authored-by: Stefan Karschti <stefan.karschti@gmail.com>
Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: Alex Cristici <alex@skoon.energy>
Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
Co-authored-by: Wei Chen <alanchenboy@gmail.com>
Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com>
Co-authored-by: tdcosta100 <tdcosta100@gmail.com>
This commit is contained in:
Tim Sylvester
2023-09-13 11:35:20 -07:00
committed by GitHub
parent 085b0ced6d
commit 82ec59a2b0
284 changed files with 32357 additions and 1155 deletions

View File

@@ -52,22 +52,32 @@ public:
static std::unique_ptr<Instance> createInstance(gl::Context& context,
const ProgramParameters& programParameters,
const std::string& additionalDefines) {
#if MLN_RENDER_BACKEND_OPENGL
constexpr auto backend = gfx::Backend::Type::OpenGL;
#elif MLN_RENDER_BACKEND_METAL
constexpr auto backend = gfx::Backend::Type::Metal;
#endif
#if MLN_RENDER_BACKEND_METAL
return std::make_unique<Instance>(context);
#else
// Compile the shader
std::initializer_list<const char*> vertexSource = {
"#version 300 es\n",
programParameters.getDefines().c_str(),
programParameters.getDefinesString().c_str(),
additionalDefines.c_str(),
shaders::ShaderSource<shaders::BuiltIn::Prelude, gfx::Backend::Type::OpenGL>::vertex,
shaders::ShaderSource<shaders::BuiltIn::Prelude, backend>::vertex,
programParameters.vertexSource(gfx::Backend::Type::OpenGL).c_str()};
std::initializer_list<const char*> fragmentSource = {
"#version 300 es\n",
programParameters.getDefines().c_str(),
programParameters.getDefinesString().c_str(),
additionalDefines.c_str(),
shaders::ShaderSource<shaders::BuiltIn::Prelude, gfx::Backend::Type::OpenGL>::fragment,
shaders::ShaderSource<shaders::BuiltIn::Prelude, backend>::fragment,
programParameters.fragmentSource(gfx::Backend::Type::OpenGL).c_str()};
return std::make_unique<Instance>(context, vertexSource, fragmentSource);
#endif
}
UniqueProgram program;