added lua bindings for HDR display control

This commit is contained in:
Turánszki János
2024-10-19 10:56:51 +02:00
parent db719bd7b4
commit 9b76e1c905
4 changed files with 33 additions and 1 deletions
+27
View File
@@ -27,6 +27,8 @@ namespace wi::lua
lunamethod(Application_BindLua, SetHeapAllocationCountDisplay),
lunamethod(Application_BindLua, SetVRAMUsageDisplay),
lunamethod(Application_BindLua, SetColorGradingHelper),
lunamethod(Application_BindLua, IsHDRSupported),
lunamethod(Application_BindLua, SetHDR),
lunamethod(Application_BindLua, GetCanvas),
lunamethod(Application_BindLua, SetCanvas),
lunamethod(Application_BindLua, Exit),
@@ -383,6 +385,31 @@ namespace wi::lua
return 0;
}
int Application_BindLua::IsHDRSupported(lua_State* L)
{
wi::lua::SSetBool(L, wi::graphics::GetDevice()->IsSwapChainSupportsHDR(&component->swapChain));
return 1;
}
int Application_BindLua::SetHDR(lua_State* L)
{
if (component == nullptr)
{
wi::lua::SError(L, "SetHDR() component is empty!");
return 0;
}
int argc = wi::lua::SGetArgCount(L);
if (argc > 0)
{
component->allow_hdr = wi::lua::SGetBool(L, 1);
component->swapChain.desc.allow_hdr = component->allow_hdr;
bool success = wi::graphics::GetDevice()->CreateSwapChain(&component->swapChain.desc, nullptr, &component->swapChain);
assert(success);
}
else
wi::lua::SError(L, "SetHDR(bool active) not enough arguments!");
return 0;
}
int Application_BindLua::GetCanvas(lua_State* L)
{
if (component == nullptr)