This commit is contained in:
kaetemi 2013-06-19 23:34:40 +02:00
parent aa3462b7bc
commit 1ed0d46026
8 changed files with 33 additions and 33 deletions

View file

@ -142,26 +142,6 @@ public:
*/ */
enum TMatrixCount { MaxModelMatrix= 16 }; 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: protected:
CSynchronized<TTexDrvInfoPtrMap> _SyncTexDrvInfos; CSynchronized<TTexDrvInfoPtrMap> _SyncTexDrvInfos;
@ -1035,7 +1015,7 @@ public:
* Does the driver supports pixel programs ? * Does the driver supports pixel programs ?
*/ */
virtual bool isPixelProgramSupported() const =0; virtual bool isPixelProgramSupported() const =0;
virtual bool isPixelProgramSupported(TPixelProgramProfile profile) const =0; virtual bool isPixelProgramSupported(CPixelProgram::TProfile profile) const =0;

View file

@ -175,7 +175,7 @@ public:
* - Water * - Water
* PostProcessing : * PostProcessing :
* - For internal use only when a pixel program is set manually through activePixelProgram. * - 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. * - May be replaced in the future by some generic shader system.
*/ */
enum TShader { Normal=0, enum TShader { Normal=0,

View file

@ -59,6 +59,26 @@ class CPixelProgram : public NLMISC::CRefCount
{ {
public: 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 /// Constructor
CPixelProgram (const char* program); CPixelProgram (const char* program);

View file

@ -1008,7 +1008,7 @@ public:
// Vertex program // Vertex program
virtual bool isVertexProgramSupported () const; virtual bool isVertexProgramSupported () const;
virtual bool isPixelProgramSupported () const; virtual bool isPixelProgramSupported () const;
virtual bool isPixelProgramSupported (TPixelProgramProfile profile) const; virtual bool isPixelProgramSupported (CPixelProgram::TProfile profile) const;
virtual bool isVertexProgramEmulated () const; virtual bool isVertexProgramEmulated () const;
virtual bool activeVertexProgram (CVertexProgram *program); virtual bool activeVertexProgram (CVertexProgram *program);
virtual bool activePixelProgram (CPixelProgram *program); virtual bool activePixelProgram (CPixelProgram *program);

View file

@ -60,7 +60,7 @@ bool CDriverD3D::isPixelProgramSupported () const
return _PixelProgram; return _PixelProgram;
} }
bool CDriverD3D::isPixelProgramSupported (TPixelProgramProfile profile) const bool CDriverD3D::isPixelProgramSupported (CPixelProgram::TProfile profile) const
{ {
H_AUTO_D3D(CDriverD3D_isPixelProgramSupported_profile) H_AUTO_D3D(CDriverD3D_isPixelProgramSupported_profile)
return ((profile & 0xFFFF0000) == 0xD3D00000) return ((profile & 0xFFFF0000) == 0xD3D00000)

View file

@ -1305,7 +1305,7 @@ private:
bool isVertexProgramSupported () const; bool isVertexProgramSupported () const;
bool isPixelProgramSupported () const; bool isPixelProgramSupported () const;
bool isPixelProgramSupported (TPixelProgramProfile profile) const; bool isPixelProgramSupported (CPixelProgram::TProfile profile) const;
bool isVertexProgramEmulated () const; bool isVertexProgramEmulated () const;
bool activeVertexProgram (CVertexProgram *program); bool activeVertexProgram (CVertexProgram *program);
bool activePixelProgram (CPixelProgram *program); bool activePixelProgram (CPixelProgram *program);

View file

@ -68,14 +68,14 @@ bool CDriverGL::isPixelProgramSupported() const
H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported) H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported)
return _Extensions.ARBFragmentProgram; return _Extensions.ARBFragmentProgram;
} }
bool CDriverGL::isPixelProgramSupported(TPixelProgramProfile profile) const bool CDriverGL::isPixelProgramSupported(CPixelProgram::TProfile profile) const
{ {
H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported_profile) H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported_profile)
switch (profile) switch (profile)
{ {
case arbfp1: case CPixelProgram::arbfp1:
return _Extensions.ARBFragmentProgram; return _Extensions.ARBFragmentProgram;
case fp40: case CPixelProgram::fp40:
return _Extensions.NVFragmentProgram2; return _Extensions.NVFragmentProgram2;
} }
} }

View file

@ -339,28 +339,28 @@ void initCommands()
"mov oC0.xzw, c0.xyyx\n" "mov oC0.xzw, c0.xyyx\n"
"texld oC0.y, v0, s0\n"; "texld oC0.y, v0, s0\n";
NL3D::IDriver *d = dynamic_cast<NL3D::CDriverUser *>(Driver)->getDriver(); NL3D::IDriver *d = dynamic_cast<NL3D::CDriverUser *>(Driver)->getDriver();
if (d->isPixelProgramSupported(IDriver::fp40)) if (d->isPixelProgramSupported(CPixelProgram::fp40))
{ {
nldebug("fp40"); nldebug("fp40");
a_DevPixelProgram = new CPixelProgram(program_fp40); a_DevPixelProgram = new CPixelProgram(program_fp40);
} }
else if (d->isPixelProgramSupported(IDriver::arbfp1)) else if (d->isPixelProgramSupported(CPixelProgram::arbfp1))
{ {
nldebug("arbfp1"); nldebug("arbfp1");
a_DevPixelProgram = new CPixelProgram(program_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"); nldebug("ps_3_0");
a_DevPixelProgram = new CPixelProgram(program_ps_3_0); a_DevPixelProgram = new CPixelProgram(program_ps_3_0);
// Textures do not seem to work with 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"); nldebug("ps_2_0");
a_DevPixelProgram = new CPixelProgram(program_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"); nldebug("ps_1_1");
a_DevPixelProgram = new CPixelProgram(program_ps_1_1); a_DevPixelProgram = new CPixelProgram(program_ps_1_1);