Add support for partial GPU texture updates
Mainly used for font atlas changes. Each glyph allocation now only triggers a partial texture update instead of creating a full new texture.
This commit is contained in:
1 parent
e3288b96ac
commit
e90396ff28
7 files changed
+326
-162
No files matched your search
@@ -201,6 +201,7 @@ unsafe extern "C-unwind" fn image_handle_load(state: *mut ffi::lua_State) -> c_i
|
||||
|
||||
// Flags
|
||||
let mut is_async = false;
|
||||
let mut generate_mipmaps = false;
|
||||
let mut options = TextureOptions::LINEAR_REPEAT;
|
||||
|
||||
let nargs = unsafe { ffi::lua_gettop(state) };
|
||||
@@ -230,7 +231,7 @@ unsafe extern "C-unwind" fn image_handle_load(state: *mut ffi::lua_State) -> c_i
|
||||
is_async = true;
|
||||
}
|
||||
b"MIPMAP" => {
|
||||
options.generate_mipmaps = true;
|
||||
generate_mipmaps = true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -250,13 +251,14 @@ unsafe extern "C-unwind" fn image_handle_load(state: *mut ffi::lua_State) -> c_i
|
||||
path,
|
||||
options,
|
||||
is_async,
|
||||
generate_mipmaps,
|
||||
);
|
||||
}
|
||||
None => {
|
||||
if let Ok(texture_handle) = ctx
|
||||
.texture_manager
|
||||
.borrow()
|
||||
.load_texture(path, options, is_async)
|
||||
if let Ok(texture_handle) =
|
||||
ctx.texture_manager
|
||||
.borrow()
|
||||
.load_texture(path, options, is_async, generate_mipmaps)
|
||||
{
|
||||
handle.texture = Some(texture_handle);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user