diff --git a/python/taichi/_kernels.py b/python/taichi/_kernels.py index 875081d57fac5..c1a9f48817ca4 100644 --- a/python/taichi/_kernels.py +++ b/python/taichi/_kernels.py @@ -2,6 +2,7 @@ from taichi._lib.utils import get_os_name from taichi.lang import ops from taichi.lang._ndrange import ndrange +from taichi.lang.enums import Format from taichi.lang.expr import Expr from taichi.lang.field import ScalarField from taichi.lang.impl import grouped, static, static_assert @@ -256,8 +257,7 @@ def snode_deactivate_dynamic(b: template()): @kernel def load_texture_from_numpy(tex: texture_type.rw_texture(num_dimensions=2, - num_channels=4, - channel_format=u8, + fmt=Format.rgba8u, lod=0), img: ndarray_type.ndarray(dtype=vec3, ndim=2)): for i, j in img: @@ -269,8 +269,7 @@ def load_texture_from_numpy(tex: texture_type.rw_texture(num_dimensions=2, @kernel def save_texture_to_numpy(tex: texture_type.rw_texture(num_dimensions=2, - num_channels=4, - channel_format=u8, + fmt=Format.rgba8u, lod=0), img: ndarray_type.ndarray(dtype=vec3, ndim=2)): for i, j in img: diff --git a/python/taichi/examples/graph/texture_graph.py b/python/taichi/examples/graph/texture_graph.py index cb30e989189b8..83db737bd7b8b 100644 --- a/python/taichi/examples/graph/texture_graph.py +++ b/python/taichi/examples/graph/texture_graph.py @@ -13,8 +13,7 @@ @ti.kernel def make_texture(tex: ti.types.rw_texture(num_dimensions=2, - num_channels=1, - channel_format=ti.f32, + fmt=ti.Format.r32f, lod=0)): for i, j in ti.ndrange(128, 128): ret = ti.cast(taichi_logo(ti.Vector([i, j]) / 128), ti.f32) diff --git a/python/taichi/examples/rendering/simple_texture.py b/python/taichi/examples/rendering/simple_texture.py index a87acc9648678..5e177a192fe1e 100644 --- a/python/taichi/examples/rendering/simple_texture.py +++ b/python/taichi/examples/rendering/simple_texture.py @@ -13,8 +13,7 @@ @ti.kernel def make_texture(tex: ti.types.rw_texture( - num_dimensions=2, num_channels=1, channel_format=ti.f32, lod=0), n: ti.i32 - ): + num_dimensions=2, fmt=ti.Format.r32f, lod=0), n: ti.i32): for i, j in ti.ndrange(n, n): ret = ti.cast(taichi_logo(ti.Vector([i, j]) / n), ti.f32) tex.store(ti.Vector([i, j]), ti.Vector([ret, 0.0, 0.0, 0.0]))