Mac version of the fix. Not working at the moment.
It needs an implementation for `free_texture` in 4ed_metal_render.mm (like `get_texture_of_dim`, and `fill_texture`). We also need to make sure that the texture (`handle` parameter in get_texture_of_dim and fill_texture) is not zero as the original fix expect 0 to signify "invalid texture". More specifically in `4ed_font_provider_freetyp.cpp` there is `if (texture) { fill the texture }` and in `4ed_font_set.cpp` there is `if ( slot->face->texture != 0 ) { graphics_free_texture(...);}`
This commit is contained in:
parent
9b927bd410
commit
b2bdc515ec
|
@ -976,6 +976,11 @@ graphics_fill_texture_sig(){
|
|||
return(result);
|
||||
}
|
||||
|
||||
function
|
||||
graphics_free_texture_sig(){
|
||||
renderer->free_texture(renderer, texid);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
/******************/
|
||||
|
|
|
@ -44,6 +44,12 @@ mac_fill_texture_sig(mac_metal__fill_texture){
|
|||
return(result);
|
||||
}
|
||||
|
||||
function
|
||||
mac_free_texture_sig(mac_metal__free_texture){
|
||||
Mac_Metal *metal = (Mac_Metal*)renderer;
|
||||
[metal->renderer free_texture:texture];
|
||||
}
|
||||
|
||||
function Mac_Metal*
|
||||
mac_metal__init(NSWindow *window, Render_Target *target){
|
||||
// NOTE(yuval): Create the Mac Metal rendere
|
||||
|
@ -52,6 +58,7 @@ mac_metal__init(NSWindow *window, Render_Target *target){
|
|||
metal->base.render = mac_metal__render;
|
||||
metal->base.get_texture = mac_metal__get_texture;
|
||||
metal->base.fill_texture = mac_metal__fill_texture;
|
||||
metal->base.free_texture = mac_metal__free_texture;
|
||||
|
||||
// NOTE(yuval): Create the Metal view
|
||||
NSView *content_view = [window contentView];
|
||||
|
|
|
@ -144,6 +144,11 @@ mac_fill_texture_sig(mac_gl__fill_texture){
|
|||
return(result);
|
||||
}
|
||||
|
||||
function
|
||||
mac_free_texture_sig(mac_gl__free_texture){
|
||||
gl__free_texture(texture);
|
||||
}
|
||||
|
||||
function Mac_OpenGL*
|
||||
mac_gl__init(NSWindow *window, Render_Target *target){
|
||||
// NOTE(yuval): Create the Mac OpenGL Renderer
|
||||
|
@ -152,6 +157,7 @@ mac_gl__init(NSWindow *window, Render_Target *target){
|
|||
gl->base.render = mac_gl__render;
|
||||
gl->base.get_texture = mac_gl__get_texture;
|
||||
gl->base.fill_texture = mac_gl__fill_texture;
|
||||
gl->base.free_texture = mac_gl__free_texture;
|
||||
|
||||
// NOTE(yuval): Create the OpenGL view
|
||||
NSView *content_view = [window contentView];
|
||||
|
|
|
@ -18,6 +18,9 @@ typedef mac_get_texture_sig(mac_get_texture_type);
|
|||
#define mac_fill_texture_sig(name) b32 name(Mac_Renderer *renderer, Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 dim, void* data)
|
||||
typedef mac_fill_texture_sig(mac_fill_texture_type);
|
||||
|
||||
#define mac_free_texture_sig(name) void name(Mac_Renderer *renderer, u32 texture)
|
||||
typedef mac_free_texture_sig(mac_free_texture_type);
|
||||
|
||||
typedef i32 Mac_Renderer_Kind;
|
||||
enum{
|
||||
MacRenderer_OpenGL,
|
||||
|
@ -31,6 +34,7 @@ struct Mac_Renderer{
|
|||
|
||||
mac_get_texture_type *get_texture;
|
||||
mac_fill_texture_type *fill_texture;
|
||||
mac_free_texture_type *free_texture;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue