Begin removing binding points from the hwrenderer layer.

Well known buffers should be created and managed by the backend, otherwise the backend just becomes an OpenGL emulator.
This commit is contained in:
Magnus Norddahl 2023-04-16 19:30:27 +02:00
commit 6894eb013f
35 changed files with 265 additions and 238 deletions

View file

@ -69,16 +69,16 @@ void CleanSWDrawer()
void CollectLights(FLevelLocals* Level)
{
IShadowMap* sm = &screen->mShadowMap;
ShadowMap* sm = screen->mShadowMap;
int lightindex = 0;
// Todo: this should go through the blockmap in a spiral pattern around the player so that closer lights are preferred.
for (auto light = Level->lights; light; light = light->next)
{
IShadowMap::LightsProcessed++;
ShadowMap::LightsProcessed++;
if (light->shadowmapped && light->IsActive() && lightindex < 1024)
{
IShadowMap::LightsShadowmapped++;
ShadowMap::LightsShadowmapped++;
light->mShadowmapIndex = lightindex;
sm->SetLight(lightindex, (float)light->X(), (float)light->Y(), (float)light->Z(), light->GetRadius());
@ -113,7 +113,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && camera->Level->HasDynamicLights && gl_light_shadowmap && screen->allowSSBO() && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
{
screen->SetAABBTree(camera->Level->aabbTree);
screen->mShadowMap.SetCollectLights([=] {
screen->mShadowMap->SetCollectLights([=] {
CollectLights(camera->Level);
});
screen->UpdateShadowMap();
@ -122,7 +122,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
{
// null all references to the level if we do not need a shadowmap. This will shortcut all internal calculations without further checks.
screen->SetAABBTree(nullptr);
screen->mShadowMap.SetCollectLights(nullptr);
screen->mShadowMap->SetCollectLights(nullptr);
}
screen->SetLevelMesh(camera->Level->levelMesh);