Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Wholesome update for wgpu-0.3 #70

Merged
merged 1 commit into from
Aug 22, 2019
Merged

Wholesome update for wgpu-0.3 #70

merged 1 commit into from
Aug 22, 2019

Conversation

kvark
Copy link
Member

@kvark kvark commented Aug 21, 2019

This update is a little more opinionated, i.e. the BGL creation just accepts a slice of things instead of a descriptor. I believe the reason for descriptors in the upstream API is mostly techincal - it's more convenient to generate bindings in Googles giant codegen. Following it verbatim doesn't appear to be strictly necessary, especially if we can extract better usability from Rust features.

The change also disables "gl" feature for the release. We'll re-enable it once we can provide it nicely, it will not be a breaking change.

I also noticed that barriers are not working correctly on the mipmap example. Will investigate separately - the native part is already published anyway. Edit: fixed by gfx-rs/wgpu#302

@kvark kvark requested a review from grovesNL August 21, 2019 13:58
}

#[cfg(not(feature = "gl"))]
pub fn create_surface_from_macos_layer(&self, layer: *mut std::ffi::c_void) -> Surface {
Copy link
Collaborator

@seivan seivan Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being removed? I depend on this since there is no other option to let SDL2 set everything up and just pass you the layer. raw-window-handle doesn't feel fleshed out enough to rely on for now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, we should keep that one

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it too late to give my feedback on the raw-window-handle stuff or is this something decided? It seems very unfinished as an idea, and I do mean just the idea alone sans implementation. rust-windowing/raw-window-handle#14

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can live with NSView/UIView, but the discussion about CAMetalLayer does still need to happen. Thanks for filing the issue!

/// adapter.
///
/// # Panics
///
/// Panics if there are no available adapters. This will occur if none of the graphics backends
/// are enabled.
pub fn get_adapter(&self, options: Option<&RequestAdapterOptions>) -> Adapter {
pub fn request_adapter(&self, options: &RequestAdapterOptions) -> Adapter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you supposed to call request_adapter(None) now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's equivalent to request_adapter(&wgpu::RequestAdapterOptions::default())

Copy link
Contributor

@rukai rukai Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah fair enough.

I guess my only issue is one day when we are using wgpu-rs on the web, we wont be able to access that part of the API, if only for testing different browser implementations, but that seems pretty obscure.

(I would mark this as resolved if I could, I dont seem to have access)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Option thing in WebIDL specification itself is defined to be equivalent of supplying a dictionary with the fields full of default values, so it's not like a browser has freedom to do anything other than this (it would be a bug!).

@@ -554,9 +542,9 @@ impl Adapter {
/// # Panics
///
/// Panics if the extensions specified by `desc` are not supported by this adapter.
pub fn request_device(&self, desc: Option<&DeviceDescriptor>) -> Device {
pub fn request_device(&self, desc: &DeviceDescriptor) -> Device {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you supposed to call request_device(None) now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, by doing request_device(&wgpu::DeviceDescriptor::default())

Cargo.toml Outdated
@@ -20,12 +20,13 @@ metal = ["wgn/gfx-backend-metal"]
dx11 = ["wgn/gfx-backend-dx11"]
dx12 = ["wgn/gfx-backend-dx12"]
vulkan = ["wgn/gfx-backend-vulkan"]
gl = ["wgn/gfx-backend-gl"]
#gl = ["wgn/gfx-backend-gl"]

[dependencies]
#TODO: only depend on the published version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO is actually done now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, will fix that, thanks!

///
/// A `BindGroupLayoutDescriptor` can be passed to [`Device::create_bind_group_layout`] to obtain a
/// [`BindGroupLayout`].
pub struct BindGroupLayoutDescriptor<'a> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one reason the descriptor was useful is because of the inheritance chain (GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase). GPUObjectDescriptorBase has DOMString? label (which we haven't implemented yet), so by accepting a slice here we won't be able to provide debug labels for bind group layouts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha, great point!

@@ -20,12 +20,13 @@ metal = ["wgn/gfx-backend-metal"]
dx11 = ["wgn/gfx-backend-dx11"]
dx12 = ["wgn/gfx-backend-dx12"]
vulkan = ["wgn/gfx-backend-vulkan"]
gl = ["wgn/gfx-backend-gl"]
#gl = ["wgn/gfx-backend-gl"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue for the part that gl is blocked on here? It would probably be useful to clarify it in a comment for anyone using gl patches at the moment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue is that we initialize all other backends without winit feature
for GL, there is currently no way to use it without glutin. Enabling glutin though on the backend would conflict with glutin in wgpu-rs itself, since the backends are from crates.io and they rely on the old glutin version...
This will be unlocked if/when we back-port raw-window-handle to gfx-backend-gl-0.3

@kvark
Copy link
Member Author

kvark commented Aug 22, 2019

I think everything got reviewed and addressed...
bors r=everyone

bors bot added a commit that referenced this pull request Aug 22, 2019
70: Wholesome update for wgpu-0.3 r=everyone a=kvark

~~This update is a little more opinionated, i.e. the BGL creation just accepts a slice of things instead of a descriptor. I believe the reason for descriptors in the upstream API is mostly techincal - it's more convenient to generate bindings in Googles giant codegen. Following it verbatim doesn't appear to be strictly necessary, especially if we can extract better usability from Rust features.~~

The change also disables "gl" feature for the release. We'll re-enable it once we can provide it nicely, it will not be a breaking change.

I also noticed that barriers are not working correctly on the mipmap example. Will investigate separately - the native part is already published anyway. Edit: fixed by gfx-rs/wgpu#302

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
@bors
Copy link
Contributor

bors bot commented Aug 22, 2019

Build succeeded

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants