File tree 2 files changed +34
-2
lines changed
2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ pub struct GpuRenderPassColorAttachment {
79
79
#[ serde( rename_all = "camelCase" ) ]
80
80
pub struct GpuRenderPassDepthStencilAttachment {
81
81
view : ResourceId ,
82
- depth_clear_value : f32 ,
82
+ depth_clear_value : Option < f32 > ,
83
83
depth_load_op : Option < wgpu_core:: command:: LoadOp > ,
84
84
depth_store_op : Option < wgpu_core:: command:: StoreOp > ,
85
85
depth_read_only : bool ,
@@ -168,7 +168,9 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
168
168
store_op : attachment
169
169
. depth_store_op
170
170
. unwrap_or ( wgpu_core:: command:: StoreOp :: Store ) ,
171
- clear_value : attachment. depth_clear_value ,
171
+ // In "01_webgpu.js", `depthLoadOp` is cheked to ensure its value is not "clear"
172
+ // when `depthClearValue` is undefined, so the default 0.0 doesn't matter.
173
+ clear_value : attachment. depth_clear_value . unwrap_or ( 0.0 ) ,
172
174
read_only : attachment. depth_read_only ,
173
175
} ,
174
176
stencil : wgpu_core:: command:: PassChannel {
Original file line number Diff line number Diff line change @@ -496,6 +496,36 @@ Deno.test({
496
496
device . destroy ( ) ;
497
497
} ) ;
498
498
499
+ Deno . test ( {
500
+ ignore : isWsl || isLinuxOrMacCI ,
501
+ } , async function beginRenderPassWithoutDepthClearValue ( ) {
502
+ const adapter = await navigator . gpu . requestAdapter ( ) ;
503
+ assert ( adapter ) ;
504
+ const device = await adapter . requestDevice ( ) ;
505
+ assert ( device ) ;
506
+
507
+ const encoder = device . createCommandEncoder ( ) ;
508
+
509
+ const depthTexture = device . createTexture ( {
510
+ size : [ 256 , 256 ] ,
511
+ format : "depth32float" ,
512
+ usage : GPUTextureUsage . RENDER_ATTACHMENT ,
513
+ } ) ;
514
+ const depthView = depthTexture . createView ( ) ;
515
+
516
+ const renderPass = encoder . beginRenderPass ( {
517
+ colorAttachments : [ ] ,
518
+ depthStencilAttachment : {
519
+ view : depthView ,
520
+ depthLoadOp : "load" ,
521
+ } ,
522
+ } ) ;
523
+
524
+ assert ( renderPass ) ;
525
+
526
+ device . destroy ( ) ;
527
+ } ) ;
528
+
499
529
async function checkIsWsl ( ) {
500
530
return Deno . build . os === "linux" && await hasMicrosoftProcVersion ( ) ;
501
531
You can’t perform that action at this time.
0 commit comments