From 983fab378caf263e3f23b123eb1fb9b72d37a42b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 19 Jun 2013 01:38:23 +0200 Subject: [PATCH] Add rest of the diff from the old nevrax code for pixel programs to NL3D --HG-- branch : multipass-stereo --- code/nel/include/nel/3d/driver_user.h | 1 + code/nel/include/nel/3d/u_driver.h | 1 + code/nel/src/3d/driver.cpp | 5 +++++ code/nel/src/3d/driver_user.cpp | 6 ++++++ code/nel/src/3d/flare_model.cpp | 3 +++ code/nel/src/3d/scene.cpp | 4 ++++ 6 files changed, 20 insertions(+) diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index bfe4c1755..fff83d6d5 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -133,6 +133,7 @@ public: // @{ virtual void disableHardwareVertexProgram(); + virtual void disableHardwarePixelProgram(); virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareTextureShader(); diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index d66a72e47..1397c9c6e 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -168,6 +168,7 @@ public: */ // @{ virtual void disableHardwareVertexProgram()=0; + virtual void disableHardwarePixelProgram()=0; virtual void disableHardwareVertexArrayAGP()=0; virtual void disableHardwareTextureShader()=0; // @} diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index fa48649ae..d44079749 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -258,6 +258,11 @@ void IDriver::removeVtxPrgDrvInfoPtr(ItVtxPrgDrvInfoPtrList vtxPrgDrvInfoIt) { _VtxPrgDrvInfos.erase(vtxPrgDrvInfoIt); } +// *************************************************************************** +void IDriver::removePixelPrgDrvInfoPtr(ItPixelPrgDrvInfoPtrList pixelPrgDrvInfoIt) +{ + _PixelPrgDrvInfos.erase(pixelPrgDrvInfoIt); +} // *************************************************************************** bool IDriver::invalidateShareTexture (ITexture &texture) diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index b45ebbd37..83c7343ec 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -213,6 +213,12 @@ void CDriverUser::disableHardwareVertexProgram() _Driver->disableHardwareVertexProgram(); } +void CDriverUser::disableHardwarePixelProgram() +{ + NL3D_HAUTO_UI_DRIVER; + + _Driver->disableHardwarePixelProgram(); +} void CDriverUser::disableHardwareVertexArrayAGP() { NL3D_HAUTO_UI_DRIVER; diff --git a/code/nel/src/3d/flare_model.cpp b/code/nel/src/3d/flare_model.cpp index 47d9fdb43..ba5cc8098 100644 --- a/code/nel/src/3d/flare_model.cpp +++ b/code/nel/src/3d/flare_model.cpp @@ -363,6 +363,7 @@ void CFlareModel::traverseRender() } // setup driver drv->activeVertexProgram(NULL); + drv->activePixelProgram(NULL); drv->setupModelMatrix(fs->getLookAtMode() ? CMatrix::Identity : getWorldMatrix()); // we don't change the fustrum to draw 2d shapes : it is costly, and we need to restore it after the drawing has been done // we setup Z to be (near + far) / 2, and setup x and y to get the screen coordinates we want @@ -565,6 +566,7 @@ void CFlareModel::updateOcclusionQueryBegin(IDriver *drv) { nlassert(drv); drv->activeVertexProgram(NULL); + drv->activePixelProgram(NULL); drv->setupModelMatrix(CMatrix::Identity); initStatics(); drv->setColorMask(false, false, false, false); // don't write any pixel during the test @@ -661,6 +663,7 @@ void CFlareModel::occlusionTest(CMesh &mesh, IDriver &drv) } drv.setColorMask(false, false, false, false); // don't write any pixel during the test drv.activeVertexProgram(NULL); + drv.activePixelProgram(NULL); setupOcclusionMeshMatrix(drv, *_Scene); drv.activeVertexBuffer(const_cast(mesh.getVertexBuffer())); // query drawn count diff --git a/code/nel/src/3d/scene.cpp b/code/nel/src/3d/scene.cpp index df5297e2f..f257c7206 100644 --- a/code/nel/src/3d/scene.cpp +++ b/code/nel/src/3d/scene.cpp @@ -377,6 +377,9 @@ void CScene::endPartRender() // Reset profiling _NextRenderProfile= false; + IDriver *drv = getDriver(); + drv->activeVertexProgram(NULL); + drv->activePixelProgram(NULL); /* uint64 total = PSStatsRegisterPSModelObserver + @@ -1561,6 +1564,7 @@ void CScene::renderOcclusionTestMeshs() nlassert(RenderTrav.getDriver()); RenderTrav.getDriver()->setupViewport(RenderTrav.getViewport()); RenderTrav.getDriver()->activeVertexProgram(NULL); + RenderTrav.getDriver()->activePixelProgram(NULL); IDriver::TPolygonMode oldPolygonMode = RenderTrav.getDriver()->getPolygonMode(); CMaterial m; m.initUnlit();