summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2021-03-31 15:55:00 -0700
committerMarge Bot <eric+marge@anholt.net>2021-04-01 16:19:41 +0000
commitaa1643d141cf97ca004fcc952b7d689725a1afca (patch)
tree349554c31ca57bd9c7bfb5aae3efafaef2206bea /src/gallium/winsys
parent51df136c8b5e332163802349d96dff422d566c29 (diff)
d3d12: Add a constant for num_buffers
Reviewed-By: Bill Kristiansen <billkris@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9959>
Diffstat (limited to 'src/gallium/winsys')
-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");
}
}