MCPcopy Create free account
hub / github.com/defold/defold / WebGPUFlip

Function WebGPUFlip

engine/graphics/src/webgpu/graphics_webgpu.cpp:1914–1968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1912}
1913
1914static void WebGPUFlip(HContext _context)
1915{
1916 TRACE_CALL;
1917 WebGPUContext* context = (WebGPUContext*)_context;
1918 WebGPUSubmitCommandEncoder(context);
1919 context->m_CurrentRenderTarget = NULL;
1920 {
1921#if !defined(__EMSCRIPTEN__)
1922 wgpuSurfacePresent(context->m_Surface);
1923#endif
1924 {
1925 WebGPUTexture* texture;
1926 if (context->m_MainRenderTarget->m_Multisample == 1)
1927 texture = GetAssetFromContainer<WebGPUTexture>(context->m_BaseContext.m_AssetHandleContainer, context->m_MainRenderTarget->m_Base.m_TextureColor[0]);
1928 else
1929 texture = GetAssetFromContainer<WebGPUTexture>(context->m_BaseContext.m_AssetHandleContainer, context->m_MainRenderTarget->m_TextureResolve[0]);
1930 if (texture->m_Texture)
1931 {
1932 wgpuTextureRelease(texture->m_Texture);
1933 texture->m_Texture = NULL;
1934 }
1935 if (texture->m_TextureView)
1936 {
1937 wgpuTextureViewRelease(texture->m_TextureView);
1938 texture->m_TextureView = NULL;
1939 }
1940 }
1941#if defined(DM_GRAPHICS_WEBGPU_WAGYU_USE_DEPTHSTENCIL)
1942 if(context->m_MainRenderTarget->m_Base.m_TextureDepthStencil) {
1943 WebGPUTexture* texture = GetAssetFromContainer<WebGPUTexture>(context->m_BaseContext.m_AssetHandleContainer, context->m_MainRenderTarget->m_Base.m_TextureDepthStencil);
1944 if (texture->m_Texture)
1945 {
1946 wgpuTextureRelease(texture->m_Texture);
1947 texture->m_Texture = NULL;
1948 }
1949 if (texture->m_TextureView)
1950 {
1951 wgpuTextureViewRelease(texture->m_TextureView);
1952 texture->m_TextureView = NULL;
1953 }
1954 texture->m_Base.m_Width = 0;
1955 texture->m_Base.m_Height = 0;
1956 }
1957#endif
1958 if (context->m_CurrentScratchUniforms.m_Allocs.Size() > 0)
1959 {
1960 for (size_t a = 0; a <= context->m_CurrentScratchUniforms.m_Alloc; ++a)
1961 {
1962 context->m_CurrentScratchUniforms.m_Allocs[a]->m_Used = 0;
1963 }
1964 context->m_CurrentScratchUniforms.m_Alloc = 0;
1965 }
1966 }
1967 dmPlatform::SwapBuffers(context->m_BaseContext.m_Window);
1968}
1969
1970static void WebGPUWriteBuffer(WebGPUContext* context, WebGPUBuffer* buffer, size_t offset, void const* data, size_t size)
1971{

Callers

nothing calls this directly

Calls 3

SwapBuffersFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected