Fix potential crash when creating textures;

beginFrame needs to be called a little bit earlier (before getting the
buffer to write the texture contents).
This commit is contained in:
bjorn 2023-03-09 18:36:23 -08:00
parent 6d382c2f0c
commit b33cc99374
1 changed files with 2 additions and 2 deletions

View File

@ -1255,6 +1255,8 @@ Texture* lovrTextureCreate(const TextureInfo* info) {
uint32_t levelSizes[16];
gpu_buffer* scratchpad = NULL;
beginFrame();
if (info->imageCount > 0) {
levelCount = lovrImageGetLevelCount(info->images[0]);
lovrCheck(info->type != TEXTURE_3D || levelCount == 1, "Images used to initialize 3D textures can not have mipmaps");
@ -1284,8 +1286,6 @@ Texture* lovrTextureCreate(const TextureInfo* info) {
}
}
beginFrame();
gpu_texture_init(texture->gpu, &(gpu_texture_info) {
.type = (gpu_texture_type) info->type,
.format = (gpu_texture_format) info->format,