d3d12: Bind 16 scissor rects when scissor disabled
authorJesse Natalie <jenatali@microsoft.com>
Fri, 4 Feb 2022 14:16:56 +0000 (06:16 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Feb 2022 20:49:23 +0000 (20:49 +0000)
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14881>

src/gallium/drivers/d3d12/d3d12_draw.cpp

index 58b6365..d47422f 100644 (file)
@@ -49,6 +49,14 @@ static const D3D12_RECT MAX_SCISSOR = { D3D12_VIEWPORT_BOUNDS_MIN,
                                         D3D12_VIEWPORT_BOUNDS_MAX,
                                         D3D12_VIEWPORT_BOUNDS_MAX };
 
+static const D3D12_RECT MAX_SCISSOR_ARRAY[] = {
+   MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR,
+   MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR,
+   MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR,
+   MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR, MAX_SCISSOR
+};
+static_assert(ARRAY_SIZE(MAX_SCISSOR_ARRAY) == PIPE_MAX_VIEWPORTS, "Wrong scissor count");
+
 static D3D12_GPU_DESCRIPTOR_HANDLE
 fill_cbv_descriptors(struct d3d12_context *ctx,
                      struct d3d12_shader *shader,
@@ -1075,7 +1083,7 @@ d3d12_draw_vbo(struct pipe_context *pctx,
       if (ctx->gfx_pipeline_state.rast->base.scissor && ctx->num_viewports > 0)
          ctx->cmdlist->RSSetScissorRects(ctx->num_viewports, ctx->scissors);
       else
-         ctx->cmdlist->RSSetScissorRects(1, &MAX_SCISSOR);
+         ctx->cmdlist->RSSetScissorRects(PIPE_MAX_VIEWPORTS, MAX_SCISSOR_ARRAY);
    }
 
    if (ctx->cmdlist_dirty & D3D12_DIRTY_BLEND_COLOR) {