MCPcopy Create free account
hub / github.com/defold/defold / Graphics_GetEngineAdapters

Function Graphics_GetEngineAdapters

engine/script/src/script_graphics.cpp:733–750  ·  view source on GitHub ↗

get the list of graphics adapters that have been registered with the engine * * @name graphics.get_engine_adapters * @return adapters [type:table] array of adapter family name strings (e.g. "opengl", "vulkan", "webgpu") */

Source from the content-addressed store, hash-verified

731 * @return adapters [type:table] array of adapter family name strings (e.g. "opengl", "vulkan", "webgpu")
732 */
733 static int Graphics_GetEngineAdapters(lua_State* L)
734 {
735 DM_LUA_STACK_CHECK(L, 1);
736
737 uint32_t num_adapters = dmGraphics::GetRegisteredAdaptersCount();
738 lua_createtable(L, (int) num_adapters, 0);
739
740 for (uint32_t i = 0; i < num_adapters; ++i)
741 {
742 dmGraphics::HGraphicsAdapter adapter = dmGraphics::GetRegisteredAdapter(i);
743 dmGraphics::AdapterFamily adapter_family = dmGraphics::GetAdapterFamily(adapter);
744
745 lua_pushstring(L, AdapterFamilyToName(adapter_family));
746 lua_rawseti(L, -2, (int) i + 1);
747 }
748
749 return 1;
750 }
751
752 /*# get information about the currently installed graphics adapter
753 *

Callers

nothing calls this directly

Calls 7

lua_createtableFunction · 0.85
GetRegisteredAdapterFunction · 0.85
GetAdapterFamilyFunction · 0.85
lua_pushstringFunction · 0.85
AdapterFamilyToNameFunction · 0.85
lua_rawsetiFunction · 0.85

Tested by

no test coverage detected