mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
webgpu: Clean up GPUCommandEncoders
and add some validation (#33223)
* TextureUsages::from_bits_retain Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fixup CreateBindGroupLayout Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * GPUExtent3D checking and converting Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Cleanup GPUCommandEncoders and some TODOs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * validate gpuorigin3d Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * validate GPUColor Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * set good expect Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
83a40c5180
commit
817a91f2ac
11 changed files with 276 additions and 361 deletions
|
@ -230,21 +230,15 @@ impl WGPU {
|
|||
WebGPURequest::CommandEncoderFinish {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
is_error,
|
||||
desc,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
let result = if is_error {
|
||||
Err(Error::Validation(String::from("Invalid GPUCommandEncoder")))
|
||||
} else if let Some(err) =
|
||||
let result = if let Some(err) =
|
||||
self.error_command_encoders.get(&command_encoder_id)
|
||||
{
|
||||
Err(Error::Validation(err.clone()))
|
||||
} else if let Some(error) = global
|
||||
.command_encoder_finish(
|
||||
command_encoder_id,
|
||||
&wgt::CommandBufferDescriptor::default(),
|
||||
)
|
||||
.1
|
||||
} else if let Some(error) =
|
||||
global.command_encoder_finish(command_encoder_id, &desc).1
|
||||
{
|
||||
Err(Error::from_error(error))
|
||||
} else {
|
||||
|
@ -363,10 +357,9 @@ impl WGPU {
|
|||
WebGPURequest::CreateCommandEncoder {
|
||||
device_id,
|
||||
command_encoder_id,
|
||||
label,
|
||||
desc,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
let desc = wgt::CommandEncoderDescriptor { label };
|
||||
let (_, error) = global.device_create_command_encoder(
|
||||
device_id,
|
||||
&desc,
|
||||
|
@ -579,11 +572,9 @@ impl WGPU {
|
|||
descriptor,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
if let Some(desc) = descriptor {
|
||||
let (_, error) =
|
||||
global.device_create_texture(device_id, &desc, Some(texture_id));
|
||||
self.maybe_dispatch_wgpu_error(device_id, error);
|
||||
}
|
||||
let (_, error) =
|
||||
global.device_create_texture(device_id, &descriptor, Some(texture_id));
|
||||
self.maybe_dispatch_wgpu_error(device_id, error);
|
||||
},
|
||||
WebGPURequest::CreateTextureView {
|
||||
texture_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue