summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
index ec4d6f05246..b96dc52517f 100644
--- a/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
+++ b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
@@ -64,7 +64,26 @@ static void
d3d12_wgl_framebuffer_destroy(struct stw_winsys_framebuffer *fb,
pipe_context *ctx)
{
- FREE(fb);
+ struct d3d12_wgl_framebuffer *framebuffer = d3d12_wgl_framebuffer(fb);
+ struct pipe_fence_handle *fence = NULL;
+
+ if (ctx) {
+ /* Ensure all resources are flushed */
+ ctx->flush(ctx, &fence, PIPE_FLUSH_HINT_FINISH);
+ if (fence) {
+ ctx->screen->fence_finish(ctx->screen, ctx, fence, PIPE_TIMEOUT_INFINITE);
+ ctx->screen->fence_reference(ctx->screen, &fence, NULL);
+ }
+ }
+
+ for (int i = 0; i < num_buffers; ++i) {
+ if (framebuffer->buffers[i]) {
+ d3d12_resource_release(d3d12_resource(framebuffer->buffers[i]));
+ pipe_resource_reference(&framebuffer->buffers[i], NULL);
+ }
+ }
+
+ delete framebuffer;
}
static void
@@ -208,6 +227,8 @@ d3d12_wgl_create_framebuffer(struct pipe_screen *screen,
if (!fb)
return NULL;
+ new (fb) struct d3d12_wgl_framebuffer();
+
fb->window = WindowFromDC(hDC);
fb->screen = d3d12_screen(screen);
fb->base.destroy = d3d12_wgl_framebuffer_destroy;