forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PyGlslShaderGenerator.cpp
63 lines (52 loc) · 2.43 KB
/
PyGlslShaderGenerator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#include <PyMaterialX/PyMaterialX.h>
#include <MaterialXGenGlsl/GlslShaderGenerator.h>
#include <MaterialXGenGlsl/GlslResourceBindingContext.h>
#include <MaterialXGenGlsl/EsslShaderGenerator.h>
#include <MaterialXGenGlsl/VkShaderGenerator.h>
#include <MaterialXGenShader/Shader.h>
#include <MaterialXGenShader/ShaderGenerator.h>
#include <string>
namespace py = pybind11;
namespace mx = MaterialX;
// GLSL shader generator bindings
void bindPyGlslShaderGenerator(py::module& mod)
{
py::class_<mx::GlslShaderGenerator, mx::HwShaderGenerator, mx::GlslShaderGeneratorPtr>(mod, "GlslShaderGenerator")
.def_static("create", &mx::GlslShaderGenerator::create)
.def(py::init<>())
.def("generate", &mx::GlslShaderGenerator::generate)
.def("getTarget", &mx::GlslShaderGenerator::getTarget)
.def("getVersion", &mx::GlslShaderGenerator::getVersion);
}
void bindPyGlslResourceBindingContext(py::module &mod)
{
py::class_<mx::GlslResourceBindingContext, mx::HwResourceBindingContext, mx::GlslResourceBindingContextPtr>(mod, "GlslResourceBindingContext")
.def_static("create", &mx::GlslResourceBindingContext::create)
.def(py::init<size_t, size_t>())
.def("emitDirectives", &mx::GlslResourceBindingContext::emitDirectives)
.def("emitResourceBindings", &mx::GlslResourceBindingContext::emitResourceBindings);
}
// Essl shader generator bindings
void bindPyEsslShaderGenerator(py::module& mod)
{
py::class_<mx::EsslShaderGenerator, mx::GlslShaderGenerator, mx::EsslShaderGeneratorPtr>(mod, "EsslShaderGenerator")
.def_static("create", &mx::EsslShaderGenerator::create)
.def(py::init<>())
.def("generate", &mx::EsslShaderGenerator::generate)
.def("getTarget", &mx::EsslShaderGenerator::getTarget)
.def("getVersion", &mx::EsslShaderGenerator::getVersion);
}
// Glsl Vulkan shader generator bindings
void bindPyVkShaderGenerator(py::module& mod)
{
py::class_<mx::VkShaderGenerator, mx::GlslShaderGenerator, mx::VkShaderGeneratorPtr>(mod, "VkShaderGenerator")
.def_static("create", &mx::VkShaderGenerator::create)
.def(py::init<>())
.def("generate", &mx::VkShaderGenerator::generate)
.def("getTarget", &mx::VkShaderGenerator::getTarget)
.def("getVersion", &mx::VkShaderGenerator::getVersion);
}