mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-25 00:06:16 +00:00
Add support for fp40 with opengl
This commit is contained in:
parent
3ff6a3c640
commit
143ab99b89
5 changed files with 43 additions and 9 deletions
|
@ -155,9 +155,9 @@ public:
|
|||
|
||||
// opengl - 0x0610,bitfield
|
||||
arbfp1 = 0x06100001, // ARB_fragment_program
|
||||
// fp20 = 0x061B0002,
|
||||
fp30 = 0x06100004, // NV_fragment_program
|
||||
fp40 = 0x06100008, // NV_fragment_program2
|
||||
// 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
|
||||
};
|
||||
|
|
|
@ -1225,6 +1225,15 @@ static bool setupARBFragmentProgram(const char *glext)
|
|||
return true;
|
||||
}
|
||||
|
||||
// *********************************
|
||||
static bool setupNVFragmentProgram2(const char *glext)
|
||||
{
|
||||
H_AUTO_OGL(setupNVFragmentProgram2);
|
||||
CHECK_EXT("GL_NV_fragment_program2");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
static bool setupARBVertexBufferObject(const char *glext)
|
||||
{
|
||||
|
@ -1566,10 +1575,12 @@ void registerGlExtensions(CGlExtensions &ext)
|
|||
if (!ext.DisableHardwarePixelProgram)
|
||||
{
|
||||
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
|
||||
ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext);
|
||||
}
|
||||
else
|
||||
{
|
||||
ext.ARBFragmentProgram = false;
|
||||
ext.NVFragmentProgram2 = false;
|
||||
}
|
||||
|
||||
ext.OESDrawTexture = setupOESDrawTexture(glext);
|
||||
|
@ -1582,14 +1593,12 @@ void registerGlExtensions(CGlExtensions &ext)
|
|||
ext.NVTextureShader = setupNVTextureShader(glext);
|
||||
ext.ATIEnvMapBumpMap = setupATIEnvMapBumpMap(glext);
|
||||
ext.ATIFragmentShader = setupATIFragmentShader(glext);
|
||||
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
|
||||
}
|
||||
else
|
||||
{
|
||||
ext.ATIEnvMapBumpMap = false;
|
||||
ext.NVTextureShader = false;
|
||||
ext.ATIFragmentShader = false;
|
||||
ext.ARBFragmentProgram = false;
|
||||
}
|
||||
|
||||
// For now, the only way to know if emulation, is to test some extension which exist only on GeForce3.
|
||||
|
|
|
@ -103,6 +103,9 @@ struct CGlExtensions
|
|||
bool ARBTextureNonPowerOfTwo;
|
||||
bool ARBMultisample;
|
||||
|
||||
// NV Pixel Programs
|
||||
bool NVFragmentProgram2;
|
||||
|
||||
bool OESDrawTexture;
|
||||
bool OESMapBuffer;
|
||||
|
||||
|
@ -208,6 +211,7 @@ public:
|
|||
result += NVTextureShader ? "NVTextureShader " : "";
|
||||
result += ATIFragmentShader ? "ATIFragmentShader " : "";
|
||||
result += ARBFragmentProgram ? "ARBFragmentProgram " : "";
|
||||
result += NVFragmentProgram2 ? "NVFragmentProgram2 " : "";
|
||||
result += ARBVertexProgram ? "ARBVertexProgram " : "";
|
||||
result += NVVertexProgram ? "NVVertexProgram " : "";
|
||||
result += EXTVertexShader ? "EXTVertexShader " : "";
|
||||
|
|
|
@ -71,7 +71,13 @@ bool CDriverGL::isPixelProgramSupported() const
|
|||
bool CDriverGL::isPixelProgramSupported(TPixelProgramProfile profile) const
|
||||
{
|
||||
H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported_profile)
|
||||
return profile == arbfp1 && _Extensions.ARBFragmentProgram;
|
||||
switch (profile)
|
||||
{
|
||||
case arbfp1:
|
||||
return _Extensions.ARBFragmentProgram;
|
||||
case fp40:
|
||||
return _Extensions.NVFragmentProgram2;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -304,6 +304,16 @@ void initCommands()
|
|||
"MOV result.color.xzw, c[0].xyyx;\n"
|
||||
"TEX result.color.y, fragment.texcoord[0], texture[0], 2D;\n"
|
||||
"END\n";
|
||||
static const char *program_fp40 =
|
||||
"!!ARBfp1.0\n"
|
||||
"OPTION NV_fragment_program2;\n"
|
||||
"PARAM c[1] = { { 1, 0 } };\n"
|
||||
"TEMP RC;\n"
|
||||
"TEMP HC;\n"
|
||||
"OUTPUT oCol = result.color;\n"
|
||||
"MOVR oCol.xzw, c[0].xyyx;\n"
|
||||
"TEX oCol.y, fragment.texcoord[0], texture[0], 2D;\n"
|
||||
"END\n";
|
||||
static const char *program_ps_1_1 =
|
||||
"ps.1.1\n"
|
||||
"def c0, 0.000000, 0.000000, 1.000000, 0.000000\n"
|
||||
|
@ -329,7 +339,12 @@ void initCommands()
|
|||
"mov oC0.xzw, c0.xyyx\n"
|
||||
"texld oC0.y, v0, s0\n";
|
||||
NL3D::IDriver *d = dynamic_cast<NL3D::CDriverUser *>(Driver)->getDriver();
|
||||
if (d->isPixelProgramSupported(IDriver::arbfp1))
|
||||
if (d->isPixelProgramSupported(IDriver::fp40))
|
||||
{
|
||||
nldebug("fp40");
|
||||
a_DevPixelProgram = new CPixelProgram(program_fp40);
|
||||
}
|
||||
else if (d->isPixelProgramSupported(IDriver::arbfp1))
|
||||
{
|
||||
nldebug("arbfp1");
|
||||
a_DevPixelProgram = new CPixelProgram(program_arbfp1);
|
||||
|
|
Loading…
Reference in a new issue