summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp')
-rw-r--r--src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
index 50248b3e49b..ec4d6f05246 100644
--- a/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
+++ b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_framebuffer.cpp
@@ -42,6 +42,7 @@
#include "d3d12/d3d12_screen.h"
using Microsoft::WRL::ComPtr;
+constexpr uint32_t num_buffers = 2;
struct d3d12_wgl_framebuffer {
struct stw_winsys_framebuffer base;
@@ -50,7 +51,7 @@ struct d3d12_wgl_framebuffer {
enum pipe_format pformat;
HWND window;
ComPtr<IDXGISwapChain3> swapchain;
- struct pipe_resource *buffers[2];
+ struct pipe_resource *buffers[num_buffers];
};
static struct d3d12_wgl_framebuffer *
@@ -75,7 +76,7 @@ d3d12_wgl_framebuffer_resize(stw_winsys_framebuffer *fb,
struct d3d12_dxgi_screen *screen = d3d12_dxgi_screen(framebuffer->screen);
DXGI_SWAP_CHAIN_DESC1 desc = {};
- desc.BufferCount = 2;
+ desc.BufferCount = num_buffers;
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT;
desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
desc.Format = d3d12_get_format(templ->format);
@@ -114,13 +115,13 @@ d3d12_wgl_framebuffer_resize(stw_winsys_framebuffer *fb,
ctx->screen->fence_reference(ctx->screen, &fence, NULL);
}
- for (int i = 0; i < 2; ++i) {
+ 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);
}
}
- if (FAILED(framebuffer->swapchain->ResizeBuffers(2, desc.Width, desc.Height, desc.Format, desc.Flags))) {
+ if (FAILED(framebuffer->swapchain->ResizeBuffers(num_buffers, desc.Width, desc.Height, desc.Format, desc.Flags))) {
debug_printf("D3D12: failed to resize swapchain");
}
}