st/nine: Use nine_context_clear_render_target

Enables to not wait for the worker thread for ColorFill.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy 2016-11-13 12:47:58 +01:00
parent 7b154ac04d
commit 884166a251
4 changed files with 29 additions and 15 deletions

View file

@ -1752,11 +1752,8 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
const RECT *pRect,
D3DCOLOR color )
{
struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct NineSurface9 *surf = NineSurface9(pSurface);
struct pipe_surface *psurf;
unsigned x, y, w, h;
union pipe_color_union rgba;
DBG("This=%p pSurface=%p pRect=%p color=%08x\n", This,
pSurface, pRect, color);
@ -1790,11 +1787,9 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
w = surf->desc.Width;
h = surf->desc.Height;
}
d3dcolor_to_pipe_color_union(&rgba, color);
if (surf->base.info.bind & PIPE_BIND_RENDER_TARGET) {
psurf = NineSurface9_GetSurface(surf, 0);
pipe->clear_render_target(pipe, psurf, &rgba, x, y, w, h, false);
nine_context_clear_render_target(This, surf, color, x, y, w, h);
} else {
D3DLOCKED_RECT lock;
union util_color uc;

View file

@ -2675,6 +2675,23 @@ CSMT_ITEM_NO_WAIT(nine_context_blit,
context->pipe->blit(context->pipe, blit);
}
CSMT_ITEM_NO_WAIT(nine_context_clear_render_target,
ARG_BIND_REF(struct NineSurface9, surface),
ARG_VAL(D3DCOLOR, color),
ARG_VAL(UINT, x),
ARG_VAL(UINT, y),
ARG_VAL(UINT, width),
ARG_VAL(UINT, height))
{
struct nine_context *context = &device->context;
struct pipe_surface *surf;
union pipe_color_union rgba;
d3dcolor_to_pipe_color_union(&rgba, color);
surf = NineSurface9_GetSurface(surface, 0);
context->pipe->clear_render_target(context->pipe, surf, &rgba, x, y, width, height, false);
}
struct pipe_query *
nine_context_create_query(struct NineDevice9 *device, unsigned query_type)
{

View file

@ -530,6 +530,15 @@ void
nine_context_blit(struct NineDevice9 *device,
struct pipe_blit_info *blit);
void
nine_context_clear_render_target(struct NineDevice9 *device,
struct NineSurface9 *surface,
D3DCOLOR color,
UINT x,
UINT y,
UINT width,
UINT height);
struct pipe_query *
nine_context_create_query(struct NineDevice9 *device, unsigned query_type);

View file

@ -55,9 +55,6 @@ NineSurface9_ctor( struct NineSurface9 *This,
D3DSURFACE_DESC *pDesc )
{
HRESULT hr;
union pipe_color_union rgba = {0};
struct pipe_surface *surf;
struct pipe_context *pipe;
bool allocate = !pContainer && pDesc->Format != D3DFMT_NULL;
D3DMULTISAMPLE_TYPE multisample_type;
@ -192,12 +189,8 @@ NineSurface9_ctor( struct NineSurface9 *This,
}
/* TODO: investigate what else exactly needs to be cleared */
if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) {
surf = NineSurface9_GetSurface(This, 0);
pipe = nine_context_get_pipe_acquire(pParams->device);
pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height, false);
nine_context_get_pipe_release(pParams->device);
}
if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET))
nine_context_clear_render_target(pParams->device, This, 0, 0, 0, pDesc->Width, pDesc->Height);
NineSurface9_Dump(This);