Skip to content

Commit

Permalink
Fix Queue::write_texture, Fix DX12 write_texture_subset_2d and re-ena…
Browse files Browse the repository at this point in the history
…ble the test. (#4990)
  • Loading branch information
dtzxporter authored Jan 5, 2024
1 parent 31d50af commit 00cf05c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ Passing an owned value `window` to `Surface` will return a `Surface<'static>`. S
- Align `wgpu_types::CompositeAlphaMode` serde serialization to spec. By @littledivy in [#4940](https://github.com/gfx-rs/wgpu/pull/4940)
- Fix error message of `ConfigureSurfaceError::TooLarge`. By @Dinnerbone in [#4960](https://github.com/gfx-rs/wgpu/pull/4960)

#### DX12

- Fixed D3D12_SUBRESOURCE_FOOTPRINT calculation for block compressed textures which caused a crash with `Queue::write_texture` on DX12. By @DTZxPorter in [#4990](https://github.com/gfx-rs/wgpu/pull/4990)

#### Vulkan

- Use `VK_EXT_robustness2` only when not using an outdated intel iGPU driver. By @TheoDulka in [#4602](https://github.com/gfx-rs/wgpu/pull/4602).
Expand Down
13 changes: 3 additions & 10 deletions tests/tests/write_texture.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
//! Tests for texture copy
use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, TestParameters};
use wgpu_test::{gpu_test, GpuTestConfiguration};

#[gpu_test]
static WRITE_TEXTURE_SUBSET_2D: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
// This just totally removes the device due to invalid api call.
//
// https://github.com/gfx-rs/wgpu/issues/3072
.expect_fail(FailureCase::backend(wgpu::Backends::DX12)),
)
.run_sync(|ctx| {
static WRITE_TEXTURE_SUBSET_2D: GpuTestConfiguration =
GpuTestConfiguration::new().run_sync(|ctx| {
let size = 256;

let tex = ctx.device.create_texture(&wgpu::TextureDescriptor {
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
// doesn't really matter because we need this only if we copy
// more than one layer, and then we validate for this being not
// None
size.height,
height_blocks,
);

let block_size = dst
Expand Down
7 changes: 2 additions & 5 deletions wgpu-hal/src/dx12/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl crate::BufferTextureCopy {
&self,
format: wgt::TextureFormat,
) -> d3d12_ty::D3D12_PLACED_SUBRESOURCE_FOOTPRINT {
let (block_width, block_height) = format.block_dimensions();
let (block_width, _) = format.block_dimensions();
d3d12_ty::D3D12_PLACED_SUBRESOURCE_FOOTPRINT {
Offset: self.buffer_layout.offset,
Footprint: d3d12_ty::D3D12_SUBRESOURCE_FOOTPRINT {
Expand All @@ -30,10 +30,7 @@ impl crate::BufferTextureCopy {
)
.unwrap(),
Width: self.size.width,
Height: self
.buffer_layout
.rows_per_image
.map_or(self.size.height, |count| count * block_height),
Height: self.size.height,
Depth: self.size.depth,
RowPitch: {
let actual = self.buffer_layout.bytes_per_row.unwrap_or_else(|| {
Expand Down

0 comments on commit 00cf05c

Please sign in to comment.