mirror of https://github.com/bjornbytes/lovr.git
Pass:getClear returns correct value for dontcare/load actions;
This commit is contained in:
parent
5c4fc79242
commit
931ffea17b
|
@ -76,6 +76,7 @@ static int l_lovrPassGetTarget(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrPassGetClear(lua_State* L) {
|
static int l_lovrPassGetClear(lua_State* L) {
|
||||||
Pass* pass = luax_checktype(L, 1, Pass);
|
Pass* pass = luax_checktype(L, 1, Pass);
|
||||||
|
const PassInfo* info = lovrPassGetInfo(pass);
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
float color[4][4];
|
float color[4][4];
|
||||||
|
@ -86,15 +87,18 @@ static int l_lovrPassGetClear(lua_State* L) {
|
||||||
lua_createtable(L, (int) count, 2);
|
lua_createtable(L, (int) count, 2);
|
||||||
|
|
||||||
for (int i = 0; i < (int) count; i++) {
|
for (int i = 0; i < (int) count; i++) {
|
||||||
|
if (info->canvas.loads[i] == LOAD_CLEAR) {
|
||||||
lua_createtable(L, 4, 0);
|
lua_createtable(L, 4, 0);
|
||||||
for (int j = 0; j < 4; j++) {
|
for (int j = 0; j < 4; j++) {
|
||||||
lua_pushnumber(L, color[i][j]);
|
lua_pushnumber(L, color[i][j]);
|
||||||
lua_rawseti(L, -2, j + 1);
|
lua_rawseti(L, -2, j + 1);
|
||||||
}
|
}
|
||||||
lua_rawseti(L, -2, i + 1);
|
} else {
|
||||||
|
lua_pushboolean(L, info->canvas.loads[i] == LOAD_DISCARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PassInfo* info = lovrPassGetInfo(pass);
|
lua_rawseti(L, -2, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (info->canvas.depth.format || info->canvas.depth.texture) {
|
if (info->canvas.depth.format || info->canvas.depth.texture) {
|
||||||
lua_pushnumber(L, depth);
|
lua_pushnumber(L, depth);
|
||||||
|
|
Loading…
Reference in New Issue