diff --git a/wgpu/backends/rs.py b/wgpu/backends/rs.py index 4b73662d..636c6c25 100644 --- a/wgpu/backends/rs.py +++ b/wgpu/backends/rs.py @@ -2565,11 +2565,19 @@ def write_texture(self, destination, data, data_layout, size): raise ValueError("copy destination texture must be a texture, not a view") m, address = get_memoryview_and_address(data) - # todo: could we not derive the size from the shape of m? c_data = ffi.cast("uint8_t *", address) data_length = m.nbytes + # We could allow size=None in this method, and derive the size from the data. + # Or compare size with the data size if it is given. However, the data + # could be a bit raw, being 1D and/or the shape expressed in bytes, so + # this gets a bit muddy. Also methods like copy_buffer_to_texture have the + # same size arg, so let's just leave it like this. + # + # data_size = list(reversed(m.shape)) + [1, 1, 1] + # data_size = data_size[:3] + size = _tuple_from_tuple_or_dict( size, ("width", "height", "depth_or_array_layers") ) diff --git a/wgpu/gui/_offscreen.py b/wgpu/gui/_offscreen.py index 1dc93cc5..894a9963 100644 --- a/wgpu/gui/_offscreen.py +++ b/wgpu/gui/_offscreen.py @@ -66,7 +66,8 @@ def get_preferred_format(self, adapter): def get_current_texture(self): self._create_new_texture_if_needed() - # todo: we return a view here, to align with the rs implementation, even though its wrong. + # Technically a texture view, even though WebGPU says it must be a texture. + # Anyway, this API will change in a next version anyway. return self._texture_view def present(self):