diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index ee040df78..3644fefca 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -142,26 +142,6 @@ public: */ enum TMatrixCount { MaxModelMatrix= 16 }; - enum TPixelProgramProfile - { - // direct3d - 0xD3D0,major,minor - ps_1_1 = 0xD3D00101, - ps_1_2 = 0xD3D00102, - ps_1_3 = 0xD3D00103, - ps_1_4 = 0xD3D00104, - ps_2_0 = 0xD3D00200, - ps_2_x = 0xD3D00201, // not sure... - ps_3_0 = 0xD3D00300, - - // opengl - 0x0610,bitfield - arbfp1 = 0x06100001, // ARB_fragment_program - // fp20 = 0x061B0002, // very limited and outdated, unnecessary - // fp30 = 0x06100004, // NV_fragment_program, now arbfp1, redundant - fp40 = 0x06100008, // NV_fragment_program2, arbfp1 with "OPTION NV_fragment_program2;\n" - gp4fp = 0x06100010, // NV_gpu_program4 - gp5fp = 0x06100020, // NV_gpu_program5 - }; - protected: CSynchronized _SyncTexDrvInfos; @@ -1035,7 +1015,7 @@ public: * Does the driver supports pixel programs ? */ virtual bool isPixelProgramSupported() const =0; - virtual bool isPixelProgramSupported(TPixelProgramProfile profile) const =0; + virtual bool isPixelProgramSupported(CPixelProgram::TProfile profile) const =0; diff --git a/code/nel/include/nel/3d/material.h b/code/nel/include/nel/3d/material.h index b9f063af1..bf00f9741 100644 --- a/code/nel/include/nel/3d/material.h +++ b/code/nel/include/nel/3d/material.h @@ -175,7 +175,7 @@ public: * - Water * PostProcessing : * - For internal use only when a pixel program is set manually through activePixelProgram. - * - Only textures are set by CMaterial (probably does not work yet), the rest must be set manually. + * - Only textures are set by CMaterial (does not work with ps_3_0 for some reason), the rest must be set manually. * - May be replaced in the future by some generic shader system. */ enum TShader { Normal=0, diff --git a/code/nel/include/nel/3d/pixel_program.h b/code/nel/include/nel/3d/pixel_program.h index 811dbe0e1..6e14f0f04 100644 --- a/code/nel/include/nel/3d/pixel_program.h +++ b/code/nel/include/nel/3d/pixel_program.h @@ -59,6 +59,26 @@ class CPixelProgram : public NLMISC::CRefCount { public: + enum TProfile + { + // direct3d - 0xD3D0,major,minor + ps_1_1 = 0xD3D00101, + ps_1_2 = 0xD3D00102, + ps_1_3 = 0xD3D00103, + ps_1_4 = 0xD3D00104, + ps_2_0 = 0xD3D00200, + ps_2_x = 0xD3D00201, // not sure... + ps_3_0 = 0xD3D00300, + + // opengl - 0x0610,bitfield + // fp20 = 0x061B0001, // very limited and outdated, unnecessary + // fp30 = 0x06100002, // NV_fragment_program, now arbfp1, redundant + arbfp1 = 0x06100004, // ARB_fragment_program + fp40 = 0x06100008, // NV_fragment_program2, arbfp1 with "OPTION NV_fragment_program2;\n" + gp4fp = 0x06100010, // NV_gpu_program4 + gp5fp = 0x06100020, // NV_gpu_program5 + }; + /// Constructor CPixelProgram (const char* program); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index 465689838..cb6975725 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -1008,7 +1008,7 @@ public: // Vertex program virtual bool isVertexProgramSupported () const; virtual bool isPixelProgramSupported () const; - virtual bool isPixelProgramSupported (TPixelProgramProfile profile) const; + virtual bool isPixelProgramSupported (CPixelProgram::TProfile profile) const; virtual bool isVertexProgramEmulated () const; virtual bool activeVertexProgram (CVertexProgram *program); virtual bool activePixelProgram (CPixelProgram *program); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp index 2d7303589..d27019fff 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp @@ -60,7 +60,7 @@ bool CDriverD3D::isPixelProgramSupported () const return _PixelProgram; } -bool CDriverD3D::isPixelProgramSupported (TPixelProgramProfile profile) const +bool CDriverD3D::isPixelProgramSupported (CPixelProgram::TProfile profile) const { H_AUTO_D3D(CDriverD3D_isPixelProgramSupported_profile) return ((profile & 0xFFFF0000) == 0xD3D00000) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index 3f7487937..a46d8c704 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -1305,7 +1305,7 @@ private: bool isVertexProgramSupported () const; bool isPixelProgramSupported () const; - bool isPixelProgramSupported (TPixelProgramProfile profile) const; + bool isPixelProgramSupported (CPixelProgram::TProfile profile) const; bool isVertexProgramEmulated () const; bool activeVertexProgram (CVertexProgram *program); bool activePixelProgram (CPixelProgram *program); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp index 4131c76b1..74a1127c6 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp @@ -68,14 +68,14 @@ bool CDriverGL::isPixelProgramSupported() const H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported) return _Extensions.ARBFragmentProgram; } -bool CDriverGL::isPixelProgramSupported(TPixelProgramProfile profile) const +bool CDriverGL::isPixelProgramSupported(CPixelProgram::TProfile profile) const { H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported_profile) switch (profile) { - case arbfp1: + case CPixelProgram::arbfp1: return _Extensions.ARBFragmentProgram; - case fp40: + case CPixelProgram::fp40: return _Extensions.NVFragmentProgram2; } } diff --git a/code/snowballs2/client/src/commands.cpp b/code/snowballs2/client/src/commands.cpp index 5c1274472..46c655a5b 100644 --- a/code/snowballs2/client/src/commands.cpp +++ b/code/snowballs2/client/src/commands.cpp @@ -339,28 +339,28 @@ void initCommands() "mov oC0.xzw, c0.xyyx\n" "texld oC0.y, v0, s0\n"; NL3D::IDriver *d = dynamic_cast(Driver)->getDriver(); - if (d->isPixelProgramSupported(IDriver::fp40)) + if (d->isPixelProgramSupported(CPixelProgram::fp40)) { nldebug("fp40"); a_DevPixelProgram = new CPixelProgram(program_fp40); } - else if (d->isPixelProgramSupported(IDriver::arbfp1)) + else if (d->isPixelProgramSupported(CPixelProgram::arbfp1)) { nldebug("arbfp1"); a_DevPixelProgram = new CPixelProgram(program_arbfp1); } - /*else if (d->isPixelProgramSupported(IDriver::ps_3_0)) + /*else if (d->isPixelProgramSupported(CPixelProgram::ps_3_0)) { nldebug("ps_3_0"); a_DevPixelProgram = new CPixelProgram(program_ps_3_0); // Textures do not seem to work with ps_3_0... }*/ - else if (d->isPixelProgramSupported(IDriver::ps_2_0)) + else if (d->isPixelProgramSupported(CPixelProgram::ps_2_0)) { nldebug("ps_2_0"); a_DevPixelProgram = new CPixelProgram(program_ps_2_0); } - else if (d->isPixelProgramSupported(IDriver::ps_1_1)) + else if (d->isPixelProgramSupported(CPixelProgram::ps_1_1)) { nldebug("ps_1_1"); a_DevPixelProgram = new CPixelProgram(program_ps_1_1);