Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] Remove usage of deprecated num_channels/channel_format type hint in rw_texture in codebase #6791

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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