mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-21 11:22:42 +00:00
[rs] Merge #829
829: Add Downlevel Infrastructure r=kvark a=cwfitzgerald wgpu-rs frontend for https://github.com/gfx-rs/wgpu/pull/1297. Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This commit is contained in:
commit
3b8da5d6c2
@ -28,20 +28,20 @@ cross = ["wgc/cross"]
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "41f106d7fc8e2ca49b21aed0919fa6cc67317f7f"
|
||||
rev = "45f890c11c6b1251e269afa5bfdd681d409c9202"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "41f106d7fc8e2ca49b21aed0919fa6cc67317f7f"
|
||||
rev = "45f890c11c6b1251e269afa5bfdd681d409c9202"
|
||||
features = ["raw-window-handle"]
|
||||
optional = true
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "41f106d7fc8e2ca49b21aed0919fa6cc67317f7f"
|
||||
rev = "45f890c11c6b1251e269afa5bfdd681d409c9202"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
@ -1,10 +1,11 @@
|
||||
use crate::{
|
||||
backend::{error::ContextError, native_gpu_future},
|
||||
AdapterInfo, BindGroupDescriptor, BindGroupLayoutDescriptor, BindingResource,
|
||||
CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor, Features, Label,
|
||||
Limits, LoadOp, MapMode, Operations, PipelineLayoutDescriptor, RenderBundleEncoderDescriptor,
|
||||
RenderPipelineDescriptor, SamplerDescriptor, ShaderModuleDescriptor, ShaderSource,
|
||||
SwapChainStatus, TextureDescriptor, TextureFormat, TextureViewDescriptor,
|
||||
CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor,
|
||||
DownlevelProperties, Features, Label, Limits, LoadOp, MapMode, Operations,
|
||||
PipelineLayoutDescriptor, RenderBundleEncoderDescriptor, RenderPipelineDescriptor,
|
||||
SamplerDescriptor, ShaderModuleDescriptor, ShaderSource, SwapChainStatus, TextureDescriptor,
|
||||
TextureFormat, TextureViewDescriptor,
|
||||
};
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
@ -731,6 +732,14 @@ impl crate::Context for Context {
|
||||
}
|
||||
}
|
||||
|
||||
fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> DownlevelProperties {
|
||||
let global = &self.0;
|
||||
match wgc::gfx_select!(*adapter => global.adapter_downlevel_properties(*adapter)) {
|
||||
Ok(downlevel) => downlevel,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::downlevel_properties"),
|
||||
}
|
||||
}
|
||||
|
||||
fn adapter_get_info(&self, adapter: &wgc::id::AdapterId) -> AdapterInfo {
|
||||
let global = &self.0;
|
||||
match wgc::gfx_select!(*adapter => global.adapter_get_info(*adapter)) {
|
||||
@ -768,6 +777,14 @@ impl crate::Context for Context {
|
||||
}
|
||||
}
|
||||
|
||||
fn device_downlevel_properties(&self, device: &Self::DeviceId) -> DownlevelProperties {
|
||||
let global = &self.0;
|
||||
match wgc::gfx_select!(device.id => global.device_downlevel_properties(device.id)) {
|
||||
Ok(limits) => limits,
|
||||
Err(err) => self.handle_error_fatal(err, "Device::downlevel_properties"),
|
||||
}
|
||||
}
|
||||
|
||||
fn device_create_swap_chain(
|
||||
&self,
|
||||
device: &Self::DeviceId,
|
||||
|
@ -1080,6 +1080,11 @@ impl crate::Context for Context {
|
||||
}
|
||||
}
|
||||
|
||||
fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> wgt::DownlevelProperties {
|
||||
// WebGPU is assumed to be fully compliant
|
||||
wgt::DownlevelProperties::default()
|
||||
}
|
||||
|
||||
fn adapter_get_info(&self, _adapter: &Self::AdapterId) -> wgt::AdapterInfo {
|
||||
// TODO: web-sys has no way of getting information on adapters
|
||||
wgt::AdapterInfo {
|
||||
@ -1109,6 +1114,11 @@ impl crate::Context for Context {
|
||||
wgt::Limits::default()
|
||||
}
|
||||
|
||||
fn device_downlevel_properties(&self, _device: &Self::DeviceId) -> wgt::DownlevelProperties {
|
||||
// WebGPU is assumed to be fully compliant
|
||||
wgt::DownlevelProperties::default()
|
||||
}
|
||||
|
||||
fn device_create_swap_chain(
|
||||
&self,
|
||||
device: &Self::DeviceId,
|
||||
|
@ -28,15 +28,16 @@ pub use wgt::{
|
||||
AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType,
|
||||
BlendComponent, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType,
|
||||
BufferSize, BufferUsage, Color, ColorTargetState, ColorWrite, CommandBufferDescriptor,
|
||||
CompareFunction, DepthBiasState, DepthStencilState, DeviceType, DynamicOffset, Extent3d, Face,
|
||||
Features, FilterMode, FrontFace, ImageDataLayout, IndexFormat, InputStepMode, Limits,
|
||||
MultisampleState, Origin3d, PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode,
|
||||
PrimitiveState, PrimitiveTopology, PushConstantRange, QuerySetDescriptor, QueryType,
|
||||
SamplerBorderColor, ShaderFlags, ShaderLocation, ShaderStage, StencilFaceState,
|
||||
StencilOperation, StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus,
|
||||
TextureAspect, TextureDimension, TextureFormat, TextureFormatFeatureFlags,
|
||||
TextureFormatFeatures, TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute,
|
||||
VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
CompareFunction, DepthBiasState, DepthStencilState, DeviceType, DownlevelFlags,
|
||||
DownlevelProperties, DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace,
|
||||
ImageDataLayout, IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d,
|
||||
PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode, PrimitiveState,
|
||||
PrimitiveTopology, PushConstantRange, QuerySetDescriptor, QueryType, SamplerBorderColor,
|
||||
ShaderFlags, ShaderLocation, ShaderModel, ShaderStage, StencilFaceState, StencilOperation,
|
||||
StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, TextureAspect,
|
||||
TextureDimension, TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures,
|
||||
TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute, VertexFormat,
|
||||
BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
PUSH_CONSTANT_ALIGNMENT, QUERY_SET_MAX_QUERIES, QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT,
|
||||
};
|
||||
|
||||
@ -205,6 +206,7 @@ trait Context: Debug + Send + Sized + Sync {
|
||||
) -> Option<TextureFormat>;
|
||||
fn adapter_features(&self, adapter: &Self::AdapterId) -> Features;
|
||||
fn adapter_limits(&self, adapter: &Self::AdapterId) -> Limits;
|
||||
fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> DownlevelProperties;
|
||||
fn adapter_get_info(&self, adapter: &Self::AdapterId) -> AdapterInfo;
|
||||
fn adapter_get_texture_format_features(
|
||||
&self,
|
||||
@ -214,6 +216,7 @@ trait Context: Debug + Send + Sized + Sync {
|
||||
|
||||
fn device_features(&self, device: &Self::DeviceId) -> Features;
|
||||
fn device_limits(&self, device: &Self::DeviceId) -> Limits;
|
||||
fn device_downlevel_properties(&self, device: &Self::DeviceId) -> DownlevelProperties;
|
||||
fn device_create_swap_chain(
|
||||
&self,
|
||||
device: &Self::DeviceId,
|
||||
|
Loading…
Reference in New Issue
Block a user