mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Improve backbuffer depth buffer.
- Setting the depth buffer for the backbuffer is now done as a boolean instead of a bit depth integer, in love.conf or love.window.setMode. - Error if depth writes are enabled when the active canvas setup or backbuffer does not have a depth buffer (now it matches stencil behaviour). - Don't allocate a backbuffer depth-stencil buffer if they're not requested. Metal also determines the format for that buffer based on which combination of depth and stencil is requested. OpenGL still has to allocate the depth-stencil buffer for the backbuffer all the time, because changing it requires the context to be recreated.
This commit is contained in:
@@ -68,7 +68,6 @@ static int readWindowSettings(lua_State *L, int idx, WindowSettings &settings)
|
||||
settings.fullscreen = luax_boolflag(L, idx, settingName(Window::SETTING_FULLSCREEN), settings.fullscreen);
|
||||
settings.msaa = luax_intflag(L, idx, settingName(Window::SETTING_MSAA), settings.msaa);
|
||||
settings.stencil = luax_boolflag(L, idx, settingName(Window::SETTING_STENCIL), settings.stencil);
|
||||
settings.depth = luax_intflag(L, idx, settingName(Window::SETTING_DEPTH), settings.depth);
|
||||
settings.resizable = luax_boolflag(L, idx, settingName(Window::SETTING_RESIZABLE), settings.resizable);
|
||||
settings.minwidth = luax_intflag(L, idx, settingName(Window::SETTING_MIN_WIDTH), settings.minwidth);
|
||||
settings.minheight = luax_intflag(L, idx, settingName(Window::SETTING_MIN_HEIGHT), settings.minheight);
|
||||
@@ -76,6 +75,16 @@ static int readWindowSettings(lua_State *L, int idx, WindowSettings &settings)
|
||||
settings.centered = luax_boolflag(L, idx, settingName(Window::SETTING_CENTERED), settings.centered);
|
||||
settings.usedpiscale = luax_boolflag(L, idx, settingName(Window::SETTING_USE_DPISCALE), settings.usedpiscale);
|
||||
|
||||
lua_getfield(L, idx, settingName(Window::SETTING_DEPTH));
|
||||
if (lua_type(L, -1) == LUA_TNUMBER)
|
||||
{
|
||||
luax_markdeprecated(L, 1, "window.depth number", API_FIELD, DEPRECATED_REPLACED, "window.depth boolean field");
|
||||
settings.depth = (int) luaL_checknumber(L, -1);
|
||||
}
|
||||
else if (!lua_isnoneornil(L, -1))
|
||||
settings.depth = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
settings.displayindex = luax_intflag(L, idx, settingName(Window::SETTING_DISPLAYINDEX), settings.displayindex + 1) - 1;
|
||||
lua_getfield(L, idx, settingName(Window::SETTING_DISPLAY));
|
||||
if (!lua_isnoneornil(L, -1))
|
||||
@@ -197,7 +206,7 @@ int w_getMode(lua_State *L)
|
||||
luax_pushboolean(L, settings.stencil);
|
||||
lua_setfield(L, -2, settingName(Window::SETTING_STENCIL));
|
||||
|
||||
lua_pushinteger(L, settings.depth);
|
||||
luax_pushboolean(L, settings.depth);
|
||||
lua_setfield(L, -2, settingName(Window::SETTING_DEPTH));
|
||||
|
||||
luax_pushboolean(L, settings.resizable);
|
||||
|
||||
Reference in New Issue
Block a user