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

Function RenderScript_SetRenderTarget

engine/render/src/render/render_script.cpp:1217–1251  ·  view source on GitHub ↗

sets a render target * * Sets a render target. Subsequent draw operations will be to the * render target until it is replaced by a subsequent call to set_render_target. * This function supports render targets created by a render script, or a render target resource. * * @name render.set_render_target * @param render_target [type:render_target] render target to set

Source from the content-addressed store, hash-verified

1215 * ```
1216 */
1217 int RenderScript_SetRenderTarget(lua_State* L)
1218 {
1219 DM_LUA_STACK_CHECK(L, 0);
1220 RenderScriptInstance* i = RenderScriptInstance_Check(L);
1221 dmGraphics::HRenderTarget render_target = 0;
1222
1223 if (lua_gettop(L) > 0)
1224 {
1225 if (!lua_isnil(L, 1))
1226 render_target = CheckRenderTarget(L, 1, i);
1227 }
1228
1229 uint32_t transient_buffer_types = 0;
1230 if (lua_gettop(L) > 1)
1231 {
1232 luaL_checktype(L, 2, LUA_TTABLE);
1233 lua_pushvalue(L, 2);
1234 lua_getfield(L, -1, "transient");
1235 if(!lua_isnil(L, -1))
1236 {
1237 lua_pushnil(L);
1238 while (lua_next(L, -2))
1239 {
1240 transient_buffer_types |= luaL_checkint(L, -1);
1241 lua_pop(L, 1);
1242 }
1243 }
1244 lua_pop(L, 2);
1245 }
1246
1247 if (InsertCommand(i, Command(COMMAND_TYPE_SET_RENDER_TARGET, render_target, transient_buffer_types)))
1248 return 0;
1249 else
1250 return DM_LUA_ERROR("Command buffer is full (%d).", i->m_CommandBuffer.Capacity());
1251 }
1252
1253 /*# sets the render target size
1254 *

Callers

nothing calls this directly

Calls 11

lua_gettopFunction · 0.85
CheckRenderTargetFunction · 0.85
luaL_checktypeFunction · 0.85
lua_pushvalueFunction · 0.85
lua_getfieldFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
InsertCommandFunction · 0.85
CommandClass · 0.70
CapacityMethod · 0.45

Tested by

no test coverage detected