@@ -1300,6 +1300,48 @@ pub unsafe extern "C" fn wgpuCommandEncoderClearBuffer(
13001300 }
13011301}
13021302
1303+ #[ no_mangle]
1304+ pub unsafe extern "C" fn wgpuCommandEncoderClearTexture (
1305+ command_encoder : native:: WGPUCommandEncoder ,
1306+ texture : native:: WGPUTexture ,
1307+ range : Option < & native:: WGPUImageSubresourceRange > ,
1308+ ) {
1309+ let ( command_encoder_id, context, error_sink) = {
1310+ let command_encoder = command_encoder. as_ref ( ) . expect ( "invalid command encoder" ) ;
1311+ (
1312+ command_encoder. id ,
1313+ & command_encoder. context ,
1314+ & command_encoder. error_sink ,
1315+ )
1316+ } ;
1317+ let texture_id = texture. as_ref ( ) . expect ( "invalid texture" ) . id ;
1318+
1319+ let subresource_range = match range {
1320+ Some ( range) => wgt:: ImageSubresourceRange {
1321+ aspect : conv:: map_texture_aspect ( range. aspect ) . unwrap_or ( wgt:: TextureAspect :: All ) ,
1322+ base_mip_level : range. baseMipLevel ,
1323+ mip_level_count : match range. mipLevelCount {
1324+ 0 => panic ! ( "invalid mipLevelCount" ) ,
1325+ native:: WGPU_MIP_LEVEL_COUNT_UNDEFINED => None ,
1326+ _ => Some ( range. mipLevelCount ) ,
1327+ } ,
1328+ base_array_layer : range. baseArrayLayer ,
1329+ array_layer_count : match range. arrayLayerCount {
1330+ 0 => panic ! ( "invalid arrayLayerCount" ) ,
1331+ native:: WGPU_ARRAY_LAYER_COUNT_UNDEFINED => None ,
1332+ _ => Some ( range. arrayLayerCount ) ,
1333+ } ,
1334+ } ,
1335+ None => wgt:: ImageSubresourceRange :: default ( ) ,
1336+ } ;
1337+
1338+ if let Err ( cause) =
1339+ context. command_encoder_clear_texture ( command_encoder_id, texture_id, & subresource_range)
1340+ {
1341+ handle_error ( error_sink, cause, None , "wgpuCommandEncoderClearTexture" ) ;
1342+ }
1343+ }
1344+
13031345#[ no_mangle]
13041346pub unsafe extern "C" fn wgpuCommandEncoderCopyBufferToBuffer (
13051347 command_encoder : native:: WGPUCommandEncoder ,
0 commit comments