mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Merge #340
340: Read-only depth-stencil support r=kvark a=kvark Depends on https://github.com/gfx-rs/wgpu/pull/685 Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
@@ -28,14 +28,14 @@ vulkan = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "3a6cdeec945b6e2795c5ad544101b273c3887037"
|
||||
rev = "fbc2c87de61b0e7bab2583ddf305742e3cbf85e8"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "3a6cdeec945b6e2795c5ad544101b273c3887037"
|
||||
rev = "fbc2c87de61b0e7bab2583ddf305742e3cbf85e8"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -752,10 +752,12 @@ impl framework::Example for Example {
|
||||
attachment: &light.target_view,
|
||||
depth_load_op: wgpu::LoadOp::Clear,
|
||||
depth_store_op: wgpu::StoreOp::Store,
|
||||
depth_read_only: false,
|
||||
stencil_load_op: wgpu::LoadOp::Clear,
|
||||
stencil_store_op: wgpu::StoreOp::Store,
|
||||
clear_depth: 1.0,
|
||||
clear_stencil: 0,
|
||||
stencil_read_only: false,
|
||||
}),
|
||||
});
|
||||
pass.set_pipeline(&self.shadow_pass.pipeline);
|
||||
@@ -788,10 +790,12 @@ impl framework::Example for Example {
|
||||
attachment: &self.forward_depth,
|
||||
depth_load_op: wgpu::LoadOp::Clear,
|
||||
depth_store_op: wgpu::StoreOp::Store,
|
||||
depth_read_only: false,
|
||||
stencil_load_op: wgpu::LoadOp::Clear,
|
||||
stencil_store_op: wgpu::StoreOp::Store,
|
||||
clear_depth: 1.0,
|
||||
clear_stencil: 0,
|
||||
stencil_read_only: false,
|
||||
}),
|
||||
});
|
||||
pass.set_pipeline(&self.forward_pass.pipeline);
|
||||
|
||||
@@ -684,11 +684,21 @@ impl crate::Context for Context {
|
||||
fn swap_chain_get_next_texture(
|
||||
&self,
|
||||
swap_chain: &Self::SwapChainId,
|
||||
) -> (Option<Self::TextureViewId>, SwapChainStatus, Self::SwapChainOutputDetail) {
|
||||
let wgc::swap_chain::SwapChainOutput { status, view_id } =
|
||||
) -> (
|
||||
Option<Self::TextureViewId>,
|
||||
SwapChainStatus,
|
||||
Self::SwapChainOutputDetail,
|
||||
) {
|
||||
let wgc::swap_chain::SwapChainOutput { status, view_id } =
|
||||
gfx_select!(*swap_chain => self.swap_chain_get_next_texture(*swap_chain, PhantomData));
|
||||
|
||||
(view_id, status, SwapChainOutputDetail { swap_chain_id: *swap_chain })
|
||||
(
|
||||
view_id,
|
||||
status,
|
||||
SwapChainOutputDetail {
|
||||
swap_chain_id: *swap_chain,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn swap_chain_present(&self, view: &Self::TextureViewId, detail: &Self::SwapChainOutputDetail) {
|
||||
@@ -845,10 +855,12 @@ impl crate::Context for Context {
|
||||
attachment: dsa.attachment.id,
|
||||
depth_load_op: dsa.depth_load_op,
|
||||
depth_store_op: dsa.depth_store_op,
|
||||
depth_read_only: dsa.depth_read_only,
|
||||
clear_depth: dsa.clear_depth,
|
||||
stencil_load_op: dsa.stencil_load_op,
|
||||
stencil_store_op: dsa.stencil_store_op,
|
||||
clear_stencil: dsa.clear_stencil,
|
||||
stencil_read_only: dsa.depth_read_only,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1102,10 +1102,18 @@ impl crate::Context for Context {
|
||||
fn swap_chain_get_next_texture(
|
||||
&self,
|
||||
swap_chain: &Self::SwapChainId,
|
||||
) -> (Option<Self::TextureViewId>, SwapChainStatus, Self::SwapChainOutputDetail) {
|
||||
) -> (
|
||||
Option<Self::TextureViewId>,
|
||||
SwapChainStatus,
|
||||
Self::SwapChainOutputDetail,
|
||||
) {
|
||||
// TODO: Should we pass a descriptor here?
|
||||
// Or is the default view always correct?
|
||||
(Some(Sendable(swap_chain.0.get_current_texture().create_view())), SwapChainStatus::Good, ())
|
||||
(
|
||||
Some(Sendable(swap_chain.0.get_current_texture().create_view())),
|
||||
SwapChainStatus::Good,
|
||||
(),
|
||||
)
|
||||
}
|
||||
|
||||
fn swap_chain_present(
|
||||
|
||||
10
src/lib.rs
10
src/lib.rs
@@ -23,8 +23,8 @@ pub use wgt::{
|
||||
DeviceDescriptor, DynamicOffset, Extensions, Extent3d, FilterMode, FrontFace, IndexFormat,
|
||||
InputStepMode, Limits, LoadOp, Origin3d, PowerPreference, PresentMode, PrimitiveTopology,
|
||||
RasterizationStateDescriptor, ShaderLocation, ShaderStage, StencilOperation,
|
||||
StencilStateFaceDescriptor, StoreOp, SwapChainDescriptor, SwapChainStatus, TextureAspect,
|
||||
TextureComponentType, TextureDataLayout, TextureDimension, TextureFormat, TextureUsage,
|
||||
StencilStateFaceDescriptor, StoreOp, SwapChainDescriptor, SwapChainStatus, TextureAspect,
|
||||
TextureComponentType, TextureDataLayout, TextureDimension, TextureFormat, TextureUsage,
|
||||
TextureViewDimension, VertexAttributeDescriptor, VertexFormat, BIND_BUFFER_ALIGNMENT,
|
||||
};
|
||||
|
||||
@@ -217,7 +217,11 @@ trait Context: Sized {
|
||||
fn swap_chain_get_next_texture(
|
||||
&self,
|
||||
swap_chain: &Self::SwapChainId,
|
||||
) -> (Option<Self::TextureViewId>, SwapChainStatus, Self::SwapChainOutputDetail);
|
||||
) -> (
|
||||
Option<Self::TextureViewId>,
|
||||
SwapChainStatus,
|
||||
Self::SwapChainOutputDetail,
|
||||
);
|
||||
fn swap_chain_present(&self, view: &Self::TextureViewId, detail: &Self::SwapChainOutputDetail);
|
||||
fn texture_create_view(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user