mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
Revert "vulkan: work around Arm drivers ignoring negative viewport heights" (#10674)
This commit is contained in:
1 parent
05ae83af5e
commit
6511b8f2da
4 files changed
+16
-71
No files matched your search
@@ -266,7 +266,6 @@ By @sagudev in [#10307](https://github.com/gfx-rs/wgpu/pull/10307).
|
||||
#### Vulkan
|
||||
|
||||
- Fix `HalCounters::textures` drifting negative: `create_texture` never incremented it while `destroy_texture` always decremented it. By @dustyleary in [#10022](https://github.com/gfx-rs/wgpu/pull/10022).
|
||||
- Work around Arm proprietary drivers ignoring negative viewport heights, which flipped every render pass vertically. On these drivers, Y is now flipped in the vertex shader. By @lexoliu in [#10058](https://github.com/gfx-rs/wgpu/pull/10058).
|
||||
- Fix `VUID-VkImageViewCreateInfo-image-04441` validation errors when creating a view of a texture whose only usages are `COPY_SRC` and/or `COPY_DST`. By @MannXo in [#10200](https://github.com/gfx-rs/wgpu/issues/10200).
|
||||
- Add OpenHarmony surface support via `VK_OHOS_surface`. Previously the Vulkan backend could not create a surface on OpenHarmony, leaving GLES as the only usable backend. By @ozongzi in [#9908](https://github.com/gfx-rs/wgpu/pull/9908).
|
||||
- Fix crash on older Vulkan drivers when `poolSizeCount == 0`. By @lucasmerlin in [#10124](https://github.com/gfx-rs/wgpu/pull/10124).
|
||||
|
||||
@@ -2387,13 +2387,6 @@ impl super::Instance {
|
||||
super::Workarounds::FORCE_FILL_BUFFER_WITH_SIZE_GREATER_4096_ALIGNED_OFFSET_16,
|
||||
phd_capabilities.properties.vendor_id == db::nvidia::VENDOR,
|
||||
);
|
||||
workarounds.set(
|
||||
super::Workarounds::IGNORED_NEGATIVE_VIEWPORT_HEIGHT,
|
||||
phd_capabilities
|
||||
.driver
|
||||
.as_ref()
|
||||
.is_some_and(|driver| driver.driver_id == vk::DriverId::ARM_PROPRIETARY),
|
||||
);
|
||||
};
|
||||
|
||||
if let Some(driver) = phd_capabilities.driver {
|
||||
@@ -2890,11 +2883,6 @@ impl super::Adapter {
|
||||
spv::WriterFlags::LABEL_VARYINGS,
|
||||
self.phd_capabilities.properties.vendor_id != crate::auxil::db::qualcomm::VENDOR,
|
||||
);
|
||||
flags.set(
|
||||
spv::WriterFlags::ADJUST_COORDINATE_SPACE,
|
||||
self.workarounds
|
||||
.contains(super::Workarounds::IGNORED_NEGATIVE_VIEWPORT_HEIGHT),
|
||||
);
|
||||
flags.set(
|
||||
spv::WriterFlags::FORCE_POINT_SIZE,
|
||||
//Note: we could technically disable this when we are compiling separate entry points,
|
||||
|
||||
@@ -902,31 +902,14 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
||||
height: desc.extent.height,
|
||||
},
|
||||
};
|
||||
let vk_viewports = if self
|
||||
.device
|
||||
.workarounds
|
||||
.contains(super::Workarounds::IGNORED_NEGATIVE_VIEWPORT_HEIGHT)
|
||||
{
|
||||
// The Y-flip happens in the vertex shader epilogue instead; see the
|
||||
// workaround's documentation.
|
||||
[vk::Viewport {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
width: desc.extent.width as f32,
|
||||
height: desc.extent.height as f32,
|
||||
min_depth: 0.0,
|
||||
max_depth: 1.0,
|
||||
}]
|
||||
} else {
|
||||
[vk::Viewport {
|
||||
x: 0.0,
|
||||
y: desc.extent.height as f32,
|
||||
width: desc.extent.width as f32,
|
||||
height: -(desc.extent.height as f32),
|
||||
min_depth: 0.0,
|
||||
max_depth: 1.0,
|
||||
}]
|
||||
};
|
||||
let vk_viewports = [vk::Viewport {
|
||||
x: 0.0,
|
||||
y: desc.extent.height as f32,
|
||||
width: desc.extent.width as f32,
|
||||
height: -(desc.extent.height as f32),
|
||||
min_depth: 0.0,
|
||||
max_depth: 1.0,
|
||||
}];
|
||||
|
||||
let raw_pass = self.device.make_render_pass(rp_key).unwrap();
|
||||
fb_key.raw_pass = raw_pass;
|
||||
@@ -1084,31 +1067,14 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
||||
};
|
||||
}
|
||||
unsafe fn set_viewport(&mut self, rect: &crate::Rect<f32>, depth_range: Range<f32>) {
|
||||
let vk_viewports = if self
|
||||
.device
|
||||
.workarounds
|
||||
.contains(super::Workarounds::IGNORED_NEGATIVE_VIEWPORT_HEIGHT)
|
||||
{
|
||||
// The Y-flip happens in the vertex shader epilogue instead; see the
|
||||
// workaround's documentation.
|
||||
[vk::Viewport {
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
width: rect.w,
|
||||
height: rect.h,
|
||||
min_depth: depth_range.start,
|
||||
max_depth: depth_range.end,
|
||||
}]
|
||||
} else {
|
||||
[vk::Viewport {
|
||||
x: rect.x,
|
||||
y: rect.y + rect.h,
|
||||
width: rect.w,
|
||||
height: -rect.h, // flip Y
|
||||
min_depth: depth_range.start,
|
||||
max_depth: depth_range.end,
|
||||
}]
|
||||
};
|
||||
let vk_viewports = [vk::Viewport {
|
||||
x: rect.x,
|
||||
y: rect.y + rect.h,
|
||||
width: rect.w,
|
||||
height: -rect.h, // flip Y
|
||||
min_depth: depth_range.start,
|
||||
max_depth: depth_range.end,
|
||||
}];
|
||||
unsafe {
|
||||
self.device
|
||||
.raw
|
||||
|
||||
@@ -559,14 +559,6 @@ bitflags::bitflags!(
|
||||
/// As such, we need to make sure all calls to vkCmdFillBuffer are aligned to 16 bytes
|
||||
/// if they cover a range of 4096 bytes or more.
|
||||
const FORCE_FILL_BUFFER_WITH_SIZE_GREATER_4096_ALIGNED_OFFSET_16 = 0x4;
|
||||
/// Arm's proprietary driver (observed on r54p2, Mali-G715 / Pixel 9 Pro,
|
||||
/// Android 16) ignores negative viewport heights, so it does not do the
|
||||
/// Y-flip that maps WebGPU clip space to Vulkan's.
|
||||
///
|
||||
/// We flip Y in the vertex shader and use positive-height viewports instead.
|
||||
/// This gives the same framebuffer coordinates, so facing does not change.
|
||||
/// SPIR-V passthrough shaders do not get this flip.
|
||||
const IGNORED_NEGATIVE_VIEWPORT_HEIGHT = 0x8;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user