From 211e3ef0f81247f8cd77ef62ebfb5e8f37617ec5 Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 1 May 2022 15:18:56 -0700 Subject: [PATCH] Compile fixes; --- src/api/l_graphics.c | 1 - src/api/l_graphics_texture.c | 4 ++++ src/modules/graphics/graphics.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/l_graphics.c b/src/api/l_graphics.c index 2f460702..143bd854 100644 --- a/src/api/l_graphics.c +++ b/src/api/l_graphics.c @@ -620,7 +620,6 @@ static int l_lovrGraphicsNewTexture(lua_State* L) { if (info.imageCount > 0) { info.images = images; Image* image = images[0]; - uint32_t layers = lovrImageGetLayerCount(image); uint32_t levels = lovrImageGetLevelCount(image); info.format = lovrImageGetFormat(image); info.width = lovrImageGetWidth(image); diff --git a/src/api/l_graphics_texture.c b/src/api/l_graphics_texture.c index d0061f7a..e6fd5ebd 100644 --- a/src/api/l_graphics_texture.c +++ b/src/api/l_graphics_texture.c @@ -105,6 +105,9 @@ static int l_lovrTextureHasUsage(lua_State* L) { } const luaL_Reg lovrTexture[] = { + { "newView", l_lovrTextureNewView }, + { "isView", l_lovrTextureIsView }, + { "getParent", l_lovrTextureGetParent }, { "getType", l_lovrTextureGetType }, { "getFormat", l_lovrTextureGetFormat }, { "getWidth", l_lovrTextureGetWidth }, @@ -113,5 +116,6 @@ const luaL_Reg lovrTexture[] = { { "getDimensions", l_lovrTextureGetDimensions }, { "getMipmapCount", l_lovrTextureGetMipmapCount }, { "getSampleCount", l_lovrTextureGetSampleCount }, + { "hasUsage ", l_lovrTextureHasUsage }, { NULL, NULL } }; diff --git a/src/modules/graphics/graphics.c b/src/modules/graphics/graphics.c index 8303f82b..9de8e1f6 100644 --- a/src/modules/graphics/graphics.c +++ b/src/modules/graphics/graphics.c @@ -331,7 +331,7 @@ Texture* lovrTextureCreate(TextureInfo* info) { uint32_t levelCount = 0; uint32_t levelOffsets[16]; uint32_t levelSizes[16]; - gpu_buffer* scratchpad; + gpu_buffer* scratchpad = NULL; if (info->imageCount > 0) { levelCount = lovrImageGetLevelCount(info->images[0]); @@ -355,7 +355,7 @@ Texture* lovrTextureCreate(TextureInfo* info) { uint32_t slice = info->imageCount == 1 ? layer : 0; uint32_t size = lovrImageGetLayerSize(image, level); lovrCheck(size == levelSizes[level], "Texture/Image size mismatch!"); - void* pixels = lovrImageGetLayerData(image, level, layer); + void* pixels = lovrImageGetLayerData(image, level, slice); memcpy(data, pixels, size); data += size; }