@@ -1821,14 +1821,6 @@ def _destroy(self):
1821
1821
self ._internal , internal = None , self ._internal
1822
1822
# H: void f(WGPUBuffer buffer)
1823
1823
libf .wgpuBufferRelease (internal )
1824
- self ._device ._poll ()
1825
- # Note: from the memtests it looks like we need to poll the device
1826
- # after releasing an object for some objects (buffer, texture,
1827
- # texture view, sampler, pipeline layout, compute pipeline, and
1828
- # render pipeline). But not others. Would be nice to at some point
1829
- # have more clarity on this. In the mean time, we now poll the
1830
- # device quite a bit, so leaks by not polling the device after
1831
- # releasing something are highly unlikely.
1832
1824
1833
1825
1834
1826
class GPUTexture (classes .GPUTexture , GPUObjectBase ):
@@ -1886,7 +1878,6 @@ def _destroy(self):
1886
1878
self ._internal , internal = None , self ._internal
1887
1879
# H: void f(WGPUTexture texture)
1888
1880
libf .wgpuTextureRelease (internal )
1889
- self ._device ._poll ()
1890
1881
1891
1882
1892
1883
class GPUTextureView (classes .GPUTextureView , GPUObjectBase ):
@@ -1895,7 +1886,6 @@ def _destroy(self):
1895
1886
self ._internal , internal = None , self ._internal
1896
1887
# H: void f(WGPUTextureView textureView)
1897
1888
libf .wgpuTextureViewRelease (internal )
1898
- self ._device ._poll ()
1899
1889
1900
1890
1901
1891
class GPUSampler (classes .GPUSampler , GPUObjectBase ):
@@ -1904,7 +1894,6 @@ def _destroy(self):
1904
1894
self ._internal , internal = None , self ._internal
1905
1895
# H: void f(WGPUSampler sampler)
1906
1896
libf .wgpuSamplerRelease (internal )
1907
- self ._device ._poll ()
1908
1897
1909
1898
1910
1899
class GPUBindGroupLayout (classes .GPUBindGroupLayout , GPUObjectBase ):
@@ -1929,7 +1918,6 @@ def _destroy(self):
1929
1918
self ._internal , internal = None , self ._internal
1930
1919
# H: void f(WGPUPipelineLayout pipelineLayout)
1931
1920
libf .wgpuPipelineLayoutRelease (internal )
1932
- self ._device ._poll ()
1933
1921
1934
1922
1935
1923
class GPUShaderModule (classes .GPUShaderModule , GPUObjectBase ):
@@ -1991,7 +1979,6 @@ def _destroy(self):
1991
1979
self ._internal , internal = None , self ._internal
1992
1980
# H: void f(WGPUComputePipeline computePipeline)
1993
1981
libf .wgpuComputePipelineRelease (internal )
1994
- self ._device ._poll ()
1995
1982
1996
1983
1997
1984
class GPURenderPipeline (classes .GPURenderPipeline , GPUPipelineBase , GPUObjectBase ):
@@ -2000,7 +1987,6 @@ def _destroy(self):
2000
1987
self ._internal , internal = None , self ._internal
2001
1988
# H: void f(WGPURenderPipeline renderPipeline)
2002
1989
libf .wgpuRenderPipelineRelease (internal )
2003
- self ._device ._poll ()
2004
1990
2005
1991
2006
1992
class GPUCommandBuffer (classes .GPUCommandBuffer , GPUObjectBase ):
@@ -2504,9 +2490,6 @@ def finish(self, *, label=""):
2504
2490
)
2505
2491
# H: WGPUCommandBuffer f(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor)
2506
2492
id = libf .wgpuCommandEncoderFinish (self ._internal , struct )
2507
- # WGPU destroys the command encoder when it's finished. So we set
2508
- # _internal to None to avoid releasing a nonexistent object.
2509
- self ._internal = None
2510
2493
return GPUCommandBuffer (label , id , self )
2511
2494
2512
2495
def resolve_query_set (
@@ -2650,10 +2633,6 @@ def submit(self, command_buffers):
2650
2633
c_command_buffers = ffi .new ("WGPUCommandBuffer []" , command_buffer_ids )
2651
2634
# H: void f(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands)
2652
2635
libf .wgpuQueueSubmit (self ._internal , len (command_buffer_ids ), c_command_buffers )
2653
- # WGPU destroys the resource when submitting. We follow this
2654
- # to avoid releasing a nonexistent object.
2655
- for cb in command_buffers :
2656
- cb ._internal = None
2657
2636
2658
2637
def write_buffer (self , buffer , buffer_offset , data , data_offset = 0 , size = None ):
2659
2638
# We support anything that memoryview supports, i.e. anything
0 commit comments