mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-17 17:11:19 +00:00
Only allocate WallColumnDrawerArgs once per thread
This commit is contained in:
parent
c75233a842
commit
8abbd63427
3 changed files with 20 additions and 15 deletions
|
@ -225,7 +225,11 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawWallCommand::Execute(DrawerThread* thread)
|
void DrawWallCommand::Execute(DrawerThread* thread)
|
||||||
{
|
{
|
||||||
WallColumnDrawerArgs drawerargs(wallargs);
|
if (!thread->columndrawer)
|
||||||
|
thread->columndrawer = std::make_shared<WallColumnDrawerArgs>();
|
||||||
|
|
||||||
|
WallColumnDrawerArgs& drawerargs = *thread->columndrawer.get();
|
||||||
|
drawerargs.wallargs = &wallargs;
|
||||||
|
|
||||||
bool fixed = wallargs.fixedlight;
|
bool fixed = wallargs.fixedlight;
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ namespace swrenderer
|
||||||
class WallColumnDrawerArgs
|
class WallColumnDrawerArgs
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WallColumnDrawerArgs(const WallDrawerArgs& wallargs) : wallargs(wallargs) { }
|
|
||||||
|
|
||||||
void SetDest(int x, int y)
|
void SetDest(int x, int y)
|
||||||
{
|
{
|
||||||
dc_dest = Viewport()->GetDest(x, y);
|
dc_dest = Viewport()->GetDest(x, y);
|
||||||
|
@ -43,10 +41,10 @@ namespace swrenderer
|
||||||
int DestY() const { return dc_dest_y; }
|
int DestY() const { return dc_dest_y; }
|
||||||
int Count() const { return dc_count; }
|
int Count() const { return dc_count; }
|
||||||
|
|
||||||
uint32_t* SrcBlend() const { return wallargs.SrcBlend(); }
|
uint32_t* SrcBlend() const { return wallargs->SrcBlend(); }
|
||||||
uint32_t* DestBlend() const { return wallargs.DestBlend(); }
|
uint32_t* DestBlend() const { return wallargs->DestBlend(); }
|
||||||
fixed_t SrcAlpha() const { return wallargs.SrcAlpha(); }
|
fixed_t SrcAlpha() const { return wallargs->SrcAlpha(); }
|
||||||
fixed_t DestAlpha() const { return wallargs.DestAlpha(); }
|
fixed_t DestAlpha() const { return wallargs->DestAlpha(); }
|
||||||
|
|
||||||
uint32_t TextureUPos() const { return dc_texturefracx; }
|
uint32_t TextureUPos() const { return dc_texturefracx; }
|
||||||
fixed_t TextureVPos() const { return dc_texturefrac; }
|
fixed_t TextureVPos() const { return dc_texturefrac; }
|
||||||
|
@ -65,11 +63,11 @@ namespace swrenderer
|
||||||
DrawerLight dc_lights[MAX_DRAWER_LIGHTS];
|
DrawerLight dc_lights[MAX_DRAWER_LIGHTS];
|
||||||
int dc_num_lights = 0;
|
int dc_num_lights = 0;
|
||||||
|
|
||||||
RenderViewport* Viewport() const { return wallargs.Viewport(); }
|
RenderViewport* Viewport() const { return wallargs->Viewport(); }
|
||||||
|
|
||||||
uint8_t* Colormap(RenderViewport* viewport) const
|
uint8_t* Colormap(RenderViewport* viewport) const
|
||||||
{
|
{
|
||||||
auto basecolormap = wallargs.BaseColormap();
|
auto basecolormap = wallargs->BaseColormap();
|
||||||
if (basecolormap)
|
if (basecolormap)
|
||||||
{
|
{
|
||||||
if (viewport->RenderTarget->IsBgra())
|
if (viewport->RenderTarget->IsBgra())
|
||||||
|
@ -79,20 +77,20 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return wallargs.TranslationMap();
|
return wallargs->TranslationMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* TranslationMap() const { return wallargs.TranslationMap(); }
|
uint8_t* TranslationMap() const { return wallargs->TranslationMap(); }
|
||||||
|
|
||||||
ShadeConstants ColormapConstants() const { return wallargs.ColormapConstants(); }
|
ShadeConstants ColormapConstants() const { return wallargs->ColormapConstants(); }
|
||||||
fixed_t Light() const { return LIGHTSCALE(mLight, mShade); }
|
fixed_t Light() const { return LIGHTSCALE(mLight, mShade); }
|
||||||
|
|
||||||
FLightNode* LightList() const { return wallargs.lightlist; }
|
FLightNode* LightList() const { return wallargs->lightlist; }
|
||||||
|
|
||||||
|
const WallDrawerArgs* wallargs;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const WallDrawerArgs& wallargs;
|
|
||||||
|
|
||||||
uint8_t* dc_dest = nullptr;
|
uint8_t* dc_dest = nullptr;
|
||||||
int dc_dest_y = 0;
|
int dc_dest_y = 0;
|
||||||
int dc_count = 0;
|
int dc_count = 0;
|
||||||
|
|
|
@ -34,6 +34,8 @@ EXTERN_CVAR(Int, r_multithreaded)
|
||||||
|
|
||||||
class PolyTriangleThreadData;
|
class PolyTriangleThreadData;
|
||||||
|
|
||||||
|
namespace swrenderer { class WallColumnDrawerArgs; }
|
||||||
|
|
||||||
// Worker data for each thread executing drawer commands
|
// Worker data for each thread executing drawer commands
|
||||||
class DrawerThread
|
class DrawerThread
|
||||||
{
|
{
|
||||||
|
@ -61,6 +63,7 @@ public:
|
||||||
const uint8_t *tiltlighting[MAXWIDTH];
|
const uint8_t *tiltlighting[MAXWIDTH];
|
||||||
|
|
||||||
std::shared_ptr<PolyTriangleThreadData> poly;
|
std::shared_ptr<PolyTriangleThreadData> poly;
|
||||||
|
std::shared_ptr<swrenderer::WallColumnDrawerArgs> columndrawer;
|
||||||
|
|
||||||
size_t debug_draw_pos = 0;
|
size_t debug_draw_pos = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue