MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / create_depth_texture

Function create_depth_texture

native/shared/src/renderer/formats.rs:60–82  ·  view source on GitHub ↗
(device: &wgpu::Device, width: u32, height: u32)

Source from the content-addressed store, hash-verified

58pub(super) const VELOCITY_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rg16Float;
59
60pub(super) fn create_depth_texture(device: &wgpu::Device, width: u32, height: u32) -> (wgpu::Texture, wgpu::TextureView) {
61 let texture = device.create_texture(&wgpu::TextureDescriptor {
62 label: Some("depth_texture"),
63 size: wgpu::Extent3d { width, height, depth_or_array_layers: 1 },
64 mip_level_count: 1,
65 sample_count: 1,
66 dimension: wgpu::TextureDimension::D2,
67 format: DEPTH_FORMAT,
68 // SSAO samples this texture in a separate pass after the
69 // depth-write HDR pass — needs TEXTURE_BINDING in addition
70 // to RENDER_ATTACHMENT.
71 //
72 // COPY_SRC: Phase 4c snapshots this to a transient depth
73 // texture so translucent materials can sample it without
74 // aliasing the pass's own depth-stencil attachment.
75 usage: wgpu::TextureUsages::RENDER_ATTACHMENT
76 | wgpu::TextureUsages::TEXTURE_BINDING
77 | wgpu::TextureUsages::COPY_SRC,
78 view_formats: &[],
79 });
80 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
81 (texture, view)
82}
83
84pub(super) fn create_hdr_rt(device: &wgpu::Device, width: u32, height: u32) -> (wgpu::Texture, wgpu::TextureView) {
85 let texture = device.create_texture(&wgpu::TextureDescriptor {

Callers 2

newMethod · 0.85
resizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected