-
I configured surface with wgpu::TextureUsages::COPY_DST. let config = wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_DST,
format: surface.get_preferred_format(&adapter).unwrap(),
width: size.width,
height: size.height,
present_mode: wgpu::PresentMode::Fifo,
};
surface.configure(&device, &config) I want to copy pixel data directly to this surface via Queue::write_texture(). let output = self.surface.get_current_texture()?;
self.queue.write_texture(output.texture.as_image_copy(), &data, wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: NonZeroU32::new(self.config.width * 4),
rows_per_image: NonZeroU32::new(self.config.height.into()),
}, wgpu::Extent3d{width: self.config.width, height: self.config.height, depth_or_array_layers: 1});
self.queue.submit(std::iter::empty()); // wgpu document says copy begins when next Queue::submit() get called
output.present();
Ok(()) Vulkan validation layer complains about it:
I know it's problematic somehow: I didn't specify image format (RGBA8 for example). Is surface texture not expected to be used in this way? or I did something wrong. where can I find answers to questions like this one? |
Beta Was this translation helpful? Give feedback.
Answered by
kvark
Jan 12, 2022
Replies: 1 comment
-
The surface textures weren't expected to be used like this for a long while. We only opened this up recently, and you found a bug. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
zxz149res
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The surface textures weren't expected to be used like this for a long while. We only opened this up recently, and you found a bug.