Enforce copy buffer-texture row pitch alignment

This commit is contained in:
Dzmitry Malyshau committed 2020-06-01 16:51:42 -04:00
1 parent 3a6cdeec94
commit 321a5cee0f
7 files changed
+114 -46

No files matched your search

+2 -7
View File
@@ -307,7 +307,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let hub = B::hub(self);
let mut token = Token::root();
let (adapter_guard, mut token) = hub.adapters.read(&mut token);
let (device_guard, mut token) = hub.devices.read(&mut token);
let (mut cmb_guard, mut token) = hub.command_buffers.write(&mut token);
@@ -371,13 +370,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
};
let (context, sample_count) = {
use hal::{adapter::PhysicalDevice as _, device::Device as _};
use hal::device::Device as _;
let limits = adapter_guard[device.adapter_id.value]
.raw
.physical_device
.limits();
let samples_count_limit = limits.framebuffer_color_sample_counts;
let samples_count_limit = device.hal_limits.framebuffer_color_sample_counts;
let base_trackers = &cmb.trackers;
let mut extent = None;
+10 -8
View File
@@ -199,14 +199,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.surface_desc()
.bits as u32
/ BITS_PER_BYTE;
let buffer_width = source.layout.bytes_per_row / bytes_per_texel;
assert_eq!(wgt::COPY_BYTES_PER_ROW_ALIGNMENT % bytes_per_texel, 0);
assert_eq!(
source.layout.bytes_per_row % bytes_per_texel,
source.layout.bytes_per_row % wgt::COPY_BYTES_PER_ROW_ALIGNMENT,
0,
"Source bytes per row ({}) must be a multiple of bytes per texel ({})",
"Source bytes per row ({}) must be a multiple of {}",
source.layout.bytes_per_row,
bytes_per_texel
wgt::COPY_BYTES_PER_ROW_ALIGNMENT
);
let buffer_width = source.layout.bytes_per_row / bytes_per_texel;
let region = hal::command::BufferImageCopy {
buffer_offset: source.layout.offset,
buffer_width,
@@ -286,14 +287,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.surface_desc()
.bits as u32
/ BITS_PER_BYTE;
let buffer_width = destination.layout.bytes_per_row / bytes_per_texel;
assert_eq!(wgt::COPY_BYTES_PER_ROW_ALIGNMENT % bytes_per_texel, 0);
assert_eq!(
destination.layout.bytes_per_row % bytes_per_texel,
destination.layout.bytes_per_row % wgt::COPY_BYTES_PER_ROW_ALIGNMENT,
0,
"Destination bytes per row ({}) must be a multiple of bytes per texel ({})",
"Destination bytes per row ({}) must be a multiple of {}",
destination.layout.bytes_per_row,
bytes_per_texel
wgt::COPY_BYTES_PER_ROW_ALIGNMENT
);
let buffer_width = destination.layout.bytes_per_row / bytes_per_texel;
let region = hal::command::BufferImageCopy {
buffer_offset: destination.layout.offset,
buffer_width,