- hook up software renderer

This commit is contained in:
Magnus Norddahl 2019-07-24 22:13:00 +02:00
parent 9da46d0e0a
commit ec82f994f7
3 changed files with 47 additions and 30 deletions

View file

@ -17,7 +17,7 @@ class PolyFrameBuffer : public SystemBaseFrameBuffer
public:
RenderMemory *GetFrameMemory() { return &mFrameMemory; }
PolyRenderState *GetRenderState() { return mRenderState.get(); }
DCanvas *GetCanvas() { return mCanvas.get(); }
DCanvas *GetCanvas() override { return mCanvas.get(); }
PolyDepthStencil *GetDepthStencil() { return mDepthStencil.get(); }
const DrawerCommandQueuePtr &GetDrawCommands();
void FlushDrawCommands();
@ -31,6 +31,8 @@ public:
void Update();
bool IsPoly() override { return true; }
void InitializeState() override;
void CleanForRestart() override;

View file

@ -86,6 +86,8 @@ SWSceneDrawer::~SWSceneDrawer()
sector_t *SWSceneDrawer::RenderView(player_t *player)
{
if (!screen->IsPoly())
{
// Avoid using the pixel buffer from the last frame
FBTextureIndex = (FBTextureIndex + 1) % 2;
auto &fbtex = FBTexture[FBTextureIndex];
@ -121,6 +123,16 @@ sector_t *SWSceneDrawer::RenderView(player_t *player)
screen->Draw2D();
screen->Clear2D();
});
}
else
{
DCanvas *canvas = screen->GetCanvas();
SWRenderer->RenderView(player, canvas, canvas->GetPixels(), canvas->GetPitch());
// To do: apply swrenderer::CameraLight::Instance()->ShaderColormap();
SWRenderer->DrawRemainingPlayerSprites();
screen->Draw2D();
screen->Clear2D();
}
return r_viewpoint.sector;
}

View file

@ -394,6 +394,9 @@ public:
virtual ~DFrameBuffer();
virtual void InitializeState() = 0; // For stuff that needs 'screen' set.
virtual bool IsVulkan() { return false; }
virtual bool IsPoly() { return false; }
virtual DCanvas* GetCanvas() { return nullptr; }
void SetSize(int width, int height);
void SetVirtualSize(int width, int height)