mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Add new texel buffer type.
GLSL 3+ shaders can read from texel buffers by declaring a uniform samplerBuffer variable and calling texelFetch with a 0-based index, in the shader code. All attributes in a texel buffer's format array must have the same data format (e.g. all 'floatvec4' formats). Shader:send accepts a texel Buffer for samplerBuffer uniforms. Added 'texelbuffer' to love.graphics.getSupported (requires GLSL 3+ and desktop OpenGL). Added 'texelbuffersize' to love.graphics.getSystemLimits. Returns the max number of values in a texel buffer (array length multiplied by the number of attributes declared in the buffer's format array).
This commit is contained in:
@@ -315,7 +315,7 @@ static int w_Buffer_setElement(lua_State *L)
|
||||
|
||||
size_t index = (size_t) (luaL_checkinteger(L, 2) - 1);
|
||||
if (index >= t->getArrayLength())
|
||||
return luaL_error(L, "Invalid Buffer element index: %ld", index);
|
||||
return luaL_error(L, "Invalid Buffer element index: %d", (int) index + 1);
|
||||
|
||||
size_t stride = t->getArrayStride();
|
||||
size_t offset = index * stride;
|
||||
@@ -361,7 +361,7 @@ static int w_Buffer_getElement(lua_State *L)
|
||||
|
||||
size_t index = (size_t) (luaL_checkinteger(L, 2) - 1);
|
||||
if (index >= t->getArrayLength())
|
||||
return luaL_error(L, "Invalid Buffer element index: %ld", index);
|
||||
return luaL_error(L, "Invalid Buffer element index: %d", (int) index + 1);
|
||||
|
||||
size_t offset = index * t->getArrayStride();
|
||||
const char *data = (const char *) t->map() + offset;
|
||||
|
||||
Reference in New Issue
Block a user