- merged gzdoom-gles2 and fixed some issues with pipeline size validation.

This commit is contained in:
Christoph Oelckers 2021-08-03 18:46:45 +02:00
commit 441cd0796f
116 changed files with 12502 additions and 80 deletions

View file

@ -107,7 +107,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
R_SetupFrame(mainvp, r_viewwindow, camera);
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && gl_light_shadowmap && screen->mPipelineType == 0 && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
{
screen->SetAABBTree(camera->Level->aabbTree);
screen->mShadowMap.SetCollectLights([=] {
@ -151,6 +151,10 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
di->SetViewArea();
auto cm = di->SetFullbrightFlags(mainview ? vp.camera->player : nullptr);
float flash = 1.f;
// Only used by the GLES2 renderer
RenderState.SetSpecialColormap(cm, flash);
di->Viewpoint.FieldOfView = fov; // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint)
// Stereo mode specific perspective projection
@ -161,6 +165,9 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
di->ProcessScene(toscreen);
// Reset colormap so 2D drawing isn't affected
RenderState.SetSpecialColormap(CM_DEFAULT, 1);
if (mainview)
{
PostProcess.Clock();
@ -262,8 +269,8 @@ void WriteSavePic(player_t* player, FileWriter* file, int width, int height)
screen->ImageTransitionScene(true);
hw_ClearFakeFlat();
RenderState.SetVertexBuffer(screen->mVertexData);
screen->mVertexData->Reset();
RenderState.SetVertexBuffer(screen->mVertexData);
screen->mLights->Clear();
screen->mViewpoints->Clear();

View file

@ -26,7 +26,7 @@
#include "hw_vertexbuilder.h"
#include "flatvertices.h"
#include "earcut.hpp"
#include "v_video.h"
//=============================================================================
//
@ -222,7 +222,8 @@ static int CreateIndexedVertices(FFlatVertexBuffer* fvb, int h, sector_t* sec, c
auto& vbo_shadowdata = fvb->vbo_shadowdata;
sec->vboindex[h] = vbo_shadowdata.Size();
// First calculate the vertices for the sector itself
sec->vboheight[h] = sec->GetPlaneTexZ(h);
for (int n = 0; n < screen->mPipelineNbr; n++)
sec->vboheight[n][h] = sec->GetPlaneTexZ(h);
sec->ibocount = verts[sec->Index()].indices.Size();
sec->iboindex[h] = CreateIndexedSectorVertices(fvb, sec, plane, floor, verts[sec->Index()]);
@ -335,6 +336,8 @@ static void UpdatePlaneVertices(FFlatVertexBuffer *fvb, sector_t* sec, int plane
if (plane == sector_t::floor && sec->transdoor) vt->z -= 1;
mapvt->z = vt->z;
}
fvb->mVertexBuffer->Upload(startvt * sizeof(FFlatVertex), countvt * sizeof(FFlatVertex));
}
//==========================================================================
@ -357,15 +360,15 @@ static void CreateVertices(FFlatVertexBuffer* fvb, TArray<sector_t>& sectors)
static void CheckPlanes(FFlatVertexBuffer* fvb, sector_t* sector)
{
if (sector->GetPlaneTexZ(sector_t::ceiling) != sector->vboheight[sector_t::ceiling])
if (sector->GetPlaneTexZ(sector_t::ceiling) != sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::ceiling])
{
UpdatePlaneVertices(fvb, sector, sector_t::ceiling);
sector->vboheight[sector_t::ceiling] = sector->GetPlaneTexZ(sector_t::ceiling);
sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::ceiling] = sector->GetPlaneTexZ(sector_t::ceiling);
}
if (sector->GetPlaneTexZ(sector_t::floor) != sector->vboheight[sector_t::floor])
if (sector->GetPlaneTexZ(sector_t::floor) != sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::floor])
{
UpdatePlaneVertices(fvb, sector, sector_t::floor);
sector->vboheight[sector_t::floor] = sector->GetPlaneTexZ(sector_t::floor);
sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::floor] = sector->GetPlaneTexZ(sector_t::floor);
}
}

View file

@ -266,7 +266,8 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca
dest->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false);
dest->SetPlaneTexZQuick(sector_t::floor, s->GetPlaneTexZ(sector_t::floor));
dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::floor] = s->vboheight[n][sector_t::floor];
}
else if (s->MoreFlags & SECMF_FAKEFLOORONLY)
{
@ -292,7 +293,8 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca
dest->floorplane = s->floorplane;
dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::floor] = s->vboheight[n][sector_t::floor];
}
if (!(s->MoreFlags&SECMF_FAKEFLOORONLY))
@ -304,7 +306,8 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca
dest->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false);
dest->SetPlaneTexZQuick(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling));
dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakeceiling];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::ceiling];
}
}
else
@ -312,7 +315,8 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca
dest->ceilingplane = s->ceilingplane;
dest->SetPlaneTexZQuick(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling));
dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakeceiling];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::ceiling];
}
}
@ -326,10 +330,12 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca
dest->ceilingplane.FlipVert();
dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::floor];
dest->vboheight[sector_t::floor] = sec->vboheight[sector_t::floor];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::floor] = sec->vboheight[n][sector_t::floor];
dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::floor];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::floor];
dest->ClearPortal(sector_t::ceiling);
@ -379,10 +385,12 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca
dest->floorplane.FlipVert();
dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakeceiling];
dest->vboheight[sector_t::floor] = s->vboheight[sector_t::ceiling];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::floor] = sec->vboheight[n][sector_t::ceiling];
dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::ceiling];
dest->vboheight[sector_t::ceiling] = sec->vboheight[sector_t::ceiling];
for (int n = 0; n < screen->mPipelineNbr; n++)
dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::ceiling];
dest->ClearPortal(sector_t::floor);

View file

@ -158,6 +158,8 @@ public:
struct HWLinePortal : public HWScenePortalBase
{
uint32_t PAD; // This fixes walls not being drawn in portals in 32bit machines..seems to be OK this is here for 64bit also..
// this must be the same as at the start of line_t, so that we can pass in this structure directly to P_ClipLineToPortal.
vertex_t *v1, *v2; // vertices, from v1 to v2
DVector2 delta; // precalculated v2 - v1 for side checking