- cleanup of the buffer binding interface.

Some stuff is not really needed and the vertex buffers no longer need to insert themselves into the render state.
This commit is contained in:
Christoph Oelckers 2018-10-30 22:43:58 +01:00
parent 1be1470d47
commit e2e34f5245
6 changed files with 8 additions and 26 deletions

View file

@ -54,13 +54,6 @@ public:
} }
return index; return index;
} }
// The parameter is a reminder for Vulkan.
void BindBase(FRenderState &state)
{
mBuffer->BindBase();
}
}; };
int gl_SetDynModelLight(AActor *self, int dynlightindex); int gl_SetDynModelLight(AActor *self, int dynlightindex);

View file

@ -496,7 +496,6 @@ void HWDrawInfo::RenderScene(FRenderState &state)
state.SetDepthMask(true); state.SetDepthMask(true);
screen->mLights->BindBase(state); // not needed for OpenGL but necessary for Vulkan command buffers to do it here!
state.EnableFog(true); state.EnableFog(true);
state.SetRenderStyle(STYLE_Source); state.SetRenderStyle(STYLE_Source);

View file

@ -102,17 +102,6 @@ FSkyVertexBuffer::FSkyVertexBuffer()
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void FSkyVertexBuffer::Bind(FRenderState &state)
{
state.SetVertexBuffer(mVertexBuffer, 0, 0);
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void FSkyVertexBuffer::SkyVertex(int r, int c, bool zflip) void FSkyVertexBuffer::SkyVertex(int r, int c, bool zflip)
{ {
static const FAngle maxSideAngle = 60.f; static const FAngle maxSideAngle = 60.f;

View file

@ -68,7 +68,10 @@ public:
FSkyVertexBuffer(); FSkyVertexBuffer();
void SetupMatrices(FMaterial *tex, float x_offset, float y_offset, bool mirror, int mode, VSMatrix &modelmatrix, VSMatrix &textureMatrix); void SetupMatrices(FMaterial *tex, float x_offset, float y_offset, bool mirror, int mode, VSMatrix &modelmatrix, VSMatrix &textureMatrix);
void Bind(FRenderState &state); std::pair<IVertexBuffer *, IIndexBuffer *> GetBufferObjects() const
{
return std::make_pair(mVertexBuffer, nullptr);
}
int FaceStart(int i) int FaceStart(int i)
{ {

View file

@ -180,7 +180,7 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
di->SetupView(state, 0, 0, 0, !!(mState->MirrorFlag & 1), !!(mState->PlaneMirrorFlag & 1)); di->SetupView(state, 0, 0, 0, !!(mState->MirrorFlag & 1), !!(mState->PlaneMirrorFlag & 1));
vertexBuffer->Bind(state); state.SetVertexBuffer(vertexBuffer);
if (origin->texture[0] && origin->texture[0]->tex->bSkybox) if (origin->texture[0] && origin->texture[0]->tex->bSkybox)
{ {
RenderBox(di, state, origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->sky2); RenderBox(di, state, origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->sky2);

View file

@ -76,10 +76,9 @@ public:
mIndexBuffer->SetData(indexcount * sizeof(unsigned int), indices, false); mIndexBuffer->SetData(indexcount * sizeof(unsigned int), indices, false);
} }
void Bind(FRenderState &state) std::pair<IVertexBuffer *, IIndexBuffer *> GetBufferObjects() const
{ {
state.SetVertexBuffer(mVertexBuffer, 0, 0); return std::make_pair(mVertexBuffer, mIndexBuffer);
state.SetIndexBuffer(mIndexBuffer);
} }
}; };
@ -120,7 +119,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
} }
F2DVertexBuffer vb; F2DVertexBuffer vb;
vb.UploadData(&vertices[0], vertices.Size(), &indices[0], indices.Size()); vb.UploadData(&vertices[0], vertices.Size(), &indices[0], indices.Size());
vb.Bind(state); state.SetVertexBuffer(&vb);
state.EnableFog(false); state.EnableFog(false);
for(auto &cmd : commands) for(auto &cmd : commands)
@ -131,7 +130,6 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed)); state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
state.EnableFog(2); // Special 2D mode 'fog'. state.EnableFog(2); // Special 2D mode 'fog'.
// Rather than adding remapping code, let's enforce that the constants here are equal.
state.SetTextureMode(cmd.mDrawMode); state.SetTextureMode(cmd.mDrawMode);
int sciX, sciY, sciW, sciH; int sciX, sciY, sciW, sciH;