| 1285 | } |
| 1286 | |
| 1287 | FALCOR_SCRIPT_BINDING(Device) |
| 1288 | { |
| 1289 | using namespace pybind11::literals; |
| 1290 | |
| 1291 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Formats) |
| 1292 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Buffer) |
| 1293 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Texture) |
| 1294 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Sampler) |
| 1295 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Profiler) |
| 1296 | FALCOR_SCRIPT_BINDING_DEPENDENCY(RenderContext) |
| 1297 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Program) |
| 1298 | |
| 1299 | pybind11::class_<AdapterInfo> adapterInfo(m, "AdapterInfo"); |
| 1300 | adapterInfo.def_readonly("device_id", &AdapterInfo::deviceID); |
| 1301 | adapterInfo.def_readonly("name", &AdapterInfo::name); |
| 1302 | adapterInfo.def_readonly("vendor_id", &AdapterInfo::vendorID); |
| 1303 | adapterInfo.def_readonly("luid", &AdapterInfo::luid); |
| 1304 | |
| 1305 | pybind11::class_<Device, ref<Device>> device(m, "Device"); |
| 1306 | |
| 1307 | pybind11::enum_<Device::Type> deviceType(m, "DeviceType"); |
| 1308 | deviceType.value("Default", Device::Type::Default); |
| 1309 | deviceType.value("D3D12", Device::Type::D3D12); |
| 1310 | deviceType.value("Vulkan", Device::Type::Vulkan); |
| 1311 | |
| 1312 | pybind11::class_<Device::Info> info(device, "Info"); |
| 1313 | info.def_readonly("adapter_name", &Device::Info::adapterName); |
| 1314 | info.def_readonly("api_name", &Device::Info::apiName); |
| 1315 | |
| 1316 | pybind11::class_<Device::Limits> limits(device, "Limits"); |
| 1317 | limits.def_readonly("max_compute_dispatch_thread_groups", &Device::Limits::maxComputeDispatchThreadGroups); |
| 1318 | limits.def_readonly("max_shader_visible_samplers", &Device::Limits::maxShaderVisibleSamplers); |
| 1319 | |
| 1320 | device.def( |
| 1321 | pybind11::init( |
| 1322 | [](Device::Type type, uint32_t gpu, bool enable_debug_layer, bool enable_aftermath) |
| 1323 | { |
| 1324 | Device::Desc desc; |
| 1325 | desc.type = type; |
| 1326 | desc.gpu = gpu; |
| 1327 | desc.enableDebugLayer = enable_debug_layer; |
| 1328 | desc.enableAftermath = enable_aftermath; |
| 1329 | return make_ref<Device>(desc); |
| 1330 | } |
| 1331 | ), |
| 1332 | "type"_a = Device::Type::Default, |
| 1333 | "gpu"_a = 0, |
| 1334 | "enable_debug_layer"_a = false, |
| 1335 | "enable_aftermath"_a = false |
| 1336 | ); |
| 1337 | device.def( |
| 1338 | "create_buffer", |
| 1339 | [](Device& self, size_t size, ResourceBindFlags bind_flags, MemoryType memory_type) |
| 1340 | { return self.createBuffer(size, bind_flags, memory_type); }, |
| 1341 | "size"_a, |
| 1342 | "bind_flags"_a = ResourceBindFlags::None, |
| 1343 | "memory_type"_a = MemoryType::DeviceLocal |
| 1344 | ); |
nothing calls this directly
no test coverage detected