- moved contents of gl_templates.h to files outside of gl/

This commit is contained in:
Christoph Oelckers 2018-04-01 11:59:12 +02:00
parent e49cd2cb83
commit 1461059dae
16 changed files with 48 additions and 118 deletions

View file

@ -66,7 +66,6 @@
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/textures/gl_samplers.h" #include "gl/textures/gl_samplers.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
#include "gl/models/gl_models.h" #include "gl/models/gl_models.h"
#include "gl/dynlights/gl_lightbuffer.h" #include "gl/dynlights/gl_lightbuffer.h"
#include "r_videoscale.h" #include "r_videoscale.h"

View file

@ -44,7 +44,6 @@
#include "gl/renderer/gl_renderstate.h" #include "gl/renderer/gl_renderstate.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"
#include "gl/stereo3d/scoped_color_mask.h" #include "gl/stereo3d/scoped_color_mask.h"
#include "gl/renderer/gl_quaddrawer.h" #include "gl/renderer/gl_quaddrawer.h"

View file

@ -54,7 +54,6 @@
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_convert.h" #include "gl/utility/gl_convert.h"
#include "gl/utility/gl_templates.h"
#include "gl/renderer/gl_quaddrawer.h" #include "gl/renderer/gl_quaddrawer.h"
#ifdef _DEBUG #ifdef _DEBUG

View file

@ -56,7 +56,6 @@
#include "gl/stereo3d/scoped_color_mask.h" #include "gl/stereo3d/scoped_color_mask.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -37,10 +37,8 @@
#define __GL_PORTAL_H #define __GL_PORTAL_H
#include "tarray.h" #include "tarray.h"
//#include "gl/gl_intern.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/scene/gl_drawinfo.h" #include "gl/scene/gl_drawinfo.h"
#include "gl/utility/gl_templates.h"
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"
struct GLHorizonInfo struct GLHorizonInfo

View file

@ -39,13 +39,10 @@
#include "gl/scene/gl_portal.h" #include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h" #include "gl/scene/gl_scenedrawer.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
// This is for debugging maps. // This is for debugging maps.
FreeList<gl_subsectorrendernode> SSR_List;
// profiling data // profiling data
static int totalupper, totallower; static int totalupper, totallower;
static int lowershcount, uppershcount; static int lowershcount, uppershcount;
@ -62,7 +59,7 @@ void FDrawInfo::ClearBuffers()
{ {
gl_subsectorrendernode * n = node; gl_subsectorrendernode * n = node;
node = node->next; node = node->next;
SSR_List.Release(n); delete n;
} }
} }
otherfloorplanes.Clear(); otherfloorplanes.Clear();
@ -74,7 +71,7 @@ void FDrawInfo::ClearBuffers()
{ {
gl_subsectorrendernode * n = node; gl_subsectorrendernode * n = node;
node = node->next; node = node->next;
SSR_List.Release(n); delete n;
} }
} }
otherceilingplanes.Clear(); otherceilingplanes.Clear();
@ -507,7 +504,7 @@ void FDrawInfo::HandleMissingTextures()
for (unsigned int j = 0; j < HandledSubsectors.Size(); j++) for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherCeilingPlane(sec->sectornum, node); AddOtherCeilingPlane(sec->sectornum, node);
@ -551,7 +548,7 @@ void FDrawInfo::HandleMissingTextures()
for (unsigned int j = 0; j < HandledSubsectors.Size(); j++) for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherCeilingPlane(fakesector->sectornum, node); AddOtherCeilingPlane(fakesector->sectornum, node);
} }
@ -579,7 +576,7 @@ void FDrawInfo::HandleMissingTextures()
for (unsigned int j = 0; j < HandledSubsectors.Size(); j++) for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherFloorPlane(sec->sectornum, node); AddOtherFloorPlane(sec->sectornum, node);
} }
@ -622,7 +619,7 @@ void FDrawInfo::HandleMissingTextures()
for (unsigned int j = 0; j < HandledSubsectors.Size(); j++) for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherFloorPlane(fakesector->sectornum, node); AddOtherFloorPlane(fakesector->sectornum, node);
} }
@ -955,7 +952,7 @@ void FDrawInfo::HandleHackedSubsectors()
{ {
for(unsigned int j=0;j<HandledSubsectors.Size();j++) for(unsigned int j=0;j<HandledSubsectors.Size();j++)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherFloorPlane(sub->render_sector->sectornum, node); AddOtherFloorPlane(sub->render_sector->sectornum, node);
@ -985,7 +982,7 @@ void FDrawInfo::HandleHackedSubsectors()
{ {
for(unsigned int j=0;j<HandledSubsectors.Size();j++) for(unsigned int j=0;j<HandledSubsectors.Size();j++)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherCeilingPlane(sub->render_sector->sectornum, node); AddOtherCeilingPlane(sub->render_sector->sectornum, node);
@ -1159,7 +1156,7 @@ void FDrawInfo::ProcessSectorStacks()
if (sec->GetAlpha(sector_t::ceiling) != 0 && sec->GetTexture(sector_t::ceiling) != skyflatnum) if (sec->GetAlpha(sector_t::ceiling) != 0 && sec->GetTexture(sector_t::ceiling) != skyflatnum)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = sub; node->sub = sub;
AddOtherCeilingPlane(sec->sectornum, node); AddOtherCeilingPlane(sec->sectornum, node);
} }
@ -1205,7 +1202,7 @@ void FDrawInfo::ProcessSectorStacks()
if (sec->GetAlpha(sector_t::floor) != 0 && sec->GetTexture(sector_t::floor) != skyflatnum) if (sec->GetAlpha(sector_t::floor) != 0 && sec->GetTexture(sector_t::floor) != skyflatnum)
{ {
gl_subsectorrendernode * node = SSR_List.GetNew(); gl_subsectorrendernode * node = new gl_subsectorrendernode;
node->sub = sub; node->sub = sub;
AddOtherFloorPlane(sec->sectornum, node); AddOtherFloorPlane(sec->sectornum, node);
} }

View file

@ -68,7 +68,6 @@
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_convert.h" #include "gl/utility/gl_convert.h"
#include "gl/utility/gl_templates.h"
//========================================================================== //==========================================================================
// //

View file

@ -34,7 +34,6 @@
#include "gl/scene/gl_portal.h" #include "gl/scene/gl_portal.h"
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_templates.h"
EXTERN_CVAR(Bool, gl_seamless) EXTERN_CVAR(Bool, gl_seamless)

View file

@ -45,7 +45,6 @@
#include "gl/scene/gl_scenedrawer.h" #include "gl/scene/gl_scenedrawer.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"

View file

@ -45,7 +45,6 @@
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
#include "gl/renderer/gl_quaddrawer.h" #include "gl/renderer/gl_quaddrawer.h"
EXTERN_CVAR(Bool, gl_seamless) EXTERN_CVAR(Bool, gl_seamless)

View file

@ -45,7 +45,6 @@
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"
#include "gl/textures/gl_hwtexture.h" #include "gl/textures/gl_hwtexture.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_templates.h"
#include "gl/gl_functions.h" #include "gl/gl_functions.h"
#include "gl/data/gl_vertexbuffer.h" #include "gl/data/gl_vertexbuffer.h"
#include "gl_debug.h" #include "gl_debug.h"

View file

@ -41,7 +41,6 @@
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/textures/gl_samplers.h" #include "gl/textures/gl_samplers.h"
#include "gl/utility/gl_templates.h"
#include "gl/data/gl_vertexbuffer.h" #include "gl/data/gl_vertexbuffer.h"

View file

@ -1,9 +0,0 @@
#ifndef __GL_TEXTURE_H__
#define __GL_TEXTURE_H__
#include "r_defs.h"
#include "textures/textures.h"
#endif // __GL_HQRESIZE_H__

View file

@ -1,82 +0,0 @@
#ifndef __GL_BASIC
#define __GL_BASIC
#include <new>
#include "stats.h"
// Disabled because it doesn't work and only accumulates large portions of blocked heap
// without providing any relevant performance boost.
template <class T> struct FreeList
{
//T * freelist;
T * GetNew()
{
/*
if (freelist)
{
T * n=freelist;
freelist=*((T**)n);
return new ((void*)n) T;
}
*/
return new T;
}
void Release(T * node)
{
/*
node->~T();
*((T**)node) = freelist;
freelist=node;
*/
delete node;
}
~FreeList()
{
/*
while (freelist!=NULL)
{
T * n = freelist;
freelist=*((T**)n);
delete n;
}
*/
}
};
template<class T> class UniqueList
{
TArray<T*> Array;
FreeList<T> TheFreeList;
public:
T * Get(T * t)
{
for(unsigned i=0;i<Array.Size();i++)
{
if (!memcmp(t, Array[i], sizeof(T))) return Array[i];
}
T * newo=TheFreeList.GetNew();
*newo=*t;
Array.Push(newo);
return newo;
}
void Clear()
{
for(unsigned i=0;i<Array.Size();i++) TheFreeList.Release(Array[i]);
Array.Clear();
}
~UniqueList()
{
Clear();
}
};
#endif

View file

@ -50,12 +50,10 @@
#include "gl/system/gl_system.h" #include "gl/system/gl_system.h"
#include "r_defs.h" #include "r_defs.h"
#include "gl/gl_functions.h" #include "gl/gl_functions.h"
//#include "gl/gl_intern.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"
#include "gl/utility/gl_templates.h"
#include "gl/textures/gl_material.h" #include "gl/textures/gl_material.h"
#include "gl/system/gl_cvars.h" #include "gl/system/gl_cvars.h"

View file

@ -1221,3 +1221,41 @@ protected:
hash_t Position; hash_t Position;
}; };
//==========================================================================
//
// an array to hold a small number of unique entries
//
//==========================================================================
template<class T> class UniqueList
{
TArray<T*> Array;
public:
T * Get(T * t)
{
for (unsigned i = 0; i<Array.Size(); i++)
{
if (!memcmp(t, Array[i], sizeof(T))) return Array[i];
}
T * newo = new T;
*newo = *t;
Array.Push(newo);
return newo;
}
void Clear()
{
for (unsigned i = 0; i<Array.Size(); i++) delete Array[i];
Array.Clear();
}
~UniqueList()
{
Clear();
}
};