From 83e706afe74d01291b7ce055c180d812ff3e54bc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 27 Oct 2018 22:04:13 +0200 Subject: [PATCH] - - removed the remains of the old FVertexBuffer class. --- src/CMakeLists.txt | 1 - src/gl/data/gl_vertexbuffer.cpp | 93 ------------------------- src/gl/data/gl_vertexbuffer.h | 89 ----------------------- src/gl/models/gl_models.cpp | 2 + src/gl/models/gl_models.h | 1 - src/gl/renderer/gl_postprocess.cpp | 2 +- src/gl/renderer/gl_postprocessstate.cpp | 1 - src/gl/renderer/gl_renderer.cpp | 51 +++++++------- src/gl/renderer/gl_renderstate.cpp | 40 +++-------- src/gl/renderer/gl_renderstate.h | 13 ---- src/gl/scene/gl_drawinfo.cpp | 4 +- src/gl/scene/gl_scene.cpp | 4 +- src/gl/scene/gl_walls_draw.cpp | 1 - src/gl/system/gl_framebuffer.cpp | 3 +- src/hwrenderer/scene/hw_renderstate.h | 10 --- src/hwrenderer/scene/hw_skyportal.cpp | 3 +- 16 files changed, 50 insertions(+), 268 deletions(-) delete mode 100644 src/gl/data/gl_vertexbuffer.cpp delete mode 100644 src/gl/data/gl_vertexbuffer.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71aab5ad21..aafe951290 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1037,7 +1037,6 @@ set (PCH_SOURCES g_statusbar/sbarinfo.cpp g_statusbar/sbar_mugshot.cpp g_statusbar/shared_sbar.cpp - gl/data/gl_vertexbuffer.cpp gl/data/gl_uniformbuffer.cpp gl/data/gl_viewpointbuffer.cpp gl/dynlights/gl_lightbuffer.cpp diff --git a/src/gl/data/gl_vertexbuffer.cpp b/src/gl/data/gl_vertexbuffer.cpp deleted file mode 100644 index bf1302dcc7..0000000000 --- a/src/gl/data/gl_vertexbuffer.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// -//--------------------------------------------------------------------------- -// -// Copyright(C) 2005-2016 Christoph Oelckers -// All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see http://www.gnu.org/licenses/ -// -//-------------------------------------------------------------------------- -// -/* -** gl_vertexbuffer.cpp -** Vertex buffer handling. -** -**/ - -#include "gl_load/gl_system.h" -#include "doomtype.h" -#include "p_local.h" -#include "r_state.h" -#include "cmdlib.h" -#include "gl_load/gl_interface.h" -#include "gl/renderer/gl_renderer.h" -#include "gl/shaders/gl_shader.h" -#include "gl/data/gl_vertexbuffer.h" - - -//========================================================================== -// -// Create / destroy the VBO -// -//========================================================================== - -FVertexBuffer::FVertexBuffer(bool wantbuffer) -{ - vbo_id = 0; - if (wantbuffer) glGenBuffers(1, &vbo_id); -} - -FVertexBuffer::~FVertexBuffer() -{ - if (vbo_id != 0) - { - glDeleteBuffers(1, &vbo_id); - } -} - - -void FSimpleVertexBuffer::BindVBO() -{ - glBindBuffer(GL_ARRAY_BUFFER, vbo_id); - glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FSimpleVertex), &VSiO->x); - glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FSimpleVertex), &VSiO->u); - glVertexAttribPointer(VATTR_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(FSimpleVertex), &VSiO->color); - glEnableVertexAttribArray(VATTR_VERTEX); - glEnableVertexAttribArray(VATTR_TEXCOORD); - glEnableVertexAttribArray(VATTR_COLOR); - glDisableVertexAttribArray(VATTR_VERTEX2); - glDisableVertexAttribArray(VATTR_NORMAL); -} - -void FSimpleVertexBuffer::EnableColorArray(bool on) -{ - if (on) - { - glEnableVertexAttribArray(VATTR_COLOR); - } - else - { - glDisableVertexAttribArray(VATTR_COLOR); - } -} - - -void FSimpleVertexBuffer::set(FSimpleVertex *verts, int count) -{ - glBindBuffer(GL_ARRAY_BUFFER, vbo_id); - gl_RenderState.ResetVertexBuffer(); - gl_RenderState.SetVertexBuffer(this); - glBufferData(GL_ARRAY_BUFFER, count * sizeof(*verts), verts, GL_STREAM_DRAW); -} - diff --git a/src/gl/data/gl_vertexbuffer.h b/src/gl/data/gl_vertexbuffer.h deleted file mode 100644 index 44d7ba35bb..0000000000 --- a/src/gl/data/gl_vertexbuffer.h +++ /dev/null @@ -1,89 +0,0 @@ -// -//--------------------------------------------------------------------------- -// -// Copyright(C) 2005-2016 Christoph Oelckers -// All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see http://www.gnu.org/licenses/ -// -//-------------------------------------------------------------------------- -// - -#ifndef __VERTEXBUFFER_H -#define __VERTEXBUFFER_H - -#include -#include -#include -#include "tarray.h" -#include "hwrenderer/utility/hw_clock.h" -#include "gl_load/gl_interface.h" -#include "r_data/models/models.h" -#include "hwrenderer/data/flatvertices.h" -#include "hwrenderer/scene/hw_skydome.h" -#include "hwrenderer/data/vertexbuffer.h" - -struct vertex_t; -struct secplane_t; -struct subsector_t; -struct sector_t; -class FMaterial; -class FRenderState; - - - -class FVertexBuffer -{ -protected: - unsigned int vbo_id; - -public: - FVertexBuffer(bool wantbuffer = true); - virtual ~FVertexBuffer(); - virtual void BindVBO() = 0; -}; - -struct FSimpleVertex -{ - float x, z, y; // world position - float u, v; // texture coordinates - PalEntry color; - - void Set(float xx, float zz, float yy, float uu = 0, float vv = 0, PalEntry col = 0xffffffff) - { - x = xx; - z = zz; - y = yy; - u = uu; - v = vv; - color = col; - } -}; - -#define VTO ((FFlatVertex*)NULL) -#define VSiO ((FSimpleVertex*)NULL) - -class FSimpleVertexBuffer : public FVertexBuffer -{ - TArray mBuffer; -public: - FSimpleVertexBuffer() - { - } - void BindVBO(); - void set(FSimpleVertex *verts, int count); - void EnableColorArray(bool on); -}; - -#endif \ No newline at end of file diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 723e50ce07..2f72e485c7 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -37,6 +37,8 @@ #include "i_time.h" #include "cmdlib.h" #include "hwrenderer/textures/hw_material.h" +#include "hwrenderer/data/vertexbuffer.h" +#include "hwrenderer/data/flatvertices.h" #include "gl_load/gl_interface.h" #include "gl/renderer/gl_renderer.h" diff --git a/src/gl/models/gl_models.h b/src/gl/models/gl_models.h index 786391cd5f..53ae922c74 100644 --- a/src/gl/models/gl_models.h +++ b/src/gl/models/gl_models.h @@ -23,7 +23,6 @@ #pragma once #include "tarray.h" -#include "gl/data/gl_vertexbuffer.h" #include "p_pspr.h" #include "r_data/voxels.h" #include "r_data/models/models.h" diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 737c6d6ce4..8779544b8e 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -37,11 +37,11 @@ #include "gl/renderer/gl_renderbuffers.h" #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_postprocessstate.h" -#include "gl/data/gl_vertexbuffer.h" #include "hwrenderer/postprocessing/hw_presentshader.h" #include "hwrenderer/postprocessing/hw_postprocess.h" #include "hwrenderer/postprocessing/hw_postprocess_cvars.h" #include "hwrenderer/utility/hw_vrmodes.h" +#include "hwrenderer/data/flatvertices.h" #include "gl/shaders/gl_postprocessshaderinstance.h" #include "gl/textures/gl_hwtexture.h" #include "r_videoscale.h" diff --git a/src/gl/renderer/gl_postprocessstate.cpp b/src/gl/renderer/gl_postprocessstate.cpp index 1edcc949be..f213491827 100644 --- a/src/gl/renderer/gl_postprocessstate.cpp +++ b/src/gl/renderer/gl_postprocessstate.cpp @@ -28,7 +28,6 @@ #include "templates.h" #include "gl_load/gl_system.h" #include "gl_load/gl_interface.h" -#include "gl/data/gl_vertexbuffer.h" #include "gl/renderer/gl_postprocessstate.h" //----------------------------------------------------------------------------- diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 1d43e1fb4d..0d09042b7c 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -35,6 +35,7 @@ #include "p_effect.h" #include "d_player.h" #include "a_dynlight.h" +#include "cmdlib.h" #include "g_game.h" #include "swrenderer/r_swscene.h" #include "hwrenderer/utility/hw_clock.h" @@ -46,17 +47,19 @@ #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderstate.h" #include "gl/renderer/gl_renderbuffers.h" -#include "gl/data/gl_vertexbuffer.h" #include "gl/scene/gl_drawinfo.h" #include "hwrenderer/utility/hw_vrmodes.h" #include "hwrenderer/postprocessing/hw_presentshader.h" #include "hwrenderer/postprocessing/hw_present3dRowshader.h" #include "hwrenderer/postprocessing/hw_shadowmapshader.h" +#include "hwrenderer/data/flatvertices.h" +#include "hwrenderer/scene/hw_skydome.h" #include "gl/shaders/gl_postprocessshaderinstance.h" #include "gl/textures/gl_samplers.h" #include "gl/dynlights/gl_lightbuffer.h" #include "gl/data/gl_viewpointbuffer.h" #include "r_videoscale.h" +#include "r_data/models/models.h" EXTERN_CVAR(Int, screenblocks) EXTERN_CVAR(Bool, cl_capfps) @@ -362,41 +365,42 @@ void FGLRenderer::BeginFrame() // //=========================================================================== -class F2DVertexBuffer : public FSimpleVertexBuffer +class F2DVertexBuffer { - uint32_t ibo_id; + IVertexBuffer *mVertexBuffer; + IIndexBuffer *mIndexBuffer; - // Make sure we can build upon FSimpleVertexBuffer. - static_assert(offsetof(FSimpleVertex, x) == offsetof(F2DDrawer::TwoDVertex, x), "x not aligned"); - static_assert(offsetof(FSimpleVertex, u) == offsetof(F2DDrawer::TwoDVertex, u), "u not aligned"); - static_assert(offsetof(FSimpleVertex, color) == offsetof(F2DDrawer::TwoDVertex, color0), "color not aligned"); public: F2DVertexBuffer() { - glGenBuffers(1, &ibo_id); + mVertexBuffer = screen->CreateVertexBuffer(); + mIndexBuffer = screen->CreateIndexBuffer(); + + static const FVertexBufferAttribute format[] = { + { 0, VATTR_VERTEX, VFmt_Float3, myoffsetof(F2DDrawer::TwoDVertex, x) }, + { 0, VATTR_TEXCOORD, VFmt_Float2, myoffsetof(F2DDrawer::TwoDVertex, u) }, + { 0, VATTR_COLOR, VFmt_Byte4, myoffsetof(F2DDrawer::TwoDVertex, color0) } + }; + mVertexBuffer->SetFormat(1, 3, sizeof(FSkyVertex), format); } ~F2DVertexBuffer() { - if (ibo_id != 0) - { - glDeleteBuffers(1, &ibo_id); - } + delete mIndexBuffer; + delete mVertexBuffer; } + void UploadData(F2DDrawer::TwoDVertex *vertices, int vertcount, int *indices, int indexcount) { - glBindBuffer(GL_ARRAY_BUFFER, vbo_id); - glBufferData(GL_ARRAY_BUFFER, vertcount * sizeof(vertices[0]), vertices, GL_STREAM_DRAW); - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexcount * sizeof(indices[0]), indices, GL_STREAM_DRAW); + mVertexBuffer->SetData(vertcount * sizeof(*vertices), vertices, false); + mIndexBuffer->SetData(indexcount * sizeof(unsigned int), indices, false); } - void BindVBO() override + void Bind(FRenderState &state) { - FSimpleVertexBuffer::BindVBO(); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id); + state.SetVertexBuffer(mVertexBuffer, 0, 0); + state.SetIndexBuffer(mIndexBuffer); } }; @@ -446,9 +450,9 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer) // Change from BGRA to RGBA std::swap(v.color0.r, v.color0.b); } - auto vb = new F2DVertexBuffer; - vb->UploadData(&vertices[0], vertices.Size(), &indices[0], indices.Size()); - gl_RenderState.SetVertexBuffer(vb); + F2DVertexBuffer vb; + vb.UploadData(&vertices[0], vertices.Size(), &indices[0], indices.Size()); + vb.Bind(gl_RenderState); gl_RenderState.EnableFog(false); for(auto &cmd : commands) @@ -544,7 +548,6 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer) gl_RenderState.EnableFog(false); gl_RenderState.ResetColor(); gl_RenderState.Apply(); - delete vb; FGLDebug::PopGroup(); twoD.Unclock(); } diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index 082a2e117c..1ca2579f1b 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -30,8 +30,9 @@ #include "r_data/colormaps.h" #include "gl_load/gl_system.h" #include "gl_load/gl_interface.h" -#include "gl/data/gl_vertexbuffer.h" #include "hwrenderer/utility/hw_cvars.h" +#include "hwrenderer/data/flatvertices.h" +#include "hwrenderer/scene/hw_skydome.h" #include "gl/shaders/gl_shader.h" #include "gl/renderer/gl_renderer.h" #include "gl/dynlights//gl_lightbuffer.h" @@ -263,30 +264,18 @@ void FGLRenderState::ApplyState() void FGLRenderState::ApplyBuffers() { - if (mVertexBuffer != nullptr) + if (mVertexBuffer != mCurrentVertexBuffer || mVertexOffsets[0] != mCurrentVertexOffsets[0] || mVertexOffsets[1] != mCurrentVertexOffsets[1]) { - if (mVertexBuffer != mCurrentVertexBuffer || mVertexOffsets[0] != mCurrentVertexOffsets[0] || mVertexOffsets[1] != mCurrentVertexOffsets[1]) - { - assert(mVertexBuffer != nullptr); - static_cast(mVertexBuffer)->Bind(mVertexOffsets); - mCurrentVertexBuffer = mVertexBuffer; - mCurrentVertexOffsets[0] = mVertexOffsets[0]; - mCurrentVertexOffsets[1] = mVertexOffsets[1]; - mCurrentFVertexBuffer = nullptr; - } - if (mIndexBuffer != mCurrentIndexBuffer) - { - if (mIndexBuffer) static_cast(mIndexBuffer)->Bind(); - mCurrentIndexBuffer = mIndexBuffer; - } + assert(mVertexBuffer != nullptr); + static_cast(mVertexBuffer)->Bind(mVertexOffsets); + mCurrentVertexBuffer = mVertexBuffer; + mCurrentVertexOffsets[0] = mVertexOffsets[0]; + mCurrentVertexOffsets[1] = mVertexOffsets[1]; } - else if (mFVertexBuffer != mCurrentFVertexBuffer) + if (mIndexBuffer != mCurrentIndexBuffer) { - if (mFVertexBuffer == NULL) glBindBuffer(GL_ARRAY_BUFFER, 0); - else mFVertexBuffer->BindVBO(); - mCurrentFVertexBuffer = mFVertexBuffer; - mCurrentVertexBuffer = nullptr; - mCurrentIndexBuffer = nullptr; + if (mIndexBuffer) static_cast(mIndexBuffer)->Bind(); + mCurrentIndexBuffer = mIndexBuffer; } } @@ -391,10 +380,3 @@ void FGLRenderState::ApplyBlendMode() } } - -// Needs to be redone -void FGLRenderState::SetVertexBuffer(int which) -{ - if (which == VB_Sky) GLRenderer->mSkyVBO->Bind(*this); - else GLRenderer->mVBO->Bind(*this); -} diff --git a/src/gl/renderer/gl_renderstate.h b/src/gl/renderer/gl_renderstate.h index 31c605cf8c..27f47ca0a7 100644 --- a/src/gl/renderer/gl_renderstate.h +++ b/src/gl/renderer/gl_renderstate.h @@ -34,7 +34,6 @@ #include "r_data/r_translate.h" #include "g_levellocals.h" -class FVertexBuffer; class FShader; struct GLSectorPlane; extern TArray gl_MatrixStack; @@ -56,8 +55,6 @@ class FGLRenderState : public FRenderState float mInterpolationFactor; - FVertexBuffer *mFVertexBuffer, *mCurrentFVertexBuffer; - int mEffectState; int mTempTM = TM_NORMAL; @@ -107,17 +104,9 @@ public: void ApplyLightIndex(int index); void ApplyBlendMode(); - void SetVertexBuffer(FVertexBuffer *vb) - { - mFVertexBuffer = vb; - mVertexBuffer = nullptr; - mIndexBuffer = nullptr; - } - void ResetVertexBuffer() { // forces rebinding with the next 'apply' call. - mCurrentFVertexBuffer = nullptr; mVertexBuffer = nullptr; mIndexBuffer = nullptr; } @@ -174,8 +163,6 @@ public: return mPassType == GBUFFER_PASS ? 3 : 1; } - - void SetVertexBuffer(int which) override; }; extern FGLRenderState gl_RenderState; diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index cb13959cef..a588da1a98 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -34,8 +34,9 @@ #include "g_levellocals.h" #include "tarray.h" #include "hwrenderer/scene/hw_drawstructs.h" +#include "hwrenderer/data/flatvertices.h" +#include "hwrenderer/utility/hw_clock.h" -#include "gl/data/gl_vertexbuffer.h" #include "gl/scene/gl_drawinfo.h" #include "hwrenderer/scene/hw_clipper.h" #include "gl/renderer/gl_renderstate.h" @@ -259,6 +260,7 @@ void FDrawInfo::RenderPortal(HWPortal *p, bool usestencil) gl_RenderState.SetLightIndex(-1); gp->DrawContents(new_di, gl_RenderState); new_di->EndDrawInfo(); + GLRenderer->mVBO->Bind(gl_RenderState); GLRenderer->mViewpoints->Bind(vpIndex); gp->RemoveStencil(this, gl_RenderState, usestencil); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index e52c66cdd7..13e39d14a9 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -39,7 +39,10 @@ #include "p_local.h" #include "serializer.h" #include "g_levellocals.h" +#include "r_data/models/models.h" #include "hwrenderer/dynlights/hw_dynlightdata.h" +#include "hwrenderer/utility/hw_clock.h" +#include "hwrenderer/data/flatvertices.h" #include "gl/dynlights/gl_lightbuffer.h" #include "gl_load/gl_interface.h" @@ -48,7 +51,6 @@ #include "hwrenderer/utility/hw_cvars.h" #include "gl/renderer/gl_renderstate.h" #include "gl/renderer/gl_renderbuffers.h" -#include "gl/data/gl_vertexbuffer.h" #include "gl/data/gl_viewpointbuffer.h" #include "hwrenderer/scene/hw_clipper.h" #include "hwrenderer/scene/hw_portal.h" diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index 1e76f59457..213acb83f2 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -31,7 +31,6 @@ #include "gl_load/gl_interface.h" #include "hwrenderer/utility/hw_cvars.h" #include "gl/renderer/gl_renderer.h" -#include "gl/data/gl_vertexbuffer.h" #include "gl/dynlights/gl_lightbuffer.h" #include "gl/scene/gl_drawinfo.h" diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 19c3bd8673..0fd8afdfe2 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -38,7 +38,6 @@ #include "gl/textures/gl_samplers.h" #include "hwrenderer/utility/hw_clock.h" #include "hwrenderer/utility/hw_vrmodes.h" -#include "gl/data/gl_vertexbuffer.h" #include "gl/data/gl_uniformbuffer.h" #include "gl/models/gl_models.h" #include "gl/shaders/gl_shaderprogram.h" @@ -46,6 +45,8 @@ #include "r_videoscale.h" #include "glsys_vertexbuffer.h" +#include "hwrenderer/data/flatvertices.h" + EXTERN_CVAR (Bool, vid_vsync) FGLRenderer *GLRenderer; diff --git a/src/hwrenderer/scene/hw_renderstate.h b/src/hwrenderer/scene/hw_renderstate.h index bd304e3467..32488b5624 100644 --- a/src/hwrenderer/scene/hw_renderstate.h +++ b/src/hwrenderer/scene/hw_renderstate.h @@ -407,17 +407,7 @@ public: mIndexBuffer = ib; } - void SetColor(int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon = false); void SetFog(int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive); - - // Temporary helper to get around the lack of hardware independent vertex buffer interface. - // This needs to be done better so that abstract interfaces can be passed around between hwrenderer and the backends. - enum - { - VB_Default, - VB_Sky - }; - virtual void SetVertexBuffer(int which) = 0; }; diff --git a/src/hwrenderer/scene/hw_skyportal.cpp b/src/hwrenderer/scene/hw_skyportal.cpp index 8f53320800..431bac275e 100644 --- a/src/hwrenderer/scene/hw_skyportal.cpp +++ b/src/hwrenderer/scene/hw_skyportal.cpp @@ -180,7 +180,7 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state) di->SetupView(0, 0, 0, !!(mState->MirrorFlag & 1), !!(mState->PlaneMirrorFlag & 1)); - state.SetVertexBuffer(FRenderState::VB_Sky); + vertexBuffer->Bind(state); if (origin->texture[0] && origin->texture[0]->tex->bSkybox) { RenderBox(di, state, origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->sky2); @@ -215,7 +215,6 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state) state.SetObjectColor(0xffffffff); } } - state.SetVertexBuffer(FRenderState::VB_Default); ::level.lightmode = oldlightmode; di->SetDepthClamp(oldClamp); }