Skip to content

Commit

Permalink
[misc] Remove usage of deprecated num_channels/channel_format type hi…
Browse files Browse the repository at this point in the history
…nt in rw_texture in codebase (#6791)
  • Loading branch information
ailzhang authored Dec 2, 2022
1 parent 5c3afe1 commit 8bd91a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions python/taichi/_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions python/taichi/examples/graph/texture_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions python/taichi/examples/rendering/simple_texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down

0 comments on commit 8bd91a7

Please sign in to comment.