upgrade wgpu to v0.6

This commit is contained in:
Kunal Mohan 2020-08-21 22:07:02 +05:30
parent 669b16f2c0
commit e1bfc7aa0d
5 changed files with 125 additions and 41 deletions

View file

@ -292,6 +292,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
size: GPUSize64,
) {
let scope_id = self.device.use_current_scope();
println!("CopyBufferToBuffer scope_id {:?}", scope_id);
if !(*self.state.borrow() == GPUCommandEncoderState::Open) {
self.device.handle_server_msg(

View file

@ -178,6 +178,7 @@ impl GPUDevice {
}
pub fn handle_server_msg(&self, scope: Option<ErrorScopeId>, result: WebGPUOpResult) {
println!("handle_server_msg {:?}, {:?}", scope, result);
let result = match result {
WebGPUOpResult::Success => Ok(()),
WebGPUOpResult::ValidationError(m) => {
@ -221,6 +222,7 @@ impl GPUDevice {
}
fn handle_error(&self, scope: ErrorScopeId, error: GPUError) {
println!("handle_error {}", scope);
let mut context = self.scope_context.borrow_mut();
if let Some(mut err_scope) = context.error_scopes.get_mut(&scope) {
if err_scope.error.is_none() {
@ -232,6 +234,7 @@ impl GPUDevice {
}
fn try_remove_scope(&self, scope: ErrorScopeId) {
println!("try_remove_scope {}", scope);
let mut context = self.scope_context.borrow_mut();
let remove = if let Some(mut err_scope) = context.error_scopes.get_mut(&scope) {
err_scope.op_count -= 1;
@ -250,6 +253,7 @@ impl GPUDevice {
false
};
if remove {
println!("remove {}", scope);
let _ = context.error_scopes.remove(&scope);
context.scope_stack.retain(|meta| meta.id != scope);
}
@ -370,6 +374,7 @@ impl GPUDeviceMethods for GPUDevice {
.create_buffer_id(self.device.0.backend());
let scope_id = self.use_current_scope();
println!("CreateBuffer scope {:?}", scope_id);
if desc.is_none() {
self.handle_server_msg(
scope_id,
@ -1088,6 +1093,7 @@ impl GPUDeviceMethods for GPUDevice {
fn PushErrorScope(&self, filter: GPUErrorFilter) {
let mut context = self.scope_context.borrow_mut();
let scope_id = context.next_scope_id;
println!("PushErrorScope {}", scope_id);
context.next_scope_id = ErrorScopeId::new(scope_id.get() + 1).unwrap();
let err_scope = ErrorScopeInfo {
op_count: 0,
@ -1115,6 +1121,7 @@ impl GPUDeviceMethods for GPUDevice {
promise.reject_error(Error::Operation);
return promise;
};
println!("PopErrorScope {}", scope_id);
let remove = if let Some(mut err_scope) = context.error_scopes.get_mut(&scope_id) {
if let Some(ref e) = err_scope.error {
promise.resolve_native(e);
@ -1128,6 +1135,7 @@ impl GPUDeviceMethods for GPUDevice {
false
};
if remove {
println!("PopErrorScope remove {}", scope_id);
let _ = context.error_scopes.remove(&scope_id);
context.scope_stack.retain(|meta| meta.id != scope_id);
}