[PATCH 2/4] wined3d: Store the wined3d_fb_state structure inline in the wined3d_cs_clear structure.
Zebediah Figura
z.figura12 at gmail.com
Mon Mar 1 22:42:12 CST 2021
In order to avoid accessing the cs_state field from emit methods.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
An alternative approach could be to access device->cs_state.state.
dlls/wined3d/cs.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9e3ea4c8086..e0d7169cc84 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -106,7 +106,7 @@ struct wined3d_cs_clear
enum wined3d_cs_op opcode;
DWORD flags;
unsigned int rt_count;
- struct wined3d_fb_state *fb;
+ struct wined3d_fb_state fb;
RECT draw_rect;
struct wined3d_color color;
float depth;
@@ -659,19 +659,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
unsigned int i;
device = cs->device;
- device->blitter->ops->blitter_clear(device->blitter, device, op->rt_count, op->fb,
+ device->blitter->ops->blitter_clear(device->blitter, device, op->rt_count, &op->fb,
op->rect_count, op->rects, &op->draw_rect, op->flags, &op->color, op->depth, op->stencil);
if (op->flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < op->rt_count; ++i)
{
- if (op->fb->render_targets[i])
- wined3d_resource_release(op->fb->render_targets[i]->resource);
+ if (op->fb.render_targets[i])
+ wined3d_resource_release(op->fb.render_targets[i]->resource);
}
}
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_release(op->fb->depth_stencil->resource);
+ wined3d_resource_release(op->fb.depth_stencil->resource);
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -690,7 +690,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags & (WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
op->rt_count = rt_count;
- op->fb = &cs->cs_state->state.fb;
+ op->fb = state->fb;
SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height);
if (state->rasterizer_state && state->rasterizer_state->desc.scissor)
IntersectRect(&op->draw_rect, &op->draw_rect, &state->scissor_rects[0]);
@@ -722,22 +722,21 @@ void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs *cs, struct wined
size = FIELD_OFFSET(struct wined3d_cs_clear, rects[1]) + sizeof(struct wined3d_fb_state);
op = wined3d_cs_require_space(cs, size, WINED3D_CS_QUEUE_DEFAULT);
- op->fb = (void *)&op->rects[1];
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags & (WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
if (flags & WINED3DCLEAR_TARGET)
{
op->rt_count = 1;
- op->fb->render_targets[0] = view;
- op->fb->depth_stencil = NULL;
+ op->fb.render_targets[0] = view;
+ op->fb.depth_stencil = NULL;
op->color = *color;
}
else
{
op->rt_count = 0;
- op->fb->render_targets[0] = NULL;
- op->fb->depth_stencil = view;
+ op->fb.render_targets[0] = NULL;
+ op->fb.depth_stencil = view;
op->depth = depth;
op->stencil = stencil;
}
--
2.20.1
More information about the wine-devel
mailing list