Skip to content

Commit b2971a8

Browse files
committed
bugfix
1 parent a61dc81 commit b2971a8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

luabgfx.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -2898,7 +2898,7 @@ next_vb_handle(lua_State *L, int stream, struct vertexbuffer *vb) {
28982898
break;
28992899
case LUA_TUSERDATA:
29002900
vb->handle = 0;
2901-
vb->tb = luaL_checkudata(L, 1, "BGFX_TB");
2901+
vb->tb = luaL_checkudata(L, -1, "BGFX_TB");
29022902
break;
29032903
default:
29042904
luaL_error(L, "Invalid vertex buffer");
@@ -2952,15 +2952,16 @@ ENCODER_API(lsetVertexBuffer) {
29522952
vb.handle = luaL_optinteger(L, lua_base, BGFX_HANDLE_VERTEX_BUFFER | UINT16_MAX);
29532953
vb.tb = NULL;
29542954
}
2955-
start = luaL_optinteger(L, lua_base + 1, 0);
2956-
numv = luaL_optinteger(L, lua_base + 2, UINT32_MAX);
2957-
layout = lua_isnoneornil(L, lua_base + 3) ? NULL : (struct vertex_layout *)lua_touserdata(L, lua_base + 3);
29582955
}
2956+
2957+
start = luaL_optinteger(L, lua_base + 1, 0);
2958+
numv = luaL_optinteger(L, lua_base + 2, UINT32_MAX);
2959+
layout = lua_isnoneornil(L, lua_base + 3) ? NULL : (struct vertex_layout *)lua_touserdata(L, lua_base + 3);
29592960
}
29602961

29612962
do {
29622963
if (vb.tb) {
2963-
BGFX(set_transient_vertex_buffer)(stream, &vb.tb->tvb, start, numv);
2964+
BGFX_ENCODER(set_transient_vertex_buffer, encoder, stream, &vb.tb->tvb, start, numv);
29642965
} else {
29652966
int idtype = vb.handle >> 16;
29662967
int idx = vb.handle & 0xffff;
@@ -3015,7 +3016,7 @@ ENCODER_API(lsetIndexBuffer) {
30153016
BGFX_ENCODER(set_dynamic_index_buffer, encoder, handle, start, end);
30163017
}
30173018
} else {
3018-
BGFX(set_transient_index_buffer)(&tb->tib, start, end);
3019+
BGFX_ENCODER(set_transient_index_buffer, encoder, &tb->tib, start, end);
30193020
}
30203021

30213022
return 0;

0 commit comments

Comments
 (0)