projects
/
vg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vg_msg api change
[vg.git]
/
vg_tex.h
diff --git
a/vg_tex.h
b/vg_tex.h
index 1fd2d5a29cf293306ffa4c0bb19e19c17bf947e9..7b2142c371bc62d654c1db9e6b2b6020d822c738 100644
(file)
--- a/
vg_tex.h
+++ b/
vg_tex.h
@@
-40,6
+40,18
@@
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "vg/submodules/stb/stb_image_write.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 STBI_NO_THREAD_LOCALS
+#define STB_IMAGE_IMPLEMENTATION
+#include "vg/submodules/stb/stb_image.h"
+
struct vg_sprite
{
v4f uv_xywh;
struct vg_sprite
{
v4f uv_xywh;
@@
-114,8
+126,12
@@
struct texture_load_info{
u8 *rgba;
};
u8 *rgba;
};
-
VG_STATIC
void async_vg_tex2d_upload( void *payload, u32 size )
+
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 );
struct texture_load_info *info = payload;
glGenTextures( 1, info->dest );
@@
-154,7
+170,7
@@
VG_STATIC void async_vg_tex2d_upload( void *payload, u32 size )
}
}
}
}
-
VG_STATIC
void vg_tex2d_replace_with_error( GLuint *dest )
+
static
void vg_tex2d_replace_with_error( GLuint *dest )
{
u32 hdr_size = vg_align8(sizeof(struct texture_load_info));
{
u32 hdr_size = vg_align8(sizeof(struct texture_load_info));
@@
-170,7
+186,7
@@
VG_STATIC void vg_tex2d_replace_with_error( GLuint *dest )
vg_async_dispatch( call, async_vg_tex2d_upload );
}
vg_async_dispatch( call, async_vg_tex2d_upload );
}
-VG_STATIC
+static
void vg_tex2d_load_qoi_async( const u8 *bytes, u32 size,
u32 flags, GLuint *dest )
{
void vg_tex2d_load_qoi_async( const u8 *bytes, u32 size,
u32 flags, GLuint *dest )
{
@@
-304,7
+320,7
@@
void vg_tex2d_load_qoi_async( const u8 *bytes, u32 size,
vg_async_dispatch( call, async_vg_tex2d_upload );
}
vg_async_dispatch( call, async_vg_tex2d_upload );
}
-VG_STATIC
+static
void vg_tex2d_load_qoi_async_file( const char *path, u32 flags, GLuint *dest )
{
vg_linear_clear( vg_mem.scratch );
void vg_tex2d_load_qoi_async_file( const char *path, u32 flags, GLuint *dest )
{
vg_linear_clear( vg_mem.scratch );