@@ -34,24 +34,25 @@ protected override void OnTick()
34
34
_graphicsDevice . RenderFrame ( OnDraw ) ;
35
35
}
36
36
37
- private void OnDraw ( WGPUCommandEncoder encoder , WGPUTexture target )
37
+ private void OnDraw ( WGPUCommandEncoder encoder , WGPUTexture target , WGPUTextureView textureView )
38
38
{
39
39
float g = _green + 0.001f ;
40
40
if ( g > 1.0f )
41
41
g = 0.0f ;
42
42
_green = g ;
43
43
44
- WGPUTextureView targetView = wgpuTextureCreateView ( target , null ) ;
45
-
46
- WGPURenderPassColorAttachment renderPassColorAttachment = new ( ) ;
47
- // The attachment is tighed to the view returned by the swap chain, so that
48
- // the render pass draws directly on screen.
49
- renderPassColorAttachment . view = targetView ;
50
- // Not relevant here because we do not use multi-sampling
51
- renderPassColorAttachment . resolveTarget = WGPUTextureView . Null ;
52
- renderPassColorAttachment . loadOp = WGPULoadOp . Clear ;
53
- renderPassColorAttachment . storeOp = WGPUStoreOp . Store ;
54
- renderPassColorAttachment . clearValue = new WGPUColor ( 1.0f , _green , 0.0f , 1.0f ) ;
44
+ WGPURenderPassColorAttachment renderPassColorAttachment = new ( )
45
+ {
46
+ // The attachment is tighed to the view returned by the swap chain, so that
47
+ // the render pass draws directly on screen.
48
+ view = textureView ,
49
+ depthSlice = WGPU_DEPTH_SLICE_UNDEFINED ,
50
+ // Not relevant here because we do not use multi-sampling
51
+ resolveTarget = WGPUTextureView . Null ,
52
+ loadOp = WGPULoadOp . Clear ,
53
+ storeOp = WGPUStoreOp . Store ,
54
+ clearValue = new WGPUColor ( 1.0f , _green , 0.0f , 1.0f )
55
+ } ;
55
56
56
57
// Describe a render pass, which targets the texture view
57
58
WGPURenderPassDescriptor renderPassDesc = new ( )
@@ -71,8 +72,7 @@ private void OnDraw(WGPUCommandEncoder encoder, WGPUTexture target)
71
72
WGPURenderPassEncoder renderPass = wgpuCommandEncoderBeginRenderPass ( encoder , & renderPassDesc ) ;
72
73
73
74
wgpuRenderPassEncoderEnd ( renderPass ) ;
74
-
75
- wgpuTextureViewReference ( targetView ) ;
75
+ wgpuRenderPassEncoderRelease ( renderPass ) ;
76
76
}
77
77
}
78
78
}
0 commit comments