mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Load operations (#105)
* load ops: design + implementation (all backends) * Animometer/glTFViewer: use just one subpass per frame
This commit is contained in:
@@ -103,21 +103,6 @@ namespace utils {
|
||||
currentTexture = currentDrawable.texture;
|
||||
[currentTexture retain];
|
||||
|
||||
// Clear initial contents of the texture
|
||||
{
|
||||
MTLRenderPassDescriptor* passDescriptor = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||
passDescriptor.colorAttachments[0].texture = currentTexture;
|
||||
passDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear;
|
||||
passDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore;
|
||||
passDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
id<MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
|
||||
id<MTLRenderCommandEncoder> commandEncoder = [commandBuffer
|
||||
renderCommandEncoderWithDescriptor:passDescriptor];
|
||||
[commandEncoder endEncoding];
|
||||
[commandBuffer commit];
|
||||
}
|
||||
|
||||
nextTexture->texture = reinterpret_cast<void*>(currentTexture);
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
|
||||
@@ -54,12 +54,6 @@ namespace utils {
|
||||
glDeleteFramebuffers(1, &backFBO);
|
||||
}
|
||||
|
||||
void HACKCLEAR() {
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, backFBO);
|
||||
glClearColor(0, 0, 0, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
// For GenerateSwapChainImplementation
|
||||
friend class SwapChainImpl;
|
||||
|
||||
@@ -89,8 +83,6 @@ namespace utils {
|
||||
// Reallocate the texture
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
// Clear the newly (re-)allocated texture
|
||||
HACKCLEAR();
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
@@ -106,7 +98,6 @@ namespace utils {
|
||||
glBlitFramebuffer(0, 0, cfgWidth, cfgHeight, 0, 0, cfgWidth, cfgHeight,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
glfwSwapBuffers(window);
|
||||
HACKCLEAR();
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user