Skip to content

Commit 4f24c31

Browse files
authored
Fixes for Skybox and All Examples (#4780)
1 parent 2964eed commit 4f24c31

File tree

26 files changed

+153
-56
lines changed

26 files changed

+153
-56
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Bottom level categories:
4444

4545
This adds a way to allow a Vulkan driver which is non-compliant per VK_KHR_driver_properties to be enumerated. This is intended for testing new Vulkan drivers which are not Vulkan compliant yet.
4646

47+
### `DeviceExt::create_texture_with_data` Allows Mip-Major Data
48+
49+
Previously, `DeviceExt::create_texture_with_data` only allowed data to be provided in layer major order. There is now a `order` parameter which allows you to specify if the data is in layer major or mip major order.
50+
4751
### New Features
4852

4953
#### General

Cargo.lock

Lines changed: 10 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ cfg_aliases = "0.1"
7777
cfg-if = "1"
7878
codespan-reporting = "0.11"
7979
ctor = "0.2"
80-
ddsfile = "0.5.2"
8180
encase = "0.6"
8281
env_logger = "0.10"
8382
fern = "0.6"
@@ -88,6 +87,7 @@ getrandom = "0.2"
8887
glam = "0.24.2"
8988
heck = "0.4.0"
9089
image = { version = "0.24", default-features = false, features = ["png"] }
90+
ktx2 = "0.3"
9191
# libloading 0.8 switches from `winapi` to `windows-sys`; permit either
9292
libloading = ">=0.7, <0.9"
9393
libc = "0.2"

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ test = false
2222
[dependencies]
2323
bytemuck.workspace = true
2424
cfg-if.workspace = true
25-
ddsfile.workspace = true
2625
encase = { workspace = true, features = ["glam"] }
2726
flume.workspace = true
2827
getrandom.workspace = true
2928
glam.workspace = true
29+
ktx2.workspace = true
3030
log.workspace = true
3131
nanorand.workspace = true
3232
noise.workspace = true

examples/src/framework.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use wgpu::{Instance, Surface};
44
use winit::{
55
dpi::PhysicalSize,
66
event::{Event, KeyEvent, StartCause, WindowEvent},
7-
event_loop::{ControlFlow, EventLoop, EventLoopWindowTarget},
7+
event_loop::{EventLoop, EventLoopWindowTarget},
88
keyboard::{Key, NamedKey},
99
window::Window,
1010
};
@@ -218,7 +218,17 @@ impl SurfaceWrapper {
218218

219219
match surface.get_current_texture() {
220220
Ok(frame) => frame,
221-
Err(_) => {
221+
// If we timed out, just try again
222+
Err(wgpu::SurfaceError::Timeout) => surface
223+
.get_current_texture()
224+
.expect("Failed to acquire next surface texture!"),
225+
Err(
226+
// If the surface is outdated, or was lost, reconfigure it.
227+
wgpu::SurfaceError::Outdated
228+
| wgpu::SurfaceError::Lost
229+
// If OutOfMemory happens, reconfiguring may not help, but we might as well try
230+
| wgpu::SurfaceError::OutOfMemory,
231+
) => {
222232
surface.configure(&context.device, self.config());
223233
surface
224234
.get_current_texture()
@@ -380,9 +390,6 @@ async fn start<E: Example>(title: &str) {
380390
let _ = (event_loop_function)(
381391
window_loop.event_loop,
382392
move |event: Event<()>, target: &EventLoopWindowTarget<()>| {
383-
// We set to refresh as fast as possible.
384-
target.set_control_flow(ControlFlow::Poll);
385-
386393
match event {
387394
ref e if SurfaceWrapper::start_condition(e) => {
388395
surface.resume(&context, window_loop.window.clone(), E::SRGB);
485 KB
Loading
-128 KB
Binary file not shown.
513 KB
Binary file not shown.

examples/src/skybox/images/bc1.dds

-64.2 KB
Binary file not shown.
513 KB
Binary file not shown.

0 commit comments

Comments
 (0)