-/* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */
+/* Copyright (C) 2021-2023 Harry Godden (hgn) - All Rights Reserved
+ *
+ * A portion of this file is copied and altered from the QOI projects' source,
+ * Originally written by Dominic Szablewski. It is slightly modified.
+ * For the original unaltered QOI header, you can find it here:
+ * https://github.com/phoboslab/qoi/blob/master/qoi.h
+ *
+ * Copyright (C) 2021, Dominic Szablewski
+ * SPDX-License-Identifier: MIT
+ *
+ * MIT License
+ Copyright (c) 2022 Dominic Szablewski - https://phoboslab.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
#ifndef VG_TEX_H
#define VG_TEX_H
#include "vg/vg.h"
#include "vg/vg_log.h"
+#define STB_IMAGE_WRITE_IMPLEMENTATION
+#include "vg/submodules/stb/stb_image_write.h"
+
+/* its a sad day. */
+#if 0
+#define STBI_MALLOC(X)
+#define STBI_REALLOC(X,Y)
+#define STBI_FREE(X)
+#endif
+
+#define STBI_ONLY_JPEG
+#define STB_IMAGE_IMPLEMENTATION
+#include "vg/submodules/stb/stb_image.h"
+
struct vg_sprite
{
v4f uv_xywh;
static u8 const_vg_tex2d_err[] =
{
+ 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0x00, 0xff,
- 0xff, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0x00, 0xff
};
VG_STATIC void async_vg_tex2d_upload( void *payload, u32 size )
{
+ if( vg_thread_purpose() != k_thread_purpose_main ){
+ vg_fatal_error( "Catastrophic programming error.\n" );
+ }
+
struct texture_load_info *info = payload;
glGenTextures( 1, info->dest );