- use the worker threads to clear the stencil buffer
This commit is contained in:
parent
8486cd2c0e
commit
de67393b4e
7 changed files with 66 additions and 20 deletions
|
|
@ -41,9 +41,9 @@
|
|||
|
||||
static bool isBgraRenderTarget = false;
|
||||
|
||||
void PolyTriangleDrawer::ClearBuffers(DCanvas *canvas)
|
||||
void PolyTriangleDrawer::ResizeBuffers(DCanvas *canvas)
|
||||
{
|
||||
PolyStencilBuffer::Instance()->Clear(canvas->GetWidth(), canvas->GetHeight(), 0);
|
||||
PolyStencilBuffer::Instance()->Resize(canvas->GetWidth(), canvas->GetHeight());
|
||||
PolyZBuffer::Instance()->Resize(canvas->GetPitch(), canvas->GetHeight());
|
||||
}
|
||||
|
||||
|
|
@ -52,6 +52,11 @@ bool PolyTriangleDrawer::IsBgra()
|
|||
return isBgraRenderTarget;
|
||||
}
|
||||
|
||||
void PolyTriangleDrawer::ClearStencil(const DrawerCommandQueuePtr &queue, uint8_t value)
|
||||
{
|
||||
queue->Push<PolyClearStencilCommand>(value);
|
||||
}
|
||||
|
||||
void PolyTriangleDrawer::SetViewport(const DrawerCommandQueuePtr &queue, int x, int y, int width, int height, DCanvas *canvas)
|
||||
{
|
||||
uint8_t *dest = (uint8_t*)canvas->GetPixels();
|
||||
|
|
@ -99,6 +104,21 @@ void PolyTriangleDrawer::SetWeaponScene(const DrawerCommandQueuePtr &queue, bool
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void PolyTriangleThreadData::ClearStencil(uint8_t value)
|
||||
{
|
||||
auto buffer = PolyStencilBuffer::Instance();
|
||||
int width = buffer->Width();
|
||||
int height = buffer->Height();
|
||||
uint8_t *data = buffer->Values();
|
||||
|
||||
data += core * width;
|
||||
for (int y = core; y < height; y += num_cores)
|
||||
{
|
||||
memset(data, value, width);
|
||||
data += num_cores * width;
|
||||
}
|
||||
}
|
||||
|
||||
void PolyTriangleThreadData::SetViewport(int x, int y, int width, int height, uint8_t *new_dest, int new_dest_width, int new_dest_height, int new_dest_pitch, bool new_dest_bgra)
|
||||
{
|
||||
viewport_x = x;
|
||||
|
|
@ -633,6 +653,17 @@ void PolySetWeaponSceneCommand::Execute(DrawerThread *thread)
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolyClearStencilCommand::PolyClearStencilCommand(uint8_t value) : value(value)
|
||||
{
|
||||
}
|
||||
|
||||
void PolyClearStencilCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
PolyTriangleThreadData::Get(thread)->ClearStencil(value);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolySetViewportCommand::PolySetViewportCommand(int x, int y, int width, int height, uint8_t *dest, int dest_width, int dest_height, int dest_pitch, bool dest_bgra)
|
||||
: x(x), y(y), width(width), height(height), dest(dest), dest_width(dest_width), dest_height(dest_height), dest_pitch(dest_pitch), dest_bgra(dest_bgra)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue