Add rest of the diff from the old nevrax code for pixel programs to NL3D

This commit is contained in:
kaetemi 2013-06-19 01:38:23 +02:00
parent 7da48d8866
commit cb966505cc
6 changed files with 20 additions and 0 deletions

View file

@ -133,6 +133,7 @@ public:
// @{ // @{
virtual void disableHardwareVertexProgram(); virtual void disableHardwareVertexProgram();
virtual void disableHardwarePixelProgram();
virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareVertexArrayAGP();
virtual void disableHardwareTextureShader(); virtual void disableHardwareTextureShader();

View file

@ -168,6 +168,7 @@ public:
*/ */
// @{ // @{
virtual void disableHardwareVertexProgram()=0; virtual void disableHardwareVertexProgram()=0;
virtual void disableHardwarePixelProgram()=0;
virtual void disableHardwareVertexArrayAGP()=0; virtual void disableHardwareVertexArrayAGP()=0;
virtual void disableHardwareTextureShader()=0; virtual void disableHardwareTextureShader()=0;
// @} // @}

View file

@ -258,6 +258,11 @@ void IDriver::removeVtxPrgDrvInfoPtr(ItVtxPrgDrvInfoPtrList vtxPrgDrvInfoIt)
{ {
_VtxPrgDrvInfos.erase(vtxPrgDrvInfoIt); _VtxPrgDrvInfos.erase(vtxPrgDrvInfoIt);
} }
// ***************************************************************************
void IDriver::removePixelPrgDrvInfoPtr(ItPixelPrgDrvInfoPtrList pixelPrgDrvInfoIt)
{
_PixelPrgDrvInfos.erase(pixelPrgDrvInfoIt);
}
// *************************************************************************** // ***************************************************************************
bool IDriver::invalidateShareTexture (ITexture &texture) bool IDriver::invalidateShareTexture (ITexture &texture)

View file

@ -213,6 +213,12 @@ void CDriverUser::disableHardwareVertexProgram()
_Driver->disableHardwareVertexProgram(); _Driver->disableHardwareVertexProgram();
} }
void CDriverUser::disableHardwarePixelProgram()
{
NL3D_HAUTO_UI_DRIVER;
_Driver->disableHardwarePixelProgram();
}
void CDriverUser::disableHardwareVertexArrayAGP() void CDriverUser::disableHardwareVertexArrayAGP()
{ {
NL3D_HAUTO_UI_DRIVER; NL3D_HAUTO_UI_DRIVER;

View file

@ -363,6 +363,7 @@ void CFlareModel::traverseRender()
} }
// setup driver // setup driver
drv->activeVertexProgram(NULL); drv->activeVertexProgram(NULL);
drv->activePixelProgram(NULL);
drv->setupModelMatrix(fs->getLookAtMode() ? CMatrix::Identity : getWorldMatrix()); 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 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 // 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); nlassert(drv);
drv->activeVertexProgram(NULL); drv->activeVertexProgram(NULL);
drv->activePixelProgram(NULL);
drv->setupModelMatrix(CMatrix::Identity); drv->setupModelMatrix(CMatrix::Identity);
initStatics(); initStatics();
drv->setColorMask(false, false, false, false); // don't write any pixel during the test 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.setColorMask(false, false, false, false); // don't write any pixel during the test
drv.activeVertexProgram(NULL); drv.activeVertexProgram(NULL);
drv.activePixelProgram(NULL);
setupOcclusionMeshMatrix(drv, *_Scene); setupOcclusionMeshMatrix(drv, *_Scene);
drv.activeVertexBuffer(const_cast<CVertexBuffer &>(mesh.getVertexBuffer())); drv.activeVertexBuffer(const_cast<CVertexBuffer &>(mesh.getVertexBuffer()));
// query drawn count // query drawn count

View file

@ -377,6 +377,9 @@ void CScene::endPartRender()
// Reset profiling // Reset profiling
_NextRenderProfile= false; _NextRenderProfile= false;
IDriver *drv = getDriver();
drv->activeVertexProgram(NULL);
drv->activePixelProgram(NULL);
/* /*
uint64 total = PSStatsRegisterPSModelObserver + uint64 total = PSStatsRegisterPSModelObserver +
@ -1561,6 +1564,7 @@ void CScene::renderOcclusionTestMeshs()
nlassert(RenderTrav.getDriver()); nlassert(RenderTrav.getDriver());
RenderTrav.getDriver()->setupViewport(RenderTrav.getViewport()); RenderTrav.getDriver()->setupViewport(RenderTrav.getViewport());
RenderTrav.getDriver()->activeVertexProgram(NULL); RenderTrav.getDriver()->activeVertexProgram(NULL);
RenderTrav.getDriver()->activePixelProgram(NULL);
IDriver::TPolygonMode oldPolygonMode = RenderTrav.getDriver()->getPolygonMode(); IDriver::TPolygonMode oldPolygonMode = RenderTrav.getDriver()->getPolygonMode();
CMaterial m; CMaterial m;
m.initUnlit(); m.initUnlit();